HomeSelenium C#

Selenium C# – URL navigation using Url and Navigate()

Selenium C# – URL navigation using Url and Navigate()

<<Previous Post                            << Complete Tutorial>>                              Next Post>>

In the previous article, I have explained how to navigate to any URL using Navigate().GoToURL().

Similarly, in this article, I am going to practically demonstrate navigating to the given URL using the Selenium C# API commands Url and Navigate() method.

Let’s get started.

Selenium C# – URL navigation using Url and Navigate()

In this article, I am going to practically demonstrate by providing the task first followed by solution.

Task: Navigate to using Selenium C#

Navigate URL - Task

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 WebDriverManager and ChromeDriver object creation statement as explained in the previous WebDriverManager post:

Navigate URL - ChromeDriver

3) Let’s set the URL using the Url predefined variable of Selenium C# API as shown below:

driver.Url = "";

And then use the Navigate() method as shown below, to navigate to the above specified URL:



Selenium C# - Url and Navigate()

4) Save and click on ‘Start’ button to execute the above code.

Observe that the Selenium C# Script will get executed and the launched chrome browser will be navigated to the given URL as shown below:

Navigate URL - Open Navigate URL

Note: Make sure that you provide the complete URL into the Url predefined variable, as the URL like without http protocol wont work and will give you the ‘invalid argument error as shown below:

Selenium C# - Invalid Argument

Hence provide the proper URL into the Url predefined variable for navigating to the desired web page.

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

Open chat
Contact Us on Whatsapp