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

0 votes
May 30, 2019 in Selenium by Anandita
38,330 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,910 points
941 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,693 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
821 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
7,788 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
12,731 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
8,616 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
6,692 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,555 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
13,606 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
65,669 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