Working with browser navigation

Browsers provide various navigation methods to access web pages from the browser history or by refreshing the current page with the back, forward, and refresh/reload buttons on the browser window's toolbar. The Selenium WebDriver API provides access to these buttons with various methods of WebDriver.Navigation interface. We can test the behavior of the application when these methods are used.

Method

Description

back()

This method moves back to the page in browser history.

forward()

This method moves forward to the page in browser history.

refresh()

This method reloads the current page.

to(String url)

to(java.net.URL url)

This method loads the specified URL in the current browser window.

In this ...

Get Selenium Testing Tools Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.