1. 下载pupperteer

npm i puppeteer

2. 启动一个本地服务 localhost

3. 开启测试

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch({ headless: false });
  const page = await browser.newPage();
  await page.goto('http://localhost:8080/');
  await page.setViewport({
    width:1920,
    height:1080
  })
  await page.type('.hello form input[name="name"]', '张啊咩', {delay: 100});
  await page.type('.hello form input[name="age"]', '22', {delay: 100});
  await page.click('.hello form input[type="submit"]');
})();

 

相关文章:

  • 2022-01-12
  • 2022-12-23
  • 2021-12-28
  • 2022-12-23
  • 2022-12-23
  • 2021-04-09
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-02
  • 2021-09-07
  • 2021-11-29
  • 2021-10-20
  • 2021-07-26
  • 2021-11-20
相关资源
相似解决方案