Skip to content

net::ERR_ABORTED during headless testing  #2794

@maximkoshelenko

Description

@maximkoshelenko

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:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions