docs: some syntax fixes (#2116)

This commit is contained in:
Vasilii Artemchuk 2020-05-07 22:33:35 +03:00 committed by GitHub
parent d39ec35cd7
commit 4c4fa8d38c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 45 additions and 46 deletions

View file

@ -100,7 +100,7 @@ const { firefox } = require('playwright');
height: document.documentElement.clientHeight, height: document.documentElement.clientHeight,
deviceScaleFactor: window.devicePixelRatio deviceScaleFactor: window.devicePixelRatio
} }
}) });
console.log(dimensions); console.log(dimensions);
await browser.close(); await browser.close();

View file

@ -46,8 +46,7 @@ const context = await browser.newContext({
}); });
// Resize viewport for individual page // Resize viewport for individual page
await page.setViewportSize( await page.setViewportSize({ width: 1600, height: 1200 });
{ 'width': 1600, 'height': 1200 });
// Emulate high-DPI // Emulate high-DPI
const context = await browser.newContext({ const context = await browser.newContext({
@ -155,7 +154,7 @@ const context = await browser.newContext({
Change the location later: Change the location later:
```js ```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. **Note** you can only change geolocation for all pages in the context.

View file

@ -207,10 +207,10 @@ Simple version produces a single character. This character is case-sensitive, so
```js ```js
// <input id=name></input> // <input id=name>
await page.press('#name', 'Shift+A'); await page.press('#name', 'Shift+A');
// <input id=name></input> // <input id=name>
await page.press('#name', 'Shift+ArrowLeft'); await page.press('#name', 'Shift+ArrowLeft');
``` ```

View file

@ -14,7 +14,7 @@
Use npm or Yarn to install Playwright in your Node.js project. Playwright requires Node.js 10 or higher. Use npm or Yarn to install Playwright in your Node.js project. Playwright requires Node.js 10 or higher.
``` ```sh
npm i playwright npm i playwright
``` ```

View file

@ -7,9 +7,9 @@ This test server is used internally by Playwright to test Playwright itself.
```js ```js
const {TestServer} = require('.'); const {TestServer} = require('.');
(async(() => { (async () => {
const httpServer = await TestServer.create(__dirname, 8000), const httpServer = await TestServer.create(__dirname, 8000);
const httpsServer = await TestServer.createHTTPS(__dirname, 8001) const httpsServer = await TestServer.createHTTPS(__dirname, 8001);
httpServer.setRoute('/hello', (req, res) => { httpServer.setRoute('/hello', (req, res) => {
res.end('Hello, world!'); res.end('Hello, world!');
}); });