docs: some syntax fixes (#2116)
This commit is contained in:
parent
d39ec35cd7
commit
4c4fa8d38c
|
|
@ -100,7 +100,7 @@ const { firefox } = require('playwright');
|
|||
height: document.documentElement.clientHeight,
|
||||
deviceScaleFactor: window.devicePixelRatio
|
||||
}
|
||||
})
|
||||
});
|
||||
console.log(dimensions);
|
||||
|
||||
await browser.close();
|
||||
|
|
|
|||
|
|
@ -46,8 +46,7 @@ const context = await browser.newContext({
|
|||
});
|
||||
|
||||
// Resize viewport for individual page
|
||||
await page.setViewportSize(
|
||||
{ 'width': 1600, 'height': 1200 });
|
||||
await page.setViewportSize({ width: 1600, height: 1200 });
|
||||
|
||||
// Emulate high-DPI
|
||||
const context = await browser.newContext({
|
||||
|
|
@ -155,7 +154,7 @@ const context = await browser.newContext({
|
|||
Change the location later:
|
||||
|
||||
```js
|
||||
await context.setGeolocation({ longitude: 29.979097, latitude: 31.134256 };
|
||||
await context.setGeolocation({ longitude: 29.979097, latitude: 31.134256 });
|
||||
```
|
||||
|
||||
**Note** you can only change geolocation for all pages in the context.
|
||||
|
|
|
|||
|
|
@ -207,10 +207,10 @@ Simple version produces a single character. This character is case-sensitive, so
|
|||
|
||||
|
||||
```js
|
||||
// <input id=name></input>
|
||||
// <input id=name>
|
||||
await page.press('#name', 'Shift+A');
|
||||
|
||||
// <input id=name></input>
|
||||
// <input id=name>
|
||||
await page.press('#name', 'Shift+ArrowLeft');
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
Use npm or Yarn to install Playwright in your Node.js project. Playwright requires Node.js 10 or higher.
|
||||
|
||||
```
|
||||
```sh
|
||||
npm i playwright
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ This test server is used internally by Playwright to test Playwright itself.
|
|||
```js
|
||||
const {TestServer} = require('.');
|
||||
|
||||
(async(() => {
|
||||
const httpServer = await TestServer.create(__dirname, 8000),
|
||||
const httpsServer = await TestServer.createHTTPS(__dirname, 8001)
|
||||
(async () => {
|
||||
const httpServer = await TestServer.create(__dirname, 8000);
|
||||
const httpsServer = await TestServer.createHTTPS(__dirname, 8001);
|
||||
httpServer.setRoute('/hello', (req, res) => {
|
||||
res.end('Hello, world!');
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue