木偶-铬的释放控制

时间:2018-07-07 12:27:16

标签: puppeteer google-chrome-headless

我想通过登录到特定网站,创建新发票,预先填充数据来半自动化业务流程(创建发票),但是在那之后,我希望放弃对用户的控制,以便数据可以进行验证,并通过手动单击按钮创建发票。

到目前为止,我已经

(async () => {
  const browser = await puppeteer.launch({ headless: false});
  const page = await browser.newPage();

  await page.setViewport({width: 1600, height: 2400});

  console.log("SetViewPort");

  await page.goto('xxx/login');

  console.log("Logging in...");
  await page.screenshot({path: 'login.png'});

  await page.type('#loginform input[name=usrloginname]', 'xxx');
  await page.type('#loginform input[name=usrpassword]', 'xxx');
  await page.click('#loginform button');
  await page.waitForNavigation();


  console.log("Login submitted...");
  await page.screenshot({path: 'loggedin.png'});

  await page.goto('xxx/invoice/create');

  console.log("Get form for new invoice...");
  await page.screenshot({path: 'emptyinvoice.png'});


  await page.type('#form_newszla input[name=partnername]', name);
  await page.type('#form_newszla input[name=partnercity]', city);
....

   // ???! RELINQUISH CONTROL HERE

})();

0 个答案:

没有答案