0% found this document useful (0 votes)
11 views17 pages

Selenium - Guide

Selenium is an open-source automation testing tool that supports various operating systems, web browsers, and programming languages, allowing for parallel execution and integration with frameworks like TestNG and jUnit. It includes Selenium WebDriver for creating and executing test cases, while Selenium Grid enables running multiple test scripts simultaneously across different machines. The document also outlines setup instructions for the environment, project creation in Eclipse, and the use of TestNG for test management and report generation.

Uploaded by

bryanbiboythree
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views17 pages

Selenium - Guide

Selenium is an open-source automation testing tool that supports various operating systems, web browsers, and programming languages, allowing for parallel execution and integration with frameworks like TestNG and jUnit. It includes Selenium WebDriver for creating and executing test cases, while Selenium Grid enables running multiple test scripts simultaneously across different machines. The document also outlines setup instructions for the environment, project creation in Eclipse, and the use of TestNG for test management and report generation.

Uploaded by

bryanbiboythree
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 17

SELENIUM (www.seleniumhq.

org):

- Supports different OS, Web browsers and Programming Language


- Open Source Software
- Supports Parallel Execution
- Provides Support for frameworks: TestNG, jUnit & NUnit
- Sikuli Framework: To images on the web
- TestNG Framework: To Generate HTLM Reports

Automation Testing beats manual testing:

- Automate execution through test scripts


- Auto generation of result file
- Auto generation of reports
- Faster execution

Features of Automation Testing:

- More accurate
- Lesser investment in human resource
- Support Regression Testing
- Frequent Executions
- Supports Lights Out Execution

Selenium WebDriver:

- Programming interface to create and execute test cases


- Test Cases are created and executed using Elements/Object locators/ Webdriver methods
- Selenium WebDriver has programming interface; Not IDE
- Selenium IDE supports only IDE. Doesn’t have programming interface
- Fast as it interacts with browser directly

WebDrivers:

- Each browser has its own driver on which the applications runs. Selenium WebDriver makes
direct calls to the browser

Types of WebDrivers (download on www.seleniumhq.org):

- Chrome Driver (chromedriver.exe)


- Safari Driver
- IE Driver (iedriver.exe)
- Firefox Dirver (geckodriver.exe)
- HtmlUnit Driver
Selenium WebDriver Features:

- Support for:
1. Programming Language – JAVA, C#, PHP, RUBY, PERL, PHYHON
2. Browsers – Firefox, Chrome, IE, Safari
3. OS – Windows, Mac, Linux, Android, iOS

Selenium WebDriver Drawbacks:

- Detailed test reports cannot be generated


- No Centralized maintenance of objects/ elements

SELENIUM GRID:

- Used to run multiple test scripts at the same time on multiple machines
- Parallel execution is achieved with the help of Hub-Node architecture
- Hub can control different test scripts on various browsers, OS and PL in various nodes
- Hub and Nodes are started using JAR files
- Supports RC test as well as WebDriver test
- Selenium-server-standalone.JAR to start the HUB
How to Setup an Environment:

1. Download & Install JAVA – download and install the latest JDK (Java Development Kit) with JRE
(Java runtime Environment) (32 or 64 bit).
- Link: https://www.oracle.com/technetwork/java/javase/d ownloads/index.html
- Create system variable name by JAVA_HOME and set this variable value as the JRE installation
location
- Update PATH environment variable with bin folder of JRE location

2. Download & Install SELENIUM – download latest version of the selenium web driver java
language bindings
- Link: http://selenium-release.storage.googleapis.com/index.html
- Files: selenium-server.zip and selenium-server-standalone.jar (Download the latest)

3. Download & Install ECLIPSE – download latest version of eclipse IDE for j2ee developers
- Link: https://eclipse.org
- Download the latest Eclipse version and should be the JAVA EE (Enterprise Edition)
ECLIPSE PROJECT CREATION:

To create a project follow the steps below:

1. Click on File>New>Java Project

Bring Selenium JARs to the project created

- Right Click on Project > Build Path> Configure build path > Libraries> Add External JARs>
Selenium Standalone server> click open (Repeat steps to add JARs on the Selenium Server)
- Make sure to add the JARs to Class Path
HOW TO START TO WRITE A SCRIPT:
1. Right Click on folder SCR> New> Package (Increase the readablity of the code)

2. Right Click on the Package Created> New> Class


8 ELEMENT LOCATOR TECHNIQUES:

1. Id
2. Name
3. Classname
4. Tagname
5. cssSelector
6. linktext
7. partiallinktext
8. xpath

SIKULI Framework:

- Download Sikuli-setup.jar
- Choose Java
TestNG FRAMEWORK (Test Management & Report Generation):

- TestNG is an open source testing framework inspired by JUnit. It stands for Test Next Generation
- TestNG is more flexible & powerful than jUnit because of below functionalities:
1. Annotations - Used to control the next method to be executed in the program TestNG
programs will not have ‘main’ method. However, all methods will be annotated with ‘@’
2. Prioritization
3. Method Dependency
4. Disabling Test Cases
5. Grouping
6. Assertions
7. Parallel Testing
8. Report Generation

Advantages using TestNG:

- HTML Reports can be generated


- Supports Parallel Testing
- Test Cases can be grouped & prioritized easily
- Uses annotations for executing methods
- Supports parameterization

Steps for writing TestNG tests:

- Write the business logic of the test and insert TestNG annotations in the code
- Add the information about your test (e.g. the class names, method names, group names etc.) in
a testing.xml file
- Run TestNG

Parameterization:

- @Parameter/ <parameters> (You can only send 1 value corresponding to any provider)
- @DataProvider (You can do data driver testing)

You might also like