8

In Selenium RC, I used the following code using Java for refresh on the browser:

selenium.refresh();

What is the equivalent code for refresh in WebDriver?

Ripon Al Wasim
  • 36,924
  • 42
  • 155
  • 176
Nazifa Chowdhury
  • 198
  • 3
  • 5
  • 13

3 Answers3

14

The following is the equivalent code in Selenium WebDriver using Java:

driver.navigate().refresh();
Ripon Al Wasim
  • 36,924
  • 42
  • 155
  • 176
3

Another way to refresh by using Ctrl+F5: to use the WebDriver and Actions instance as below:

Actions actionObject = new Actions(driver);
actionObject.keyDown(Keys.CONTROL).sendKeys(Keys.F5).perform();
Ripon Al Wasim
  • 36,924
  • 42
  • 155
  • 176
3

You can use:

driver.navigate().refresh();

Look here for example - How To Refresh Current Web Page.

J0e3gan
  • 8,740
  • 10
  • 53
  • 80
Varun
  • 31
  • 1