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 http://omayo.blogspot.com/ using Selenium C#
Solution: Lets follow the below steps:
2) Write the WebDriverManager and ChromeDriver object creation statement as explained in the previous WebDriverManager post:
3) Now let’s write the below Selenium code to navigate to http://omayo.blogspot.com/ as shown below:
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:
Note: Make sure that you provide the complete URL into the Navigate().GoToURL() command, as the URL like www.omayo.blogspot.com without http protocol wont work and will give you the ‘invalid argument’ error as shown below:
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.
- > 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 ?
On a mission to contribute to the Software Testing Community in all possible ways.