Objective
Currently the selenium version has been upgraded to 3.0, and most of the online tutorials are based on 2.0, so it is important to understand the version number before learning. The series is still based on selenium2, the current selenium3 pits more, temporarily no energy to study, follow-up will be related to the tutorial.
I. Introduction of Selenium
Selenium is a common framework for testing the WEB application user interface (UI). It is an extremely powerful tool for running end-to-end functional testing. You can write tests in multiple programming languages, and Selenium can perform these tests in one or more browsers.
Selenium's development has undergone three stages, the first stage, that is, the selenium1 era, before running the selenium1.0 program, we have to start the selenium server side (Selenium remote control), We are referred to as RC. RC mainly consists of three departments
Points: launcher,http Proxy,selenium core. Where selenium core is embedded in the browser page by Selenium server, selenium core is a bunch of JavaScript functions that are called to implement various actions on the browser.
Obviously cumbersome, this is not the best automated solution, so later with the Webdriver.
Selenium2 's era incorporates the Webdriver, which is what we usually call selenium,selenium2 is the default support for Firefox browser, which is very convenient. Of course also support other more browsers, IE and Chrome browser need to download the driver package, and add to the environment variable
SELENIUM3 is around October 2016 out, and now the default installation is SELENIUM3, selenium3 on the basis of selenium2 made some adjustments, the most obvious difference is SELENIUM2 support for Firefox supports up to 46 and below versions only. SELENIUM3 can support more than 47 versions, but you need to download the Geckodriver.exe driver and add it to the environment variable path.
The next content is dominated by selenium2
Environment Combination **************************
Best Environment for Beginners: jdk1.8+selenium2+firefox46 The following versions
Like beginning something new environment: jdk1.8+selenium3+firefox47 or above version
Small compilation of the environment:
WINDOWS8 64-bit
JDK 1.8
Selenium 2.53.0
Firefox 43
(1) JDK
1. Can search the website JDK installs the package, now is JDK1.8, double-click can install;
2. Configure environment variables (do not know how to match environment variables-find Niang);
3. Installation complete inspection;
(2) Eclipse
Eclipse to the official website to download the installation package, no installation, decompression can be used, extracted to which location of their own arbitrary;
eclipse:http://www.eclipse.org/downloads/
image.png693x492 18.2 KB
Opening eclipse requires setting workspace,workspace where the Java project created by Eclipse is stored;
(3) Selenium2
We need a total of 3 jar files:
Selenium-java-2.53.0.jar,
Selenium-java-2.53.0-srcs.jar,
Selenium-server-standalone-2.53.0.jar, can be downloaded to selenium official website;
On the created project, right-click Build Path---->add Libraries ...
image.png730x459 219 KB
Select the User Library option and click "Next".
Click on User Libraries ...
Create a Library directory, the name is random.
image.png687x627 207 KB
Select the extracted Selenium-java directory and add all the jar files below it. (You can select a directory by CTRL + a once
All files are added. )
image.png827x625 352 KB
Import the jar package complete, such as:
The environment is initially set up and you can use eclipse to write automated scripts later.
"Selenium2+java Automation (1)"-Environmental construction