Explore Courses Blog Tutorials Interview Questions
0 votes
in DevOps and Agile by (19.7k points)

In protractor, globally available browser object has two methods:


Returns the current absolute URL from AngularJS.


Schedules a command to retrieve the URL of the current page.

It is not quite clear and obvious what is the difference between the two. To this very moment, I've been using getCurrentUrl() only.

When should we use getLocationAbsUrl()? Which use-cases does it cover?

I cannot recall anything similar to getLocationAbsUrl() in other selenium language bindings. It looks pretty much protractor-specific.

1 Answer

0 votes
by (62.9k points)

As declared previously the getLocationAbsUrl - returns a full path to the present location.



The getCurrentUrl is used during a promise (schedule) to retrieve the URL of the current page.

Typically, you'd solely use the getCurrentUrl when scheduling.

webdriver.WebDriver.prototype.getCurrentUrl = function()

Browse Categories