+2 votes
in Software Testing by

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
by (1.6k points)
edited by
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!

Not a Member yet?

Ask to Folks Login

My Account

Your feedback is highly appreciated