How can I refresh a browser window in different ways using Selenium WebDriver?

How can I refresh a browser window in different ways using Selenium WebDriver?

Hello there NoahSmith,

You can refresh a browser window using Selenium WebDriver in the following ways

Refresh command: Most commonly used and simple command for refreshing a webpage, for example:

> driver.get(""https://www.facebook.com"");
> driver.navigate().refresh();

SendKeys command: The second most commonly used command is SendKeys. As it uses the send keys method, we must use this on any Text box on a webpage, for example:

driver.get(""https://www.facebook.com"");
driver.findElement(By.name(""name"")).sendKeys(Keys.F5);

Get command: This one uses another command as an argument to it. It simply feeds the get command with a page URL, for example:

driver.get(""https://www.facebook.com"");
driver.get(driver.getCurrentUrl());

To command: This command is again using the same above concept, navigate( ).to( ) is feeding with a page URL and an argument, for example:

driver.get(""https://www.facebook.com"");
driver.navigate().to(driver.getCurrentUrl());​

SendKeys command: This is the same SendKeys command, but instead of using Key, it is using ASCII code.

driver.get(""https://www.facebook.com"");
driver.findElement(By.name(""name"")).sendKeys(""\uE035"")