Sunday, September 15, 2013

Browser Navigation Using WebDriver





Browser Navigation.

Browser navigation
Do you want to automate any browser action (Ex: forward, back, refresh) using WebDriver ?

Cases where we need this type of operations

  • You need to verify your web-application going to previous page if you click on browser back button.
  • Sometimes you may want to refresh the browser to complete some action.
Its pretty simple with WebDriver. Here is the logic to do browser navigation operations.

//TO perform browser back button action
driver.navigate().back();
//TO perform browser forward button action
driver.navigate().forward();

//To refresh bowser
driver.navigate().refresh();

//To navigate to particular URL
driver.navigate().to("url");
//You can give url in String or java.net.URL url format


I hope this would be helpful for beginners.


Regards,
SantoshSarma 


Related Topics
Selecting options from dropdown
Selecting options from dropdown using partial text


No comments:

Post a Comment

Note: Only a member of this blog may post a comment.