First script


In our first script, we will navigate to and take a screenshot in WebKit.

const { webkit } = require('playwright');

(async () => {
  const browser = await webkit.launch();
  const page = await browser.newPage();
  await page.goto('');
  await page.screenshot({ path: `example.png` });
  await browser.close();

By default, Playwright runs the browsers in headless mode. To see the browser UI, pass the headless: false flag while launching the browser. You can also use slowMo to slow down execution.

firefox.launch({ headless: false, slowMo: 50 });

本文章首发在 网站上。

我们的翻译工作遵照 CC 协议,如果我们的工作有侵犯到您的权益,请及时联系我们。
上一篇 下一篇
讨论数量: 0
发起讨论 只看当前版本