Different ways to refresh a webpage using Selenium Webdriver

12 January, 2014
There are many ways by which we can refresh a webpage. We shall some of them today in this post.

Its fairly simple. We will just use the existing methods in different ways to refresh the webpage.

1.Using sendKeys(Keys)

driver.get("https://accounts.google.com/SignUp");  
driver.findElement(By.id("firstname-placeholder")).sendKeys(Keys.F5);


2.Using navigate.refresh()

driver.get("https://accounts.google.com/SignUp");    
driver.navigate().refresh();  


3.Using navigate.to()

driver.get("https://accounts.google.com/SignUp");    
driver.navigate().to(driver.getCurrentUrl());  


4.Using get()

driver.get("https://accounts.google.com/SignUp");    
driver.get(driver.getCurrentUrl()); 


5.Using sendKeys()

driver.get("https://accounts.google.com/SignUp");   
driver.findElement(By.id("firstname-placeholder")).sendKeys("\uE035"); 

No comments:

Post a Comment