-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Description
Hello team. Need help with issue which only reproduce in headless mode. I have a test which is checked 200 and 206 result after clicking the footer links of site. But after adding PDF file as a footer link test crashed in headless mode (in debug mode it is working). Please help solve this problem :).
Steps to reproduce
Tell us about your environment:
- Puppeteer version:
- Platform / OS version: Windows
- URLs (if applicable): http://marketing.advanstar.info/mediakits/TC_MK_2016.pdf
- Node.js version:
npm -v : 5.6.0
What steps will reproduce the problem?
Please include code that reproduces the issue.
await page.goto('http://www.cancernetwork.com/', { waitUntil: "domcontentloaded" });
await page.waitForSelector('.expanded .menu');
let footerLinks = await page.evaluate(
() => Array.from(document.body.querySelectorAll('.expanded a[href]'), ({ href }) => href)
);
for (var r = 0; r < footerLinks.length; r++) {
let [response] = await Promise.all([
page.waitForNavigation(),
await page.goto(footerLinks[r], { waitUntil: "load" }),
]);
if (response._status == 206) {
expect(response._status).toBe(206);
} else {
expect(response._status).toBe(200);
}
response = '';
console.log('Footer link: ' + footerLinks[r] + ' was checked successfully');
}
What is the expected result?
Going to http://marketing.advanstar.info/mediakits/TC_MK_2016.pdf page with 200 or 206 status
What happens instead?
Without headless mode code is working, but in headless there is an error
net::ERR_ABORTED at http://marketing.advanstar.info/mediakits/TC_MK_2016.pdf
at navigate (node_modules/puppeteer/lib/Page.js:592:37)
I have tried execute code at https://try-puppeteer.appspot.com/ site
Code:
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('http://marketing.advanstar.info/mediakits/TC_MK_2016.pdf');
await browser.close();
Result:
Error running your code. Error: net::ERR_ABORTED at http://marketing.advanstar.info/mediakits/TC_MK_2016.pdf