question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TestCafe cannot load website with incorrect headers

See original GitHub issue

What is your Test Scenario?

I’m trying to load https://www.freepeople.com and verify that the page loaded.

What is the Current behavior?

When I’m using node version 12 and above, the page never loads and is stuck at the “about:blank” page. If I use node 10.13.0, the page loads successfully. I am able to load other pages on node version 12, so I’m not sure why this website specifically won’t load.

What is the Expected behavior?

I am expecting the page to load.

What is your web application and your TestCafe test code?

Using node version 12.13.0, and testcafe v1.6.1

 import { Selector, ClientFunction } from 'testcafe';

function getUrl() {
    const clientfunction = ClientFunction(() => document.location.href);
    return clientfunction();
}

fixture('Core Application Tests')

test('Should load the page', async (t) => {
    await t.navigateTo('https://www.freepeople.com');
    await t.wait(3000);
    await t.expect(getUrl()).eql('https://www.freepeople.com');
});

Steps to Reproduce:

  1. Run the above code using node version 10.13.0, and testcafe v1.6.1
  2. Notice that the website loads correctly
  3. Run the above code using node version 12.13, and testcafe v1.6.1
  4. Notice that the website never loads, and is stuck on the about:blank page

Your Environment details:

  • testcafe version: 1.6.1
  • node.js version: 12.13.0
  • command-line arguments:
  • browser name and version: Chrome, Firefox
  • platform and version: macOS 10.14. Also able to reproduce using docker

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
LavrovArtemcommented, Feb 11, 2020

This issue relates to node.js that works according to http specification. On the TestCafe side we will fix it in the following way:

  • TestCafe will not hang up.
  • TestCafe will raise a clear message about this problem: Parse Error: Invalid header value char.

As a workaround, you can revert to the parsing header behavior on Node.js side by passing the NODE_OPTIONS='--http-parser=legacy' environment variable. Thanks @andrzej-kodify.

1reaction
Farfurixcommented, Nov 21, 2019

@KingM1

Hello,

Thank you for the detailed information. I’ve reproduced the issue with our testcafe-hammerhead@14.11.1 proxy:

  • node@10.13.0 - loaded
  • node@10.17.0, node@12.13.1 - didn’t load

Our team will research it and check for a suitable solution.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Testcafe doesn't load certain sites, results in about:error #4833
After testcafe connects to the browser, it fails to load the page. ... that the side produces a response header with an incorrect...
Read more >
Authentication and Roles | Advanced Guides - TestCafe
TestCafe can open web pages that require HTTP Basic and Windows (NTLM) authentication. Use the test. httpAuth method to specify credentials for each...
Read more >
testcafe - UNPKG
38, * TestCafe incorrectly specifies the Referer HTTP request header if you ... When TestCafe revisits a website, it loads assets from this...
Read more >
Cannot add header value to HTTP request via hooks
Using Testcafe, I am trying to add an HTTP Header key/value pair to all my requests, but it is not appearing in the...
Read more >
TestCafe Webinar - Your Questions Answered
But we recommend using TestCafe for end-to-end rather than load testing. Can I run the tests in parallel in multiple browser windows? Yes, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found