Sie sind auf Seite 1von 26

Selenium Tutorial

Simona Pitam
Manual Testing
WEB
Application

Testing Web Apps Manually


Involves:
● Loading All Transaction
● Download Those
Transaction
● Creating Pass/Fail Report
for each
● Validation the Form
● Taking Screenshot for each
Validation
Simona Pitam
Automation Testing Advantages

❖ Faster Execution

❖ More Accurate
Features of
Automation
❖ Lesser Investment in Human Resources Testing

❖ Supports Regression

❖ Frequent Execution
Simona Pitam
❖ Supports Lights Out Execution
Selenium As Automation Testing Tool
Selenium is a suite of software tools to automate web browser
It is an open source frequently used for functional & regression testing
Supports Different PL:Java,Python,C#,
Supports Different OS:Windows, Mac, Linux,IOS,Android
Supports Different
Browsers:IE,Firefox,Chrome,Safari,Opera

Simona Pitam
Selenium VS Other Tools
Features QTP Selenium

License Required Open Source

Price High Low , because of Open


Source

Hardware Resource High Low


consumption during the
execution

Coding Experience Low Should be very good


Simona Pitam
Environment Support Windows Windows,Linux,Mac

Language Support VB Script Java,C#,Python,Ruby


Selenium Suite of Tools

❖ IDE

❖ RC

❖ Web Driver

❖ Grid

Simona Pitam
Selenium IDE

❖ Selenium IDE is a Firefox Plugin whis is used to create and execute test cases

❖ It record and plays back the interactions which the user had with the web

browser

❖ Using IDE, you can export the programming code in different programming

languages such as: Java, C#,Python,Ruby

http://www.seleniumhq.org/download/
Simona Pitam
Selenium Ide Install On Chrome
Go to the following link:

https://chrome.google.com/webstore/detail/selenium-
ide/mooikfkahbdckldjjndioackbalphokd

Add it to Chrome & Install

Simona Pitam
Selenium RC
Selenium Remote Control (RC) is used to write web application test cases in
different PL
Deprecat
It interacts with browsers the help of Selenium RC Server ed

RC Server communication uses simple HTTP get/Post request


Java
Remote Control Ruby
Server Python
Simona Pitam
How to Automate Web Process

❖ Web Page contains from HTML Elements

❖ In order to automate web actions you should find web page Elements

❖ We should use some locator technics

❖ We should identify the element and then we can do actions on elements


Simona Pitam
Web Driver

❖ In Selenium we have element identifier & then we can activate elements

❖ Selenium Web Driver is a programming interface to create & execute test

cases

❖ Test Cases are created and executed using Elements/Object Locator/Web

Driver method Simona Pitam

❖ Selenium WEbDriver has programming interface not IDE

❖ Selenium IDE supports only IDE;doesn’t have programming interface


Web Driver
Each Browser has it own driver that application runs

Selenium Web Driver makes direct calls to the Browser

For testing on Local machine you need Web Driver per Web Broser

For Server Testing you need RC Explorer Driver

Type of Web Brosers


Simona Pitam
Chrome Driver
❖ Download Chrome Driver Exe
❖ Chrome Driver->chromedriver.exe

https://sites.google.com/a/chromium.org/chromedriver/downloads

❖ Internet Explorer -> iedriver.exe

❖ Web Driver is API and not IDE


Simona Pitam
We should choose the Web Browser in order to run Web Driver

- API - Application Program Interface


Selenium Scripts
Go to the following URL

http://www.seleniumhq.org/

Download one of the drivers

In order to run test case we need Web Driver

Simona Pitam
Selenium Web Drivers Features
Selenium Web Drivers Supports

PL: Java,C#,Python,Ruby

Browser:Chrome,Firefox,IE,Safari,Opera

Report Generator can’t be generated

Simona Pitam
Selenium Scripts
Go to the following URL

http://www.seleniumhq.org/

Download one of the drivers

In order to run test case we need Web Driver

Simona Pitam
Selenium Scripts
Go to the following URL

http://www.seleniumhq.org/

Download one of the drivers

In order to run test case we need Web Driver

Simona Pitam
Selenium Grid

❖ Selenium Grid is used to run test scripts at the same time on multiple

machines

❖ Parallel Running can be done

❖ Hub and Nodes using jar files

Simona Pitam
Selenium Scripts
Go to the following URL

http://www.seleniumhq.org/

Download one of the drivers

In order to run test case we need Web Driver

Simona Pitam
Java Env
Download Eclipse

Verify Jdk Folders are created after installation

Download Selenium -standalone-server

Selenium Server

All these contains jar files


Simona Pitam
Open Eclipse & Start write Scripts
Selenium Scripts
Go to the following URL

http://www.seleniumhq.org/

Download one of the drivers

In order to run test case we need Web Driver

Simona Pitam
Selenium Scripts
Go to the following URL

http://www.seleniumhq.org/

Download one of the drivers

In order to run test case we need Web Driver

Simona Pitam
Write Script in Eclipse

❖ Add External jars

❖ Import all selenium jar files

❖ We can create different folder & import our jars

Simona Pitam
Script Example
package simona.selenium.webdriver.tutorial.Javabasic;

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;

import org.openqa.selenium.JavascriptExecutor;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.chrome.ChromeDriver;

import com.gargoylesoftware.htmlunit.javascript.background.JavaScriptExecutor;

Simona Pitam
Import Jars into Eclipse
Right Click on Java Project Name

Click On Build Path

Choose Configure Build Path

Add External jars (selenium - 3.8.0-standalone.jar,selenium-nodeps-3.8.1-


source.jar,selenium-3.8.1-nodeps.jar)

Simona Pitam
Identification Elements in Selenium
In Selenium we can find the element by function FindElement.by()

Element can be Identified by following:

❖ Id
❖ Name
❖ ClassName
❖ Xpath
❖ Tagname
❖ css Selector
❖ linkText
❖ PartialLinkText

Das könnte Ihnen auch gefallen