-->

What is the difference between browser.setLocation

2020-07-30 00:58发布

问题:

I'm a protractor learner. So, I'm trying different methods in my tests while I'm testing my application. So, I was using browser.setLocation Before Each test for cases like page redirected during the test run, instead of just using browser.driver.get

As I understand I think using of browser.setLocation resolved lots of random failures I faced while running the test. I didn't want to use a browser.sleep().

I read this Protractor documentation for more clarification and it doesn't help.

Can someone tell me the usage of this method. Any kind of information will be appreciated.

Thanks in advance. :)

回答1:

browser.setLocation() uses Angular's $location. browser.driver.get is like typing in a new URL into the search bar. browser.get, which is what most people use, is a wrapped version of browser.driver.get which waits for everything to be synced.