Here are the 5 different ways, using which we can refresh a webpage.
1. Refresh command: One of the most used and simple command for refreshing a webpage.
1. Refresh command: One of the most used and simple command for refreshing a webpage.
driver.get("https://google.com");
driver.navigate().refresh();
2. To command: Using navigate( ).to( ) command we will be doing trick getCurrentUrl() command.
driver.get("https://google.com");
driver.navigate().to(driver.getCurrentUrl());
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
driver.get("https://google.com");
driver.get(driver.getCurrentUrl());
4. SendKeys command: In this SendKeys command instead of using Key, it is using ASCII code.
driver.get("https://google.com");
driver.findElement(WebElement element).sendKeys("\uE035");
\uE035 is the ASCII code of F5 key.
5. 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.
driver.get("https://google.com");
driver.findElement(By.id("firstname-placeholder")).sendKeys(Keys.F5);
\uE035 is the ASCII code of F5 key. |
No comments:
Post a Comment