HomeSelenium

Selenium C Sharp – Refreshing the Page using Refresh()

<<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:

Navigate URL - Launch Project

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:

Selenium C# - Basic

3) Write the below code for halting the program for 5 seconds for demonstration purpose as shown below:

Thread.Sleep(5000);

Selenium C# - Thread Sleep

4) Now write the Refresh() command as shown below:

driver.Navigate().Refresh();

Selenium C# - Refresh Code

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:

  1. Application URL will open in Chrome Browser in Maximized mode
  2. Program will halt for 5 seconds
  3. 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 ?

About Me > Naveen Repala

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>>

Comments (0)

Leave a Reply

Your email address will not be published. Required fields are marked *

For FREE Testing Tutorials & Videos

X
Open chat
Contact Us on Whatsapp