HomeSelenium C#

Selenium C# – URL Navigation using Navigate().GoToURL()

Selenium C# – URL Navigation using Navigate().GoToURL()

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

In the previous articles, I have explained various things for installing and configuring Visual Studio & Selenium.

Assuming that you have gone through all our previous articles, I am going to explain the navigation to the given URL using the Selenium C# API command Navigate().GoToURL().

Selenium C# – URL Navigation using Navigate().GoToURL()

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) Now let’s write the below Selenium code to navigate to as shown below:



Navigate URL - 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 Navigate().GoToURL() command, as the URL like without http protocol wont work and will give you the ‘invalid argument’ error as shown below:

Navigate URL - Invalid Argument

Hence provide the proper URL into the Navigate().GoTo() command 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 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 (2)

  • Congratulations! This is a nice article for beginners! If you could then, please provide tutorials on automating windows based application using Selenium + C#.

    • Thank you Sud.
      We don’t have any plans at the moment to post on automating windows based application using Selenium C#.


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