SlideShare a Scribd company logo
Automation using Selenium with C#
Authored & Presented by : Yogesh Kumar
ucreate.it Pvt. Ltd.
Setting up the project - Step1

Download and Install Visual Studio
.

Selenium is an open source suite that is used for web applications test
automation.

It allows recording or scripting automated test flows.

It uses a test domain-specific language Selenese.

Tests can be written in a number of popular programming languages,
including C#, Java, PHP, Python, Ruby, Groovy and Scala.

Automation is supported for multiple web browsers as well multiple
platforms.
What is Selenium?

Selenium WebDriver is used for creation of robust, browser-based
regression automation suites.

Tests can be run in different browsers.

Selenium WebDriver, simply, accepts programmedcommands, sends
them to a browser and interacts with the HTML elements on the page.

Before driver can interact with the element, it need to be located (find) in
the page.

TheWebDriver’s method findElement() is used for that purpose.
Selenium Web Driver
The driver can find elements on the web page using several types of
locators:
• By Id
• By Class Name
• By Tag Name
• By Name
• By Link Text
• By CSS
• By Xpath
These locators will search the web page’s HTML and find particular
element(s) based on the supplied Id, XPath, ClassName etc.
After driver, finds element, it is returned as WebElement object.
WebElement objects, expose methods that simulate “human” interaction
with the page. Methods that often used are: click(), sendKeys(), submit(),
getText(), etc.
Locators in Selenium Web Driver
Why Selenium with C#

NO Major difference between Selenium C# with Java, It’s just the
language difference along with some changes here and there to
support new firefox browser or chrome etc in both of these
languages.

Ease of setting up scripting or running environment

Easy to generate reports with ReportNG.

Easy to start with Nunit.
Note: In this tutorial we will build an example for Smoke Test on LinkedIn web
application. The scenario
will cover user log in, navigation to the edit profile page, elements validation on
the profile page and log
out.
BUILD SELENIUM TESTS USING
NUNIT FRAMEWORK
Setting up the project - Step1

Download and Install Visual Studio
Setting up the project – Step 2

open Visual Studio and create new project
Setting up the project – Step 3

Select Test and create Unit Test project
Setting up the project – Step 4

Project will be created like attached screen.
Setting up the project – Step 5

Now Build the solution, it will create test case
Setting up the project – Step 6

Go to NuGet Packages to add selenium
Setting up the project – Step 7

Now, install Selenium Support to add Selenium
Setting up the project – Step 8

Now, install Chrome Driver
Write Test Script - Step 1
Write this small code:
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
namespace UnitTestProject1
{
[TestClass]
public class UnitTest1
{
IWebDriver driver;
[TestMethod]
public void TestMethod1()
{
Write Test Script - Step 1
driver = new ChromeDriver();
driver.Url = "http://www.google.co.in";
}
}
}
Running the Test – Step 1

Now Build the solution Again
Running the Test – Step 2

Right click on Test and run selected Test.
Running the Test – Step 3

It will open Browser.

In browser, google website will be openend up.

Simple and easy
Playing with the Code

Find Element.

Perform operation on Element.

Run the test.
Questions
Thank You !!!

More Related Content

What's hot (20)

PPTX
Selenium topic 4 - Selenium Web Driver Set Up
ITProfessional Academy
 
PPTX
Selenium introduction
Pankaj Dubey
 
PPTX
Selenium with java
Satyam Pandey
 
PPTX
Selenium Topic 2 IDE
ITProfessional Academy
 
PDF
Selenium Maven With Eclipse | Edureka
Edureka!
 
PPTX
Run Selenium Tests With Jenkins and BrowseEmAll
Daniel Herken
 
PPT
Selenium (1)
onlinemindq
 
DOCX
Selenium webdriver course content rakesh hansalia
Rakesh Hansalia
 
KEY
Testing with Jenkins, Selenium and Continuous Deployment
Max Klymyshyn
 
PPTX
Selenium topic 3 -Web Driver Basics
ITProfessional Academy
 
PPT
Selenium 2: The Future of Selenium is now!
AutomatedTester
 
PPS
Selenium Demo
ankitslide
 
PPTX
Selenium Automation
Anuradha Malalasena
 
PPT
Selenium ppt
Pavan Kumar
 
PDF
Jenkins & Selenium
adamcarmi
 
PPTX
#ATAGTR2021 Presentation - "Selenium 4 Observability – a 90 Min Hands on Lab"
Agile Testing Alliance
 
PPT
Web Test Automation with Selenium
vivek_prahlad
 
PPTX
Selenium test automation
Srikanth Vuriti
 
PPTX
Selenium topic 1- Selenium Basic
ITProfessional Academy
 
ODP
Mastering selenium for automated acceptance tests
Nick Belhomme
 
Selenium topic 4 - Selenium Web Driver Set Up
ITProfessional Academy
 
Selenium introduction
Pankaj Dubey
 
Selenium with java
Satyam Pandey
 
Selenium Topic 2 IDE
ITProfessional Academy
 
Selenium Maven With Eclipse | Edureka
Edureka!
 
Run Selenium Tests With Jenkins and BrowseEmAll
Daniel Herken
 
Selenium (1)
onlinemindq
 
Selenium webdriver course content rakesh hansalia
Rakesh Hansalia
 
Testing with Jenkins, Selenium and Continuous Deployment
Max Klymyshyn
 
Selenium topic 3 -Web Driver Basics
ITProfessional Academy
 
Selenium 2: The Future of Selenium is now!
AutomatedTester
 
Selenium Demo
ankitslide
 
Selenium Automation
Anuradha Malalasena
 
Selenium ppt
Pavan Kumar
 
Jenkins & Selenium
adamcarmi
 
#ATAGTR2021 Presentation - "Selenium 4 Observability – a 90 Min Hands on Lab"
Agile Testing Alliance
 
Web Test Automation with Selenium
vivek_prahlad
 
Selenium test automation
Srikanth Vuriti
 
Selenium topic 1- Selenium Basic
ITProfessional Academy
 
Mastering selenium for automated acceptance tests
Nick Belhomme
 

Similar to Selenium using C# by Yogesh Kumar (20)

PPTX
Automated testing using Selenium & NUnit
Alfred Jett Grandeza
 
PPTX
Automated Web Testing With Selenium
Jodie Miners
 
PPTX
Selenium Automation
Pratyush Majumdar
 
PDF
Streamline Testing: Transition from Manual to Automation with Selenium & C#
digitaljignect
 
PDF
Streamline Testing: Transition from Manual to Automation with Selenium & C#
digitaljignect
 
PDF
Automation Testing using Selenium Webdriver
Pankaj Biswas
 
PPTX
Introduction to selenium
Khaja Moiz Uddin
 
PDF
An Overview of Selenium Grid and Its Benefits
Shubham Joshi
 
PPTX
Introduction to selenium
Khaja Moiz Uddin
 
PPTX
Test automation using selenium
Cynoteck Technology Solutions Private Limited
 
PPTX
Web testing with Selenium
XBOSoft
 
PDF
Webinar: Selenium WebDriver - Automation Uncomplicated
Edureka!
 
PDF
Selenium C# - The Essential Test Automation Guide
RapidValue
 
PDF
Lesson_06_Software_and_Automation_Testing_Frameworks.pdf
Minh Quân Đoàn
 
PDF
Selenium Automation Testing - A Complete Guide.pdf
kalichargn70th171
 
PDF
Mastering Selenium WebDriver: A Comprehensive Tutorial with Real-World Examples
jamescantor38
 
PDF
How To Use Selenium Successfully (Java Edition)
Dave Haeffner
 
PDF
Automation Testing using Selenium
Naresh Chintalcheru
 
ODP
Integrating Selenium testing infrastructure into Scala Project
Knoldus Inc.
 
Automated testing using Selenium & NUnit
Alfred Jett Grandeza
 
Automated Web Testing With Selenium
Jodie Miners
 
Selenium Automation
Pratyush Majumdar
 
Streamline Testing: Transition from Manual to Automation with Selenium & C#
digitaljignect
 
Streamline Testing: Transition from Manual to Automation with Selenium & C#
digitaljignect
 
Automation Testing using Selenium Webdriver
Pankaj Biswas
 
Introduction to selenium
Khaja Moiz Uddin
 
An Overview of Selenium Grid and Its Benefits
Shubham Joshi
 
Introduction to selenium
Khaja Moiz Uddin
 
Test automation using selenium
Cynoteck Technology Solutions Private Limited
 
Web testing with Selenium
XBOSoft
 
Webinar: Selenium WebDriver - Automation Uncomplicated
Edureka!
 
Selenium C# - The Essential Test Automation Guide
RapidValue
 
Lesson_06_Software_and_Automation_Testing_Frameworks.pdf
Minh Quân Đoàn
 
Selenium Automation Testing - A Complete Guide.pdf
kalichargn70th171
 
Mastering Selenium WebDriver: A Comprehensive Tutorial with Real-World Examples
jamescantor38
 
How To Use Selenium Successfully (Java Edition)
Dave Haeffner
 
Automation Testing using Selenium
Naresh Chintalcheru
 
Integrating Selenium testing infrastructure into Scala Project
Knoldus Inc.
 
Ad

More from Software Testing Board (11)

PPT
Software Testing Board meetup 24th-Nov-2018
Software Testing Board
 
PDF
Manage Selenium Grid with Terraform by Omkar Khatavkar (https://www.linkedin....
Software Testing Board
 
PPTX
Introduction to Selenium Python by Kishore
Software Testing Board
 
PPTX
Shell scripting to test volume of SEO pages with ease by Abdul Hadi
Software Testing Board
 
PPTX
BRD document for test automation estimation
Software Testing Board
 
PPTX
Micro Service automation by Srijit Jain
Software Testing Board
 
PDF
Docker with Selenium by Thirumalai Vignesh
Software Testing Board
 
PDF
A testers survival guide for agile transition by Parveen Sultana
Software Testing Board
 
PDF
Shift left shift-right performance testing for superior end-user by Arun Dutta
Software Testing Board
 
PPT
Software Testing Board's start-here guide for the Question and Answer site
Software Testing Board
 
PDF
Agile Testing by ShriKant Vashishtha
Software Testing Board
 
Software Testing Board meetup 24th-Nov-2018
Software Testing Board
 
Manage Selenium Grid with Terraform by Omkar Khatavkar (https://www.linkedin....
Software Testing Board
 
Introduction to Selenium Python by Kishore
Software Testing Board
 
Shell scripting to test volume of SEO pages with ease by Abdul Hadi
Software Testing Board
 
BRD document for test automation estimation
Software Testing Board
 
Micro Service automation by Srijit Jain
Software Testing Board
 
Docker with Selenium by Thirumalai Vignesh
Software Testing Board
 
A testers survival guide for agile transition by Parveen Sultana
Software Testing Board
 
Shift left shift-right performance testing for superior end-user by Arun Dutta
Software Testing Board
 
Software Testing Board's start-here guide for the Question and Answer site
Software Testing Board
 
Agile Testing by ShriKant Vashishtha
Software Testing Board
 
Ad

Recently uploaded (20)

PPTX
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
PDF
Lesson 2 - WATER,pH, BUFFERS, AND ACID-BASE.pdf
marvinnbustamante1
 
PPTX
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
PPTX
SPINA BIFIDA: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
PPTX
2025 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
PPTX
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
PPTX
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
PDF
LAW OF CONTRACT (5 YEAR LLB & UNITARY LLB )- MODULE - 1.& 2 - LEARN THROUGH P...
APARNA T SHAIL KUMAR
 
PPT
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
PPTX
CATEGORIES OF NURSING PERSONNEL: HOSPITAL & COLLEGE
PRADEEP ABOTHU
 
PDF
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
PPTX
Neurodivergent Friendly Schools - Slides from training session
Pooky Knightsmith
 
PPTX
I AM MALALA The Girl Who Stood Up for Education and was Shot by the Taliban...
Beena E S
 
PDF
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
PDF
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
PDF
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
PPTX
STAFF DEVELOPMENT AND WELFARE: MANAGEMENT
PRADEEP ABOTHU
 
PPTX
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
PDF
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
PPTX
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
Lesson 2 - WATER,pH, BUFFERS, AND ACID-BASE.pdf
marvinnbustamante1
 
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
SPINA BIFIDA: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
2025 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
LAW OF CONTRACT (5 YEAR LLB & UNITARY LLB )- MODULE - 1.& 2 - LEARN THROUGH P...
APARNA T SHAIL KUMAR
 
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
CATEGORIES OF NURSING PERSONNEL: HOSPITAL & COLLEGE
PRADEEP ABOTHU
 
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
Neurodivergent Friendly Schools - Slides from training session
Pooky Knightsmith
 
I AM MALALA The Girl Who Stood Up for Education and was Shot by the Taliban...
Beena E S
 
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
STAFF DEVELOPMENT AND WELFARE: MANAGEMENT
PRADEEP ABOTHU
 
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 

Selenium using C# by Yogesh Kumar

  • 1. Automation using Selenium with C# Authored & Presented by : Yogesh Kumar ucreate.it Pvt. Ltd.
  • 2. Setting up the project - Step1  Download and Install Visual Studio
  • 3. .  Selenium is an open source suite that is used for web applications test automation.  It allows recording or scripting automated test flows.  It uses a test domain-specific language Selenese.  Tests can be written in a number of popular programming languages, including C#, Java, PHP, Python, Ruby, Groovy and Scala.  Automation is supported for multiple web browsers as well multiple platforms. What is Selenium?
  • 4.  Selenium WebDriver is used for creation of robust, browser-based regression automation suites.  Tests can be run in different browsers.  Selenium WebDriver, simply, accepts programmedcommands, sends them to a browser and interacts with the HTML elements on the page.  Before driver can interact with the element, it need to be located (find) in the page.  TheWebDriver’s method findElement() is used for that purpose. Selenium Web Driver
  • 5. The driver can find elements on the web page using several types of locators: • By Id • By Class Name • By Tag Name • By Name • By Link Text • By CSS • By Xpath These locators will search the web page’s HTML and find particular element(s) based on the supplied Id, XPath, ClassName etc. After driver, finds element, it is returned as WebElement object. WebElement objects, expose methods that simulate “human” interaction with the page. Methods that often used are: click(), sendKeys(), submit(), getText(), etc. Locators in Selenium Web Driver
  • 6. Why Selenium with C#  NO Major difference between Selenium C# with Java, It’s just the language difference along with some changes here and there to support new firefox browser or chrome etc in both of these languages.  Ease of setting up scripting or running environment  Easy to generate reports with ReportNG.  Easy to start with Nunit.
  • 7. Note: In this tutorial we will build an example for Smoke Test on LinkedIn web application. The scenario will cover user log in, navigation to the edit profile page, elements validation on the profile page and log out. BUILD SELENIUM TESTS USING NUNIT FRAMEWORK
  • 8. Setting up the project - Step1  Download and Install Visual Studio
  • 9. Setting up the project – Step 2  open Visual Studio and create new project
  • 10. Setting up the project – Step 3  Select Test and create Unit Test project
  • 11. Setting up the project – Step 4  Project will be created like attached screen.
  • 12. Setting up the project – Step 5  Now Build the solution, it will create test case
  • 13. Setting up the project – Step 6  Go to NuGet Packages to add selenium
  • 14. Setting up the project – Step 7  Now, install Selenium Support to add Selenium
  • 15. Setting up the project – Step 8  Now, install Chrome Driver
  • 16. Write Test Script - Step 1 Write this small code: using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using OpenQA.Selenium; using OpenQA.Selenium.Chrome; namespace UnitTestProject1 { [TestClass] public class UnitTest1 { IWebDriver driver; [TestMethod] public void TestMethod1() {
  • 17. Write Test Script - Step 1 driver = new ChromeDriver(); driver.Url = "http://www.google.co.in"; } } }
  • 18. Running the Test – Step 1  Now Build the solution Again
  • 19. Running the Test – Step 2  Right click on Test and run selected Test.
  • 20. Running the Test – Step 3  It will open Browser.  In browser, google website will be openend up.  Simple and easy
  • 21. Playing with the Code  Find Element.  Perform operation on Element.  Run the test.