Fix browser page navigation for Puppeteer 11+ in test/test.js
In Puppeteer 11 we noticed that Firefox doesn't shut down once the tests are done anymore. I tracked this down to the `page.goto` call, in `startBrowser`, never resolving anymore. I can only assume that something changed in Puppeteer, possibly in combination with recent Firefox Nightly versions, that caused this, but haven't been able to fully track it down. However, I did find that the problem is that the `load` event no longer triggers, so fortunately we can fix the problem by explicitly waiting for the `domcontentloaded` event instead. In general this change might even be better since we now wait until the test framework is fully loaded before we continue. Note that this also still works for the current Puppeteer version. I did find two upstream references that appear to track this issue, both on the Puppeteer side and on the Firefox side, making me further suspect that the issue is partly on both sides: - https://github.com/puppeteer/puppeteer/issues/5806 - https://bugzilla.mozilla.org/show_bug.cgi?id=1706353
This commit is contained in:
parent
60ed3cd297
commit
0d2cdff6c5
@ -956,7 +956,7 @@ async function startBrowser(browserName, startUrl = "") {
|
||||
if (startUrl) {
|
||||
const pages = await browser.pages();
|
||||
const page = pages[0];
|
||||
await page.goto(startUrl, { timeout: 0 });
|
||||
await page.goto(startUrl, { timeout: 0, waitUntil: "domcontentloaded" });
|
||||
}
|
||||
|
||||
return browser;
|
||||
|
Loading…
x
Reference in New Issue
Block a user