Difference between driver.get() and driver.navigate()

driver.get(““)

  • Will wait till the page loads completely with all controls in place.
  • Used to get page source.

             driver.getPageSource(); 
       //returns the page source of current url that driver holds


driver.navigate().to(““)

  • Can navigate the page forward/backward

  • Used to refresh history.

        driver.navigate().refresh();

  • To redirect a page
  • will not wait till page loads

 In general, both get and navigate do the same task when invoking the url.(just small change in the services they both offers).

Content posted is based on learning or working experience, please leave comments if anything needs to be added or updated, discuss your queries on our facebook:qavalidation.com, Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: