Thursday, 26 March 2015

Selenium WebDriver Browser Navigation Commands

Selenium WebDriver Browser Navigation Commands

The navigate interface exposes the ability to move backwards and forwards in your browser’s history but navigate().to() and get() do exactly the same thing. One’s just a lot easier to type than the other.

To Command

Purpose : This command is use to navigate on specific page or URL in between the  test Command : driver.navigate().to(URL); Parameters : url – The URL to load. It is best to use a fully qualified URL

Forward Command

Purpose : This command is use to go on to next page like browser’s forward button.

Back Command

Purpose : This command is use to go back to previous page like browser’s back button.

Refresh Command

Purpose : This command is use to refresh the current page.

Practice Exercise

1) Launch new Browser 2) Open Toolsqa.com website 3) Click on About link ( On top navigation) 4) Come back to Home page (Use ‘Back’ command) 5) Again go back to About page (This time use ‘Forward’ command) 6) Again come back to Home page (This time use ‘To’ command) 7) Refresh the Browser (Use ‘Refresh’ command) 8) Close the Browser

Solution


No comments:

Post a Comment