Refreshing web page in Selenium WebDriver

0 votes

I want to refresh webpage during tests. I send F5 key but I don't know if the driver has the method for refreshing entire webpage.

Below is the code that I used:

    while(driver.findElements(By.xpath("//*[text() = 'READY']")).size() == 0 )
        driver.findElement(By.xpath("//body")).sendKeys(Keys.F5);  
    driver.findElement(By.cssSelector("div.column a")).click();    

Is there any better way to do this?

Jun 18, 2018 in Selenium by Sahiti
• 6,320 points
244 views

1 answer to this question.

0 votes

you can use the below code to refresh the entire page:

driver.navigate().refresh();

answered Jun 18, 2018 by Meci Matt
• 9,460 points

Related Questions In Selenium

0 votes
2 answers

How to scroll a Web Page using coordinates of a WebElement in Selenium WebDriver ?

JavascriptExecutor js = (JavascriptExecutor) driver; js.executeScript("window.scrollBy("X", " y ...READ MORE

answered Aug 31 in Selenium by Sri
• 2,970 points
1,631 views
0 votes
1 answer
0 votes
2 answers

How to scroll the Page up or down in Selenium WebDriver? (using java)

JavascriptExecutor jsx = (JavascriptExecutor)driver; jsx.executeScript("window.scrollBy(0,555)", ""); or Action classes ...READ MORE

answered Sep 5 in Selenium by Sri
• 2,970 points
13,204 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,510 points
3,498 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31 in Selenium by Sri
• 2,970 points
4,505 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,890 points
2,582 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 2 in Selenium by Sri
• 2,970 points
2,823 views
0 votes
2 answers

What is Page Object Model in Selenium WebDriver?

POM is one of design pattern. maintenance  should ...READ MORE

answered Sep 4 in Selenium by Sri
• 2,970 points
415 views
0 votes
1 answer

XPath for the elements with no ID or Name in Selenium Webdriver

Use like this or similar to this: //div[@id="top-level-menu-item-3"]/div[@class="filter-label"] //div[@id="top-level-menu1"] ...READ MORE

answered Apr 17, 2018 in Selenium by Meci Matt
• 9,460 points
2,802 views