What is the main difference between driver.get(baseurl) and driver.navigate().to(baseurl)?

waiting for u r replay…

Train Asked on September 4, 2014 in Selenium WebDriver.
Add Comment
  • 3 Answer(s)

    Hi Siva,

    Basically the Driver.Navigate returns a Navigation object. This object is implements an Interface called RemoteNavigation. RemoteNavigation has exposed methods to navigate, go back, go forward and refresh the page.

    On the other hand Navigation is so essential to the WebDriver object that it is also implemented as a WebDriver.Get() call also. Basically they both do the same thing, however Webdriver.Get() makes DriverCommand.GET call on Browser directly and  in case of Driver.Navigate.to() makes the same DriverCommand.GET call using the RemoteNavigation command.

    Its just a design difference, you can consider both as a synonym of each other.


    Professor Answered on September 4, 2014.
    Add Comment

    driver.get(baseurl) – Used to open a particular link – only open

    driver.navigate().to(baseurl) – Basically used to navigate between pages as the name suggests – navigate and open

    Vishal S

    Doctor Answered on September 4, 2014.
    Add Comment

    Hi sivaprasad

    Driver.get(baseurl)  navigates to the given url t could be baseurl any other url you give
    navigate() will be used  for browser navigation in following ways

    Doctor Answered on September 4, 2014.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.