Skip to content
This repository has been archived by the owner on Jul 2, 2021. It is now read-only.

Commit

Permalink
update example
Browse files Browse the repository at this point in the history
  • Loading branch information
jperl committed Mar 25, 2020
1 parent 4463f6c commit 351e4cf
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 36 deletions.
15 changes: 4 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,21 @@ npm i playwright@next playwright-video
## Use

```js
const { chromium, devices } = require('playwright');
const { chromium } = require('playwright');
const { saveVideo } = require('playwright-video');

(async () => {
const iPhone = devices['iPhone 6'];

const browser = await chromium.launch();
const context = await browser.newContext({
viewport: iPhone.viewport,
userAgent: iPhone.userAgent,
});

const context = await browser.newContext();

const page = await context.newPage();

await saveVideo(page, '/tmp/video.mp4');

await page.goto('http://example.org');

await Promise.all([
page.waitForNavigation({ waitUntil: 'networkidle0' }),
page.click('a'),
]);
await page.click('a');

await browser.close();
})();
Expand Down
20 changes: 20 additions & 0 deletions src/example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const { chromium } = require('playwright');
const { saveVideo } = require('playwright-video');

(async () => {
const browser = await chromium.launch();

const context = await browser.newContext();

const page = await context.newPage();

const capture = await saveVideo(page, '/tmp/video.mp4');

await page.goto('http://example.org');

await page.click('a');

await capture.stop();

await browser.close();
})();
25 changes: 0 additions & 25 deletions src/example.ts

This file was deleted.

0 comments on commit 351e4cf

Please sign in to comment.