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.

Undefined error message while using it with testcafe's chrome browser.

See original GitHub issue
Component Version
Operating system Mac Os
Node.js v14.15.5
chrome-remote-interface 0.30.0

Is Chrome running in a container? (I am using chrome with the help of TestCafe)

My main Aim: My Aim is to cut the network so that I can see the error dialog in the website while automation testing.

[Important]: Testcafe is opening with this url: //http://192.168.0.123:1234/someRandomString/https://theWebsiteThatIAmTesting.com/

const CDP = require('chrome-remote-interface');
let config = {
        offline: true,
        latency: 100,
        downloadThroughput: 750 * 1024 / 8,
        uploadThroughput: 250 * 1024 / 8
    };
let client = await CDP({
        port:1234,
        host:"192.168.0.123"
    });

    const {Network} = client;
    await Network.enable();
    Network.emulateNetworkConditions(config);

I am getting error at this line 34:

         29 |        });
         30 |        response.on('end', () => {
         31 |            if (response.statusCode === 200) {
         32 |                callback(null, data);
         33 |            } else {
       > 34 |                callback(new Error(data));
         35 |            }
         36 |        });
         37 |    });
         38 |    request.setTimeout(REQUEST_TIMEOUT, () => {
         39 |        request.abort();

         at IncomingMessage.<anonymous> (/.../node_modules/chrome-remote-interface/lib/external-request.js:34:26)

The error message is not visible and this is the main reason why I am putting this question over here.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
MukulCodecommented, May 12, 2021

Most likely http://192.168.0.123:1234/json/list returns an empty body, try with curl as I shown you above if you want to see the status code. In any case, that endpoint is not returning the list of targets as chrome-remote-interface expects to.

Got it. Trying this. Thanks for the explanation and help 😃

1reaction
cyrus-andcommented, May 12, 2021

Most likely http://192.168.0.123:1234/json/list returns an empty body, try with curl as I shown you above if you want to see the status code. In any case, that endpoint is not returning the list of targets as chrome-remote-interface expects to.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read property 'match' of undefined in version 1.8.1 ...
The problem is that TestCafe can't process incorrect empty registry keys, that can be left in the registry by some browsers after the ......
Read more >
TestCafe get "Cannot read property 'pageX' of undefined ...
Try running it with --skip-uncaught-errors flag.
Read more >
FAQ - TestCafe
The most common reason for this is a JavaScript error on the tested page. Load this page in the browser, open the console...
Read more >
Browsers | Concepts | Guides | Docs - TestCafe
This topic lists browsers supported by TestCafe and describes how to use various browser features. Browser Support. Officially Supported Browsers; Locally ...
Read more >
Client Functions and Script Injection for Page Interaction
The test code has no direct access to the browser context. TestCafe interacts with the browser asynchronously (which is why missing await issues ......
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