mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
docs(api): clarify type
method examples (#5010)
This commit is contained in:
parent
fff2737e8a
commit
dc57d03c19
16
docs/api.md
16
docs/api.md
@ -1872,8 +1872,8 @@ Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in t
|
|||||||
To press a special key, like `Control` or `ArrowDown`, use [`keyboard.press`](#keyboardpresskey-options).
|
To press a special key, like `Control` or `ArrowDown`, use [`keyboard.press`](#keyboardpresskey-options).
|
||||||
|
|
||||||
```js
|
```js
|
||||||
page.type('#mytextarea', 'Hello'); // Types instantly
|
await page.type('#mytextarea', 'Hello'); // Types instantly
|
||||||
page.type('#mytextarea', 'World', {delay: 100}); // Types slower, like a user
|
await page.type('#mytextarea', 'World', {delay: 100}); // Types slower, like a user
|
||||||
```
|
```
|
||||||
|
|
||||||
Shortcut for [page.mainFrame().type(selector, text[, options])](#frametypeselector-text-options).
|
Shortcut for [page.mainFrame().type(selector, text[, options])](#frametypeselector-text-options).
|
||||||
@ -2286,8 +2286,8 @@ Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in t
|
|||||||
To press a special key, like `Control` or `ArrowDown`, use [`keyboard.press`](#keyboardpresskey-options).
|
To press a special key, like `Control` or `ArrowDown`, use [`keyboard.press`](#keyboardpresskey-options).
|
||||||
|
|
||||||
```js
|
```js
|
||||||
page.keyboard.type('Hello'); // Types instantly
|
await page.keyboard.type('Hello'); // Types instantly
|
||||||
page.keyboard.type('World', {delay: 100}); // Types slower, like a user
|
await page.keyboard.type('World', {delay: 100}); // Types slower, like a user
|
||||||
```
|
```
|
||||||
|
|
||||||
> **NOTE** Modifier keys DO NOT effect `keyboard.type`. Holding down `Shift` will not type the text in upper case.
|
> **NOTE** Modifier keys DO NOT effect `keyboard.type`. Holding down `Shift` will not type the text in upper case.
|
||||||
@ -2768,8 +2768,8 @@ Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in t
|
|||||||
To press a special key, like `Control` or `ArrowDown`, use [`keyboard.press`](#keyboardpresskey-options).
|
To press a special key, like `Control` or `ArrowDown`, use [`keyboard.press`](#keyboardpresskey-options).
|
||||||
|
|
||||||
```js
|
```js
|
||||||
frame.type('#mytextarea', 'Hello'); // Types instantly
|
await frame.type('#mytextarea', 'Hello'); // Types instantly
|
||||||
frame.type('#mytextarea', 'World', {delay: 100}); // Types slower, like a user
|
await frame.type('#mytextarea', 'World', {delay: 100}); // Types slower, like a user
|
||||||
```
|
```
|
||||||
|
|
||||||
#### frame.url()
|
#### frame.url()
|
||||||
@ -3348,8 +3348,8 @@ Focuses the element, and then sends a `keydown`, `keypress`/`input`, and `keyup`
|
|||||||
To press a special key, like `Control` or `ArrowDown`, use [`elementHandle.press`](#elementhandlepresskey-options).
|
To press a special key, like `Control` or `ArrowDown`, use [`elementHandle.press`](#elementhandlepresskey-options).
|
||||||
|
|
||||||
```js
|
```js
|
||||||
elementHandle.type('Hello'); // Types instantly
|
await elementHandle.type('Hello'); // Types instantly
|
||||||
elementHandle.type('World', {delay: 100}); // Types slower, like a user
|
await elementHandle.type('World', {delay: 100}); // Types slower, like a user
|
||||||
```
|
```
|
||||||
|
|
||||||
An example of typing into a text field and then submitting the form:
|
An example of typing into a text field and then submitting the form:
|
||||||
|
Loading…
Reference in New Issue
Block a user