Selenium - Guide
Selenium - Guide
org):
- More accurate
- Lesser investment in human resource
- Support Regression Testing
- Frequent Executions
- Supports Lights Out Execution
Selenium WebDriver:
WebDrivers:
- Each browser has its own driver on which the applications runs. Selenium WebDriver makes
direct calls to the browser
- 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 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:
- 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)
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
- 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)