Tuesday, August 2, 2016

Difference between Webdriver get() and Webdriver navigate()

GET will wait till the whole page gets loaded i.e. the on-load event has fired before returning control to our test or script.

Note : If there many ajax calls in the current page which webdriver is loading, then webdriver may not know when it has loaded completely. That time to make sure pages are fully loaded then you need to use " wait " .

Navigate will just redirect to our required page and will not wait.

get() navigate()
Waits till complete page loads. Will not wait until the page loads, you can feel this experience only if page takes time to load, like more number of images or ajax calls etc......
We can not perform forward, backward & refresh operation in the browser. We can perform forward, backward & refresh operation in the browser


driver.navigate().back(); // Perform backward function of browser
driver.navigate().forward();  // Perform forward function of browser
driver.navigate().refresh(); //refresh the browser

No comments:

Post a Comment