<<Previous Post << Complete Tutorial>> Next Post>>
In the previous article, I have practically demonstrated retrieving the Source Code of the Page using Selenium C#.
In this article, I am going to practically demonstrated refreshing the page using Selenium C# API command Refresh().
Let’s get started.
Selenium C Sharp – Refreshing the Page using Refresh()
In this article, I am going to practically demonstrate by providing the task first followed by solution.
Task: Open the http://omayo.blogspot.com URL in Chrome browser, halt the program for 5 seconds and then refresh the page.
Solution: Lets follow the below steps:
1) Launch Visual Studio and select an existing project which is already configured with Selenium and WebDriverManager as shown below:
2) Write the below code explained in the previous posts for navigating to the http://omayo.blogspot.com URL in chrome browser in maximized mode as shown below:
3) Write the below code for halting the program for 5 seconds for demonstration purpose as shown below:
Thread.Sleep(5000);
4) Now write the Refresh() command as shown below:
driver.Navigate().Refresh();
5) Save and click on ‘Start’ button to execute the above code.
Observe that the Selenium C# Script will get executed and the following will happen in sequence:
- Application URL will open in Chrome Browser in Maximized mode
- Program will halt for 5 seconds
- Page will be refreshed
Here concludes this article.
In the next article, I will choose another Selenium command for performing different operation on the web page.
Next Steps:
- > To learn more about Selenium C#, continue to the next post (Click on Next Post Link Below)
- > Check complete Selenium C# Tutorial Contents here (Click here)
Please leave your questions/comments/feedback below.
Happy Learning ?
Connect to me on Linked In (Click here)
On a mission to contribute to the Software Testing Community in all possible ways.
<<Previous Post << Complete Tutorial>> Next Post>>