PoliDown
PoliDown copied to clipboard
Headless mode not working
As title said, the script does not work on Windows when headless: true
Switching it to: headless: false
makes it work.
In particular the script stuck at networkidle2:
await page.goto('https://web.microsoftstream.com/', { waitUntil: 'networkidle2' });
After 30s I got timeout exception.
I tried changing it into:
await page.goto('https://web.microsoftstream.com/', { waitUntil: 'domcontentloaded' });
but the script goes on a bit and then it stuck after on this line:
await page.waitForSelector('input[id="login"]'
with another timeout exception.
It seems that the browser have a different behavior when is in headless mode: https://github.com/puppeteer/puppeteer/issues/665#issuecomment-327258632 The comment above suggest to change user agent when you are in headless mode. Maybe an additional window appears, or Polimi prevents bots from login (???)
I'm experiencing the same issue with a script that worked well for months. I think it’s caused by some changes in Chromium
same problem with chromium