Introduction
Selenium is a software-testing framework for web applications. It also provides a test domain-specific language (Selenese) to write tests in a number of popular programming languages, including C#, Groovy, Java, Perl, PHP, Python, Ruby, and Scala. The tests can then run against most modern web browsers. It is open-source software.
For details visit: https://www.seleniumhq.org/
In this article, we will start using Selenium C#.
Pre-requisites
- Visual Studio
- Web Browser – Chrome, Mozilla
Let’s start,
Step 1
Create a console application in C#.
Step 2
Click on Manage NuGet Packages
Step 3
Add Selenium.WebDriver and Selenium.WebDriver.ChromeDriver
Step 4
Now, get the Id of the search box and search button, so that we can use it in code.
Step 5
Now, add the code for automation.
Step 6
Run the Application
Conclusion
The above code is a very basic example of selenium automation. It’s really easy to work with Selenium using C#.
Use the attached demo application - add references as in step 3.