Q:

Protractor browser.driver.getCurrentUrl vs browser.getCurrentUrl

I'm running an Angular app and I'm trying to get the current URL when testing on protractor. Which one to use?
browser.driver.getCurrentUrl() or browser.getCurrentUrl() ?

A:

If this is an Angular application under test - use browser, otherwise - browser.driver.
To quote @jmr from a relevant github issue:

If you need to interact with a non-Angular page, you may access the wrapped webdriver instance directly with browser.driver.

Though, note that both are gonna work if this is Angular application under test. Some people even said that found browser.driver more reliable if it the sync time is longer than usual:

Just to add to this - I find that browser.driver works better on AngularJS apps that take time to sync. I have tried both and for some reason browser.driver is more reliable.

Though, I've personally used browser.getCurrentUrl() and cannot recall any problems.

