Selenium2+python Automation 1-Environment construction

Source: Internet
Author: User

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.

The development of selenium has undergone three stages, the first stage, namely the selenium1 era, before we run 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: python2.7+selenium2+firefox46 The following versions

Like beginning something new environment: python3.6+selenium3+firefox47 or above version

*********************************************

Small compilation of the environment:

WINDOWS10 64-bit

Python 2.7.12

Selenium 2.53.6

Second, Python installation

1. Small computer operating system: WIN10 64-bit system

2. Download the Python installation package, select both version 2.7 and version 3.6 to

(The following tutorial, two versions will talk together, so don't worry about version issues)

Official website: https://www.python.org/57

3.Python installation, double-click the Fool installation (do not install on the C-drive)

Third, environment variables

1. After the installation is complete, look at this directory D:\python\Scripts, there are no pip.exe and easy_install.exe (generally, there is no need to reinstall once)

2. Add D:\python and D:\python\Scripts to the environment variable path

Iv. installation of Selenium

1. Open cmd Window input: Pip (indicates normal if content is displayed)

2.cmd Input Command installation SELENIUM:PIP install selenium==2.53.6

(Note: The first install must see progress 100% complete, if the halfway failed, re-enter the instructions to install, until you see 100% completed)

V. Verification of Selenium

How do you know selenium is properly installed?

1. Make sure the Firefox browser is installed on your computer

2.cmd window Enter the following command

>python

>from Selenium Import Webdriver

>webdriver. Firefox ()

3. If you can start the browser, the environment installation OK.

VI. Browser

1. If you plan to use the Firefox browser, then do not install more than 47 (SELENIUM2 is not compatible with more than 47)

2. If you plan to use IE or chrome, you will need to download the browser driver to place the driver files in the Python root directory.

If you have installed a version of the 3.0, the start of Firefox will be an error, summer chapter about how to use PIP downgrade Selenium version

Selenium2+python Automation 1-Environment construction

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.