📌  相关文章
📜  单击表单中的按钮时运行节点脚本 pupeeter - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:20.911000             🧑  作者: Mango

代码示例2
(async () => {
 const browser = await puppeteer.launch({ headless: true })
 const page = await browser.newPage()
 await page.goto('https://github.com/login')
 await page.type('#login_field', process.env.GITHUB_USER)
 await page.type('#password', process.env.GITHUB_PWD)
 await page.click('[name="commit"]')
 await page.waitForNavigation()
 await page.screenshot({ path: screenshot })
 browser.close()
 console.log('See screenshot: ' + screenshot)
})()