1) Refresh command: The most commonly used and simple command for refreshing a webpage.
1 2 3 |
driver.get("https://www.toolsqa.com"); driver.navigate().refresh(); |
2) SendKeys command: Second most commonly used command for refreshing a webpage. As it is using a send keys method, we must use this on any Text box on a webpage.
1 2 3 4 5 |
driver.get("https://www.toolsqa.com"); // Element "s" is a Seach Text box on my website driver.findElement(By.name("s")).sendKeys(Keys.F5); |
3) Get command: This is a tricky one, as it is using another command as an argument to it. If you look carefully, it is just feeding get command with a page URL.
1 2 3 |
driver.get("https://www.toolsqa.com"); driver.get(driver.getCurrentUrl()); |
4) To command: This command is again using the same above concept. navigate( ).to( ) is feeding with a page URL and an argument.
1 2 3 |
driver.get("https://www.toolsqa.com"); driver.navigate().to(driver.getCurrentUrl()); |
5) SendKeys command: This is the same SendKeys command but instead of using Key, it is using ASCII code.
1 2 3 |
driver.get("https://www.toolsqa.com"); driver.findElement(By.name("s")).sendKeys("\uE035"); |