Puppeteer not working when is not focused
See original GitHub issueEnvironment:
- Puppeteer version: 1.8.0
- Platform / OS version: Win 10 64b and Ubuntu 18.04.1 LTS
- URLs (if applicable): No
- Node.js version: v10.6.0
I am using puppeteer for testing my pages. When I run the app and hide it into background then puppeteer is paused (or freeze). When I move puppeteer into foreground is running normally.
I think that its problem “when window is not focused, its not working”.
This behavior is on windows and linux too.
Set up code:
const args = []
args.push('--start-maximized')
args.push('--disable-gpu')
args.push('--disable-setuid-sandbox')
args.push('--force-device-scale-factor')
args.push('--ignore-certificate-errors')
args.push('--no-sandbox')
this.driver = await puppeteer.launch({
headless: false,
args,
userDataDir: `puppeteer_profile`,
})
i happen only “sometimes” I don’t know when.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:27
- Comments:78 (11 by maintainers)
Top Results From Across the Web
Puppeteer not working as excepted (pause/freeze when ...
I'm using the default Chromium browser of Puppeteer. All is working well, but the problem is, that when I run the crawling script,...
Read more >Puppeteer documentation - DevDocs
Puppeteer is a Node library which provides a high-level API to control Chromium or Chrome over the DevTools Protocol. The Puppeteer API is...
Read more >FAQ | Puppeteer
No. Both projects are valuable for very different reasons: Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard ...
Read more >Overview of Puppeteer and puppeteer-core in Node.js
Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the DevTools Protocol. Here is an overview...
Read more >Puppeteer overview - Microsoft Edge Development
Headless browsers don't display a user interface (UI), so you must use the command line. You can also configure Puppeteer to run full...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Nope you are not only one, I have same problem above.
[Solution]:
Add the following values to the array you assign to the args property in the options object. Now, you should be able to run Puppeteer while your window is in the foreground, background, or minimized.
Update: I’m running parallel instances of Puppeteer using the same script in multiple windows with one tab per window. Each window completed successfully whether it was in the foreground, background, or minimized. And, it worked in both headless and headful mode.
Solution and explanation available in an article written by Rohit Kumar, @rkr090 at Big Binary:
Debugging failing tests in puppeteer because of background tab