Learn About Selenium Using C#

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

  1. Visual Studio
  2. Web Browser – Chrome, Mozilla 

Let’s start, 

Step 1

Create a console application in C#. 

Selenium

 

Step 2

Click on Manage NuGet Packages 

Selenium

 

Step 3

Add Selenium.WebDriver and Selenium.WebDriver.ChromeDriver 

Selenium

 

Step 4

Now, get the Id of the search box and search button, so that we can use it in code.

Selenium

 

Step 5

Now, add the code for automation. 

Selenium

 

Step 6

Run the Application 

Selenium

 

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.


Similar Articles