Refresh webpage using Actions Class in Selenium WebDriver –
There are various ways to refresh webpage in selenium webdriver. One of them using Actions class.
Application can be refreshed in multiple ways. We can use
There are various ways to refresh webpage in selenium webdriver. One of them using Actions class.
Application can be refreshed in multiple ways. We can use
driver.navigate().refresh();
Method, or can send key F5.
Here, Web Page refresh can be achieved by using Actions class of the selenium WebDriver.
Below program explain this –
package learnAboutActionsClass; import java.util.concurrent.TimeUnit; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.interactions.Actions; public class RefreshUsingActionsClass { public static void main(String[] args) throws InterruptedException { // TODO Auto-generated method stub WebDriver driver = new FirefoxDriver(); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); driver.manage().window().maximize(); driver.navigate().to("https://learnaboutsoftwaretesting.blogspot.in"); //sleep the website for 4 seconds so that we can notice the refresh of web page Thread.sleep(4000); Actions act = new Actions(driver); //using below command we can refresh the webpage act.keyDown(Keys.CONTROL).sendKeys(Keys.F5).build().perform(); } }