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.

Cannot read property 'url' of undefined in Nightmare.js

See original GitHub issue

What are you trying to achieve?

I am trying go to another page using I.amOnPage(url). In my test my steps are:

    I.amOnPage(url); // this amOnPage works fine
    I.checkOption(element);
    I.amOnPage(anotherUrl); // this one doesn't

What do you get instead?

There error I get is Cannot read property 'url' of undefined

I have narrowed it down to the amOnPage function in Nightmare.js file in codeceptjs/lib/helper/Nightmare.js.

    return this.browser.goto(url, headers).then((res) => {
      this.debugSection('URL', res.url);
      this.debugSection('Code', res.code);
      this.debugSection('Headers', JSON.stringify(res.headers));
    });

the res being returned from the promise is coming back as undefined.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
petrisorionelcommented, Sep 13, 2017

Hello, I found this problem on version 1.0.2

0reactions
fatihmcicekcommented, Oct 16, 2021

PS C:\Users\fatih\Desktop\desktopp\amazon-test> npx codeceptjs run CodeceptJS v3.1.3 Using test root “C:\Users\fatih\Desktop\desktopp\amazon-test”

login – Error: Can’t connect to WebDriver. Error: Failed to create session. Unable to connect to “http://localhost:4444/wd/hub”, make sure browser driver is running on that address. If you use services like chromedriver see initialiseServices logs above or in wdio.log file as the service might had problems to start the driver.

Please make sure Selenium Server is running and accessible × Hatali Kullanici Girisi in 23ms

– FAILURES:

  1. login Hatali Kullanici Girisi: Cannot read properties of undefined (reading ‘url’) at WebDriver.amOnPage (node_modules\codeceptjs\lib\helper\WebDriver.js:901:25)
    at Step.run (node_modules\codeceptjs\lib\step.js:66:47) at C:\Users\fatih\Desktop\desktopp\amazon-test\node_modules\codeceptjs\lib\actor.js:116:23

Scenario Steps:

FAIL | 0 passed, 1 failed // 70ms Run with --verbose flag to see complete NodeJS stacktrace

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read property 'url' of undefined in Nightmare.js #528
I am trying go to another page using I.amOnPage(url). ... Cannot read property 'url' of undefined in Nightmare.js #528.
Read more >
Nightmare with Mocha: Uncaught TypeError: Cannot read ...
I'm trying to run an example test with Nightmare.js and Mocha, and I keep getting the error ...
Read more >
Cannot read property 'url' of undefined in Nightmare.js
Cannot read property 'url' of undefined in Nightmare.js. ... I am trying go to another page using I.amOnPage(url) . In my test my...
Read more >
Trying to extract data from search results using Nightmare.js ...
Trying to extract data from search results using Nightmare.js, but issues an error: “CANNOT READ PROPERTY 'CLICK' OF Undefined”.
Read more >
Cannot read property 'url' of undefined when starting server.js ...
Getting this error when running server.js. Started http server. info - socket.io started node.js:201 throw e; // process.
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