Saturday, November 18, 2017

Five different ways to refresh the browser using Selenium WebDriver.

Below are the 5 different ways to refresh the browser using Selenium WebDriver.

Method 1: Using navigate.refresh()
Most of us know this approach, driver.navigate.refresh() will refreshes the current page.

Method 2: Using navigate.to()
In this approach using "driver.getCurrentUrl()" we will get the current url of the page and send to the navigate.to() method to refresh the page.

Method 3: Using get()
In this approach using "driver.getCurrentUrl()" we will get the current url of the page and send to the get() method to refresh the page.
Method 4: Using SendKeys()
In this approach we need to identify a text field on the page and send the key F5. When F5 is sent the page gets refreshed.

Method 5: Using SendKeys() and Unicodes
Send the unicode of the F5 key to text field on the page, that will refresh the page.
Special keys like F5, Space, Enter and ARROW_LEFT will be having the uni-codes, please refer here.
Different ways of refreshing the browser are mentioned below, please refer.

No comments:

Post a Comment

DevOps 01: What is DevOps and How it benefits organizations?

DevOps is a culture in an organization, where the development team and operations team help each other by sharing information, process and t...