Multiple Ways to Refresh Browser

Although Webdriver provides a specific method Refresh() for it. But there are
more ways by which we can refresh browser using selenium webdriver.

1st option :- By using refresh() method

driver.get("http://automate-apps.com/");    
driver.navigate().refresh();

2nd option :- By using get method()

driver.get("http://automate-apps.com/"); 
driver.get(driver.getCurrentUrl());

3rd option :- By using navigate().to() method

driver.get("http://automate-apps.com/"); 
driver.navigate().to(driver.getCurrentUrl());  

4th option :- By using sendkeys() method

driver.get("http://automate-apps.com/");
driver.findElement(By.xpath("//*[@id='categories-2']/ul/li[1]/a")).sendKeys(Keys.F5);
// You can use any element of the webpage in order to complete the above command.

Please feel free to leave a comment about the information provided above!!

Leave a Reply

Your email address will not be published. Required fields are marked *