Selenium2+python Automation 1-Environment building (leisurely course)

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. This study tour series is based on selenium2

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, other browsers are supported, IE and chrome need to download the driver package and add it 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.

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

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

I study environment:

Windows 7 (64-bit)

Python 2.7.12

Selenium 2.53.6

Firefox 44

Second, Python installation

1. My Computer operating system: Win7 64-bit system

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

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

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

Third, environment variables

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

2. Add E:\python2 and E:\python2\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 intend to use the Firefox browser, then do not install more than 47 (SELENIUM2 is not compatible with more than 47). I use version 44 to learn.

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.

Selenium2+python Automation 1-Environment building (leisurely course)

Related Article

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.