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

0 votes
May 29, 2019 in Selenium by Anandita
18,142 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");
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
220 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
1,407 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
367 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
5,020 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,520 points
5,322 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,050 points
6,002 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,890 points
3,714 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 2, 2020 in Selenium by Sri
• 3,050 points
4,519 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 3, 2019 in Selenium by Anvi
• 14,150 points
8,679 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 19, 2018 in Selenium by Nabarupa
30,174 views