There are multiple ways to refresh a webpage in Selenium Webdriver. In this post, we will present all these ways and also specify which one is the best.
1. Using driver.navigate() command
Selenium Webdriver provides inherent support for refreshing a webpage using its driver.navigate() command. This is by far the most preferred and widely used way of refreshing a webpage.
2. Opening current URL using driver.getCurrentUrl() with driver.get() command
3. Opening current URL using driver.getCurrentUrl() with driver.navigate() command
4. Pressing F5 key on any textbox using sendKeys command
5. Passing ascii value of F5 key i.e. “\uE035” using sendKeys command
That’s all we have in this post, comment below if you have any queries. Also please share this post with your friends and don’t forget to check our complete selenium tutorial here.