Selenium Family Introduction
Selenium IDE:The Selenium IDE is a plugin embedded in the Firefox browser that enables simple browser operation recording and playback functions.
Selenium RC:Selenium RC is the core tool of the Selenium family, supporting a variety of different languages to write automated test scripts, through the Selenium RC server as a proxy server to access the application to achieve the purpose of testing. Selenium RC Sub-client libraries and Seleniumserver, the client libraries library is primarily used to write test scripts to control Selenium Server. Selenium server is responsible for controlling browser behavior, in general, the Selenium server mainly consists of 3 parts: Launcher, Http Proxy, Core. Where selenium core is embedded in the browser page selenium server, in fact, is a bunch of JS function collection, through these JS function implementation of the browser operation, launcher to start the browser, the Selnium The core is loaded into the browser page and the proxy for the browser is set to the HTTP proxy of the selenium server.
Selenium Grid:The Selenium grid is an automated test aid that makes it easy to run multiple test cases concurrently on multiple machines and in heterogeneous environments with grid. Its characteristics are: parallel execution, through a host unified control use cases in different environments, different browsers run, flexible add change test machine. Selenium 1.0 Automated testing works by exporting recorded scripts to a language format such as "Python2/unittest/remote Control" through the Selenium IDE, and then running Selenium through Selenium server RC to control browser behavior, Selenium server runs on different versions of the platform and browser to enable automated run testing in heterogeneous environments, running in parallel with multithreaded multi-process technology that relies on the script itself.
Selenium 2.0:
Selenium 2.0 = Selenium 1.0 + webdriverIn Selenium 2.0, the main thrust is Webdriver, Webdriver is selenium RC alternatives, because selenium for backward compatibility, so selenium RC did not completely abandon.
Selenium RC and Webdriver:
- Selenium RC runs the JavaScript app in the browser, using the browser's built-in JavaScript translator to translate and execute the Selenese command (Selenese is a collection of Selenium commands).
- Webdriver directly controls the browser via native browser support or browser extensions. Webdriver is developed for each browser, replacing JavaScript embedded in the Web app under test. Tight integration with the browser enables the creation of more advanced tests, avoiding the limitations caused by the JavaScript security model. In addition to support from the browser vendor, Webdriver also simulates user input using an operating system-level call.
Selenium Environment Installation
To install the Selenium module:
Prerequisite: Installed Python and pip module if the computer is connected, you can enter the command installation directly under C:\Python27\Scripts: C:\Python27\Scripts >
pip Install-u SeleniumIf you do not have a network, you can install it by downloading:
- Selenium:https://pypi.python.org/pypi/selenium
- Download Selenium and unzip the entire directory into the C:\Python27\Lib\site-packages directory
To view the Selenium module version:
To install the Selenium IDE: Start Firefox, and then navigate to http://seleniumhq.org/download/. In the Selenium IDE section, click the link that displays the current version number as shown below, and Firefox automatically pops up the installation steps to complete the installation. Or download the Selenium IDE plugin directly selenium-ide-2.8.0.xpi then use the Firefox browser to open the boot installation. After the installation is complete, you can open it in Firefox's toolbar: note: Selenium IDE and Firefox version compatibility, the following versions are currently available:
- Firefox 37.0.2
- Selenium 2.8.0
Install Chrome browser driver chromedriver:1, download the driver Chromedriver.exe2, placed in the directory of the configured path path, such as C:\Python27 under
To install Selenium server:: http://www.java2s.com/Code/Jar/s/Downloadseleniumserverstandalone270patchedsourcesjar.htm
Start the Python Selenium module help service:
1. In the Command Line Doc window input: python-m pydoc-p 4567
Python-m Pydoc means to open the Pydoc module, Pydoc is the preferred tool for viewing Python documents;-p 4567 means starting the server on port 4567;
2, then access http://localhost:4567/in the browser, you should be able to see all the modules in Python
3, press ctrl+f, enter selenium, navigate to the Selenium document link, and then click into the http://localhost:4567/selenium.html this page, this is where the selenium document. Next, you can view it according to your needs. For example, if you want to see the basic methods of the Webdriver class, you can access this page http://localhost:4567/selenium.webdriver.remote.webdriver.html
Selenium automated test script execution
Execute directly on the Eclipse+pydev IDE tool:
Command line execution:
command line execution automation script with unit Test framework: python-m unittest test_baidu_search command line execution Automation script: Python run_testcase.py java-jar selenium-server- Standalone-2.39.0.jar-role Hub
Java-jar selenium-server-standalone-2.39.0.jar-role Node-port 5555
Java-jar selenium-server-standalone-2.39.0.jar-role Node-port 5556
Java-jar selenium-server-standalone-2.39.0ar-role node-port 5555-hub http://172.16.10.66:4444/grid/register
Documentation Manual:
Selenium with python:http://selenium-python.readthedocs.org/
The blog:http://www.easonhan.info/of ethanol
Webdriver Practical Guide:https://github.com/easonhan007/webdriver_guide/blob/master/README.md
python3-cookbook:http://python3-cookbook.readthedocs.org/zh_cn/latest/
Selenium Webdriver Automated Testing