Protractor browser.driver.getCurrentUrl vs browser.getCurrentUrl

前端 未结 1 350
被撕碎了的回忆
被撕碎了的回忆 2021-01-14 13:05

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

相关标签:
1条回答
  • 2021-01-14 13:37

    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.

    0 讨论(0)
提交回复
热议问题