I am running a protractor test to test if the proper URL is being displayed. When logging the method getCurrentUrl() within browser, I receive an object. Is there something I am missing?
describe('angularjs homepage todo list', function() {
it('should add a todo', function() {
browser.get('https://angularjs.org');
console.log(browser.getCurrentUrl());
});
});
Here is the output with the object logged instead of URL.
how can i get exact URL.
@awarerahul you gotta resolve the promise liek this
wd.getCurrentUrl().then( function( url ) {
console.log(url);
});
Thanks
or simply "await" for the .getCurrentUrl(), then the output will be the usable string
Example:
async function someFunc() {
console.log(await browser.getCurrentUrl()); //output: "http://your-current.url"
}
Most helpful comment
@awarerahul you gotta resolve the promise liek this
wd.getCurrentUrl().then( function( url ) {
console.log(url);
});