Skip to content

Commit

Permalink
Merge pull request nightwatchjs#1097 from senocular/1046-navigate-cb
Browse files Browse the repository at this point in the history
Fixed nightwatchjs#1046 - adds callback to page object navigate()
  • Loading branch information
beatfactor authored Jul 23, 2016
2 parents 686a664 + d4d7acf commit 2e9787d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/page-object/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,16 @@ Page.prototype = {
*
* @method navigate
* @param {Object} [url=this.url] Url to navigate to.
* @param {function} [callback] Optional callback function to be called when the command finishes.
* @returns {*}
*/
navigate: function(url) {
navigate: function(url, callback) {
var goToUrl = url || this.url;
if (goToUrl === null) {
throw new Error('Invalid URL: You must either add a url property to "' +
this.name + '" or provide a url as an argument');
}
this.api.url(goToUrl);
this.api.url(goToUrl, callback);
return this;
}
};
Expand Down

0 comments on commit 2e9787d

Please sign in to comment.