docs(api): fix lint in code snippets (#7012)
This commit is contained in:
parent
dc8ab6d8ca
commit
ff860819a7
16
docs/api.md
16
docs/api.md
@ -677,7 +677,7 @@ Puppeteer against it:
|
||||
```js
|
||||
const browserFetcher = puppeteer.createBrowserFetcher();
|
||||
const revisionInfo = await browserFetcher.download('533271');
|
||||
const browser = await puppeteer.launch({executablePath: revisionInfo.executablePath})
|
||||
const browser = await puppeteer.launch({ executablePath: revisionInfo.executablePath });
|
||||
```
|
||||
|
||||
> **NOTE** BrowserFetcher is not designed to work concurrently with other
|
||||
@ -1313,7 +1313,7 @@ If there's no element matching `selector`, the method throws an error.
|
||||
|
||||
Bear in mind that if `click()` triggers a navigation event and there's a separate `page.waitForNavigation()` promise to be resolved, you may end up with a race condition that yields unexpected results. The correct pattern for click and wait for navigation is the following:
|
||||
|
||||
```javascript
|
||||
```js
|
||||
const [response] = await Promise.all([
|
||||
page.waitForNavigation(waitOptions),
|
||||
page.click(selector, clickOptions),
|
||||
@ -1586,7 +1586,7 @@ await resultHandle.dispose();
|
||||
This function will return a [JSHandle] by default, however if your `pageFunction` returns an HTML element you will get back an `ElementHandle`:
|
||||
|
||||
```js
|
||||
const button = await page.evaluateHandle(() => document.querySelector('button'))
|
||||
const button = await page.evaluateHandle(() => document.querySelector('button'));
|
||||
// button is an ElementHandle, so you can call methods such as click:
|
||||
await button.click();
|
||||
```
|
||||
@ -1610,9 +1610,9 @@ An example of overriding the navigator.languages property before the page loads:
|
||||
// preload.js
|
||||
|
||||
// overwrite the `languages` property to use a custom getter
|
||||
Object.defineProperty(navigator, "languages", {
|
||||
Object.defineProperty(navigator, 'languages', {
|
||||
get: function() {
|
||||
return ["en-US", "en", "bn"];
|
||||
return ['en-US', 'en', 'bn'];
|
||||
}
|
||||
});
|
||||
|
||||
@ -2315,7 +2315,7 @@ return firstRequest.url();
|
||||
```js
|
||||
const firstResponse = await page.waitForResponse('https://example.com/resource');
|
||||
const finalResponse = await page.waitForResponse(response => response.url() === 'https://example.com' && response.status() === 200);
|
||||
const finalResponse = await page.waitForResponse(async response => { return (await response.text()).includes('<html>') })
|
||||
const finalResponse = await page.waitForResponse(async response => { return (await response.text()).includes('<html>') });
|
||||
return finalResponse.ok();
|
||||
```
|
||||
|
||||
@ -2735,7 +2735,7 @@ await page.mouse.move(
|
||||
boundingBox.y + boundingBox.height / 2
|
||||
);
|
||||
|
||||
await page.mouse.wheel({ deltaY: -100 })
|
||||
await page.mouse.wheel({ deltaY: -100 });
|
||||
```
|
||||
|
||||
### class: Touchscreen
|
||||
@ -2985,7 +2985,7 @@ If there's no element matching `selector`, the method throws an error.
|
||||
|
||||
Bear in mind that if `click()` triggers a navigation event and there's a separate `page.waitForNavigation()` promise to be resolved, you may end up with a race condition that yields unexpected results. The correct pattern for click and wait for navigation is the following:
|
||||
|
||||
```javascript
|
||||
```js
|
||||
const [response] = await Promise.all([
|
||||
page.waitForNavigation(waitOptions),
|
||||
frame.click(selector, clickOptions),
|
||||
|
Loading…
Reference in New Issue
Block a user