Browser refresh by Ctrl+F5 in WebDriver using Java

Ripon Al Wasim picture Ripon Al Wasim · Sep 6, 2012 · Viewed 12.8k times · Source

I have refreshed the browser in WebDriver using java as below code:

driver.navigate().refresh();

How can I do that by pressing Ctrl+F5 in WebDriver using Java?

Answer

Ami picture Ami · Sep 6, 2012

I think you can use the WebDriver and Actions instance as below:

Actions actionObject = new Actions(driver);
actionObject.keyDown(Keys.CONTROL).sendKeys(Keys.F5).keyUp(Keys.CONTROL).perform‌​();