Python (i) |selenium + Python automated test environment setup

Source: Internet
Author: User

Selenium is a web of automated testing tools, many learning function automation students began to prefer selenium, compared with QTP because it has many advantages:

* Free, no need to crack QTP and big headache

* Small, for different languages it's just a package, and QTP needs to download and install 1 + G programs.

* This is also the most important point, whether you are more familiar with C, Java, Ruby, Python, or all C #, you can complete automated testing via selenium, while QTP only supports VBS

* Multi-platform support: Windows, Linux, MAC, multi-browser support: IE, FF, Safari, opera, Chrome

* Support the execution of distributed test cases, can distribute test cases to different test machine execution, equivalent to the function of the dispenser.

Build platform Windows

The preparation tools are as follows:

-------------------------------------------------------------

Download python

http://python.org/getit/

Download Setuptools "Python's Basic Package tool"

# http://pypi.python.org/pypi/setuptools Download installation package and ez_install.py content

Download Pip "Python's installation package management tool"

Https://pypi.python.org/pypi/pip

-------------------------------------------------------------

Because the version is updated, Pyhton select 2.7.xx, Setuptools choose the version of your platform, Pip do not worry about tar.gz as available under Windows.

Window Installation steps:

1, Python installation, this does not explain, EXE file run installation can, since you choose Python, I believe you are familiar with Python, I install directory C:\Python27

2, Setuptools installation is also very simple, the same EXE file, the default will find the Python installation path, will be installed in the C:\Python27\Lib\site-packages directory.

Via the Setuptools connection provided above, drag the page to the bottom to find thesetuptools-21.2.2.tar.gz file (version will be updated with time version), unzip the file, Setuptools the path under the direct copy file contents to the new TXT file, the modified file name is called ez_install.py, enter the Windows command prompt to execute the ez_install.py:

C:\setuptools-21.2.2>python ez_install.py No error indicates successful installation.

(If you are prompted that Python is not an internal or external command!) Don't worry, just configure the environment variable.)

Modify My Computer, properties, advanced-environment variable--the path in the system variable is:

Variable name: PATH

Variable value:; C:\Python27 and C:\Python27\Scripts

3, install PIP, I am the default decompression in the C:\pip-1.3.1 directory

4. Open a command prompt (start---cmd return) Enter the C:\pip-1.3.1 directory:

C:\pip-1.3.1 > Python setup.py install

5, then switch to the C:\Python27\Scripts directory input:

C:\Python27\Scripts > Easy_install pip

6, Installation Selenium, (: Https://pypi.python.org/pypi/selenium)

If it is connected, you can enter the command installation directly under C:\Python27\Scripts:

C:\Python27\Scripts > Pip install-u Selenium

If there is no Internet connection (this is generally not possible), download Selenium 2.33.0 (currently the latest version)

and unzip the entire directory into the C:\Python27\Lib\site-packages directory.

======= If you do not analyze the wedriver principle, the following two steps can be omitted =============

7. Download and install (Http://www.java.com/zh_CN/download/chrome.jsp?locale=zh_CN) what? You have not done Java, refer to other documents! It's not hard.

8. Download Selenium server (https://code.google.com/p/selenium/) found in the list on the left side of the page

Selenium-server-standalone-xxx.jar

Right! This is the thing, download it and unzip it;

In the Selenium-server-standalone-xxx.jar directory, use the command Java-jar Selenium-server-standalone-xxx.jar to start (if not open, to see if the port is occupied: netstat -aon|findstr 4444).

===============================================

The above knowledge is picked to the blog Garden Pest Division, after the practice of revising some of the content released as a learning summary.

Python (i) |selenium + Python automated test environment setup

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.