0

I have the following code that automates the login to a particular site, in order to grab some value that is behind a login screen.

#!/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

Alexei Masterov
  • 382
  • 2
  • 10

1 Answers1

1

I spent hours trying to debug this, but what finally solved it is downgrading websockets to 6.0, as some people suggested here: Pyppeteer crushes after 20 seconds with pyppeteer.errors.NetworkError

pip3 install websockets==6.0 --force-reinstall

Alexei Masterov
  • 382
  • 2
  • 10