Refreshing Page In Different Ways Using Webdriver

Selenium gives the flexibility to refresh a page in different ways. You get the navigate( )method to navigate within, from and to a webpage.

Also you can use the getCurrentUrl( ) method to get the current page url and then use it to refresh the page. Also you can use the key stroke combination to refresh the page. We will use different combinations of these following methods to refresh the page

  1. using navigate( ).refresh( )
  2. using getCurrentUrl( )
  3. using sendKeys( )


private WebDriver driver;
private String baseUrl;
public void testmain() {


//first type

//second type


//third type


//fourth type


//fifth type

public void setup() {
driver= new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

public void teardown() {



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.