From dc57d03c1957cc9fb44b4b8eebdefe26a39aeb20 Mon Sep 17 00:00:00 2001 From: Chris B Date: Sun, 6 Oct 2019 23:32:35 -0700 Subject: [PATCH] docs(api): clarify `type` method examples (#5010) --- docs/api.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/api.md b/docs/api.md index b1b20048..dd08ab29 100644 --- a/docs/api.md +++ b/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). ```js -page.type('#mytextarea', 'Hello'); // Types instantly -page.type('#mytextarea', 'World', {delay: 100}); // Types slower, like a user +await page.type('#mytextarea', 'Hello'); // Types instantly +await page.type('#mytextarea', 'World', {delay: 100}); // Types slower, like a user ``` 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). ```js -page.keyboard.type('Hello'); // Types instantly -page.keyboard.type('World', {delay: 100}); // Types slower, like a user +await page.keyboard.type('Hello'); // Types instantly +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. @@ -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). ```js -frame.type('#mytextarea', 'Hello'); // Types instantly -frame.type('#mytextarea', 'World', {delay: 100}); // Types slower, like a user +await frame.type('#mytextarea', 'Hello'); // Types instantly +await frame.type('#mytextarea', 'World', {delay: 100}); // Types slower, like a user ``` #### 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). ```js -elementHandle.type('Hello'); // Types instantly -elementHandle.type('World', {delay: 100}); // Types slower, like a user +await elementHandle.type('Hello'); // Types instantly +await elementHandle.type('World', {delay: 100}); // Types slower, like a user ``` An example of typing into a text field and then submitting the form: