What is the difference between driver get and driver navigate to methods

0 votes
May 30, 2019 in Selenium by Anandita
39,728 views

1 answer to this question.

0 votes

Hi Anandita, driver.get() method is used to open an URL and it will wait till the whole page gets loaded. WebDriver will wait until the page has fully loaded before returning control to your test or script. Now note that if a webpage uses a lot of AJAX on load then WebDriver may not know when it has completely loaded. If you need to ensure such pages are fully loaded then you can use waits. For eg:

driver.get("http://www.google.com");

While driver.navigate.to() method navigates to an URL and It will not wait till the whole page gets loaded. It maintains the browser history and cookies, so we can use forward and backward button to navigate between the pages during the coding of Testcase.

driver.navigate().to("http://www.example.com");

Hope this helps!

Check out this selenium online course to learn more!

answered May 30, 2019 by Murad
Am getting the below error when I used driver.navigate().to( https://www.google.com");
"Unresolved compilation problem:
String literal is not properly closed by a double-quote."

Hey, you have missed a double quote that's probably giving you the error. Try this:

driver.navigate().to("https://www.google.com");

Related Questions In Selenium

0 votes
1 answer

What is the difference between webdriver.get() and webdriver.navigate()

The first thing you’ll want to do ...READ MORE

answered Dec 3, 2020 in Selenium by Gitika
• 65,770 points
1,134 views
0 votes
1 answer

What is the difference between thoughtworks.selenium and openqa.selenium selenium?

thoughtworks.selenium is the original Selenium (aka Selenium 1, ...READ MORE

answered Apr 13, 2018 in Selenium by king_kenny
• 3,710 points
2,983 views
0 votes
1 answer

What is difference the between Selenium and Celerity?

If you are talking about speed, use Celerity. If ...READ MORE

answered Apr 20, 2018 in Selenium by king_kenny
• 3,710 points
1,018 views
0 votes
1 answer

What is the difference between dot and text() in XPath?

Even though there is some difference between ...READ MORE

answered Apr 25, 2018 in Selenium by king_kenny
• 3,710 points
8,333 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
13,673 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,142 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
7,221 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,874 views
0 votes
1 answer

What is the difference between getWindowHandle() and getWindowHandles() methods in Selenium WebDriver?

Hey Jennifer, difference between getWindowHandle() and getWindowHandles() ...READ MORE

answered Jun 4, 2019 in Selenium by Anvi
• 14,150 points
14,364 views
0 votes
3 answers

What is the difference between relative and absolute XPath?

Absolute Xpath: It contains the complete path ...READ MORE

answered Dec 20, 2018 in Selenium by Nabarupa
67,299 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP