Puppeteer Freezes when i put chromium on background , when i get it back to foreground script execution continues
See original GitHub issue- Puppeteer version: 1.13.0
- Platform / OS version: Mac / 10.14.2
- URLs (if applicable):
- Node.js version: 5.6.0
What steps will reproduce the problem?
Please include code that reproduces the issue.
const puppeteer = require('puppeteer');
let nau = async () =>{
const browser = await puppeteer.launch({timeout:300000,headless:false});
const page = await browser.newPage();
var g = await page.goto('https://my.naukri.com/Profile/edit?id=&altresid',{timeout:300000});
var there = await page.$("#usernameField");
//var there2 = await page.$("#emailTxt");
if(there != null)
{
await page.click("#usernameField");
await page.keyboard.type("aravindreddy.net@gmail.com");
await page.click("#passwordField");
await page.keyboard.type("9019444140@qQ");
await page.keyboard.press('Enter');
await page.waitForNavigation()
for(var i=0 ; i< 40 ; i++)
{
var test = await page.$("#root");
var h = await test.$(".resumeHeadline");
var j = await h.$(".widgetHead");
var k = await j.$(".widgetTitle + span")
await k.click();
// page.waitFor()
console.log("hello")
await page.keyboard.press('Tab');
await page.keyboard.type(".");
await page.keyboard.press('Tab');
await page.keyboard.press('Tab');
await page.keyboard.press('Enter')
console.log("Job Done" + i);
await page.waitFor((60000*3));
}
}
else{
await page.click("#emailTxt");
await page.keyboard.type("arvindchandrashekar@hotmail.com");
await page.click("#pwd1");
await page.keyboard.type("9019444140");
await page.keyboard.type('Enter');
}
}
nau();
What is the expected result? When i run the above script and have chromium in foreground , the script does its intended work , i expect the script to do the same when I put chromium in background.
What happens instead? when i put chromium in background the script flow kind of freezes , until i get chromium in foreground again.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:10 (2 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 >Using Chrome Devtools Protocol with Puppeteer
Puppeteer is a high level abstraction over the Chrome Devtools Protocol that gives you a user-friendly API to drive Chromium (or Blink) based...
Read more >1198567 - Headless browser freezes on Windows unless ...
We noticed a problem with the Chrome DevTools windows bots after rolling to a new Chromium version. Our e2e or interaction tests would...
Read more >node_modules/puppeteer/lib/types.d.ts - devtools ... - Google Git
Use the endpoint to reestablish a connection. * const browser2 = await puppeteer.connect({browserWSEndpoint});. * // Close Chromium.
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
[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.
Solution and explanation available in an article written by Rohit Kumar, @rkr090 at Big Binary:
Debugging failing tests in puppeteer because of background tab
For me the previous solution did not worked (Win 10). My hacky workaround is to normalize the Chromium window if it is accidently minimized, then use alt+tab to put it in the background.
I send the windowState: ‘normal’ command through CDPSession, as found here: https://github.com/GoogleChrome/puppeteer/issues/4513#issuecomment-500195352