Page Object .navigate() returning a type error: 'undefined is not a function'

1,446 views
Skip to first unread message

rhazes

unread,
Jul 22, 2015, 4:38:38 PM7/22/15
to NightwatchJs
My test calls my page object and then attempts to call the method .navigate() but an error is returned on that line that says 'undefined is not a function'.
Is this a bug with Page Objects in Night watch? The documentation states that I can use this method if I have a url property in my Page Object: http://nightwatchjs.org/guide#using-page-objects.

for reference: I am using nightwatch 0.7.9. Here is what my test looks like:

//homeTest.js*
module.exports = {
  'demoGoogle' : function (client) {
    var google = client.page.home();
    google.navigate()
    client.end();
  }
}

//home.js*
module.exports = {
  url: "http//google.com"
}
 
*this is pretty much exactly how the examples provided are using it, am I missing something obvious?

folder structure:

- pages 
    - main
        - home.js
    - project
        - project.js
- tests
    - main
        - homeTest.js
- nightwatch.json


//nightwatch.json (snippet)  
{
  "src_folders" : ["tests"],
  "output_folder" : "reports/nightwatch_junitXML",
  "custom_commands_path" : "custom_commands",
  "custom_assertions_path" : "",
  "page_objects_path" : ["pages/main", "pages/project"],
  "globals_path" : "globals/globalsModule.js",

  },


Stephanie Madison

unread,
Jul 22, 2015, 4:48:52 PM7/22/15
to NightwatchJs

rhazes

unread,
Jul 22, 2015, 5:04:05 PM7/22/15
to NightwatchJs
THANK YOU!!!! 
I was thinking something long those lines and added the command property to it, but once that didn't work, I bailed.

I appreciate it!

rhazes

unread,
Jul 22, 2015, 5:05:03 PM7/22/15
to NightwatchJs
it'd be nice if the docs were updated to reflect that.

Stephanie Madison

unread,
Jul 22, 2015, 5:10:34 PM7/22/15
to NightwatchJs
Totally, we'll add, thanks
Reply all
Reply to author
Forward
0 new messages