Abhinav
Abhinav

Reputation: 1027

protractor : Best way to use in protractor ? driver.get("URL") or browser.get("URL")

Which is best way to use in protractor ?

var driver = browser.driver;
driver.get("URL")

or

browser.get("URL")
browser.manage().timeouts().implicitlyWait(browser.params.implicitWaitTime);

Currently I have used second approach to open URL and perform any browser action. Should I change everything like first approach or my approach is nice to go ahead ?

Upvotes: 1

Views: 1586

Answers (1)

AdityaReddy
AdityaReddy

Reputation: 3645

My two cents

  1. If its a non angular application - go For browser.driver.get() If not go for browser.get('') browser.get understands the angular cycle and waits for the angular activity to finish

from documentation - API Documentation

Navigate to the given destination and loads mock modules before Angular. Assumes that the page being loaded uses Angular. If you need to access a page which does not have Angular on load, use the wrapped webdriver directly.

  1. If you are using browser.get() then you dont need a implicit wait and ideally you should avoid using it

Upvotes: 2

Related Questions