Hey there! any question in your mind? Ask It Now!.

Popular Categories

Difference Between get and navigate in selenium WebDriver.

+2 votes
asked in Software Testing by Sourabh

Hi , I am automating a website and using .get() to hit URL. there is also a option to hit URL i.e .navigate() . Now I want to know the difference between these methods?




Does these methods have different- different role?

1 Answer

+2 votes
answered by tester (1,550 points)
edited by Bhartesh
Best answer
Get method:

Basically, both methods are used for the same purpose, And the purpose is to navigate a URL(a web page). If we talk about getting() method, a URL is passed as a parameter in this method like:




Here when this method is called its navigates to the webpage(yoursfriends.com) if the page is containing the js files or Ajax of the flash file so it would hold the process till then the page is loaded completely then the another action is performed. like


Step 1. driver.get();

Step 2. element.click();


Here, till then the page is completely loaded click is not to be performed.


navigate method:


Navigate method is also used to navigate a URL we can navigate to any URL by this method like driver.navigate.to(“ URL”); But here is the benefit that we can go back and forward in the browser history like:





So we can say that both method do exactly same thing.

I hope it helped you!

Related Questions

+1 vote
1 answer 698 views

Not a Member yet?

Ask to Folks Login

My Account
342 Folks are online
2 members and 340 guest online
Your feedback is highly appreciated