我有以下代码可以自动登录到特定站点,以便获取登录屏幕后面的一些值。
#!/usr/bin/python3
import asyncio
from pyppeteer import launch
browser = await launch( {'headless': True} );
page = await browser.newPage()
await page.goto(page_url1, {'waitUntil': 'networkidle2', 'timeout': '30000'})
# injecting username and password redacted
await asyncio.gather(
page.waitForNavigation({'waitUntil': 'networkidle2', 'timeout': '30000'}),
page.click('#submitButton')
)
# the line above got stuck or timed out
await browser.close()
pyppeteer.errors.TimeoutError: Navigation Timeout Exceeded: 30000 ms exceeded