What is the difference between browser.setLocation and browser.driver.get

All we need is an easy explanation of the problem, so here it is.

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. 🙂

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 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.

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply