Navigate URL, forward and backward

You will have to use these browser navigation commands in Selenium automation script. Here in this chapter, we are going to discuss about various navigation commands. The navigate interface exposes the ability to move backwards and forwards in the browser’s history.
Navigate Forward and Backward
Navigate.To(URL) : This methods load a new web page in the current browser window. This is done using an HTTP GET operation and the method will block until the load is complete
Example: driver.navigate().to("http://www.google.com");

Navigate.Back() : To move back a single "item" in the web browser's history. And it will not perform any action if you are on the first page viewed.
Example: driver.navigate().back();

Navigate.Forward() : To move a single "item" forward in the web browser's history. And it will not perform any action if we are on the latest page viewed.
Example : driver.navigate().forward();

Navigate.Refresh() : It refreshes the current web page
Example: driver.navigate().refresh();



<-- Previous || Next -->

2 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. This comment has been removed by a blog administrator.

    ReplyDelete