Python 即使页面已经加载,PYppeteer也会超时(没有微调器,没有网络活动)

Python 即使页面已经加载,PYppeteer也会超时(没有微调器,没有网络活动),python,chromium,ui-automation,browser-automation,pyppeteer,Python,Chromium,Ui Automation,Browser Automation,Pyppeteer,我有以下代码自动登录到特定站点,以便获取登录屏幕后面的一些值 #!/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'})

我有以下代码自动登录到特定站点,以便获取登录屏幕后面的一些值

#!/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 extended:30000ms extended

我花了几个小时试图调试这个,但最终解决的是将WebSocket降级到6.0,正如一些人在这里建议的那样:


pip3安装websockets==6.0——强制重新安装

,您使用的pyppeteer版本是什么?因为当前版本0.2.5将wevsockets>=8.1作为依赖项