Python Learning: selenium2 + python3.3.5 Development Environment Preparation

Source: Internet
Author: User

Selenium is also a tool for Web application testing. The selenium test runs directly in the browser, just as the real user is doing. Supported browsers include IE (7, 8, 9), Mozilla Firefox, Mozilla Suite, and more. The main features of this tool include: test and browser compatibility--test your application to see if it works well on different browsers and operating systems. Test system functions--Create regression test to verify software functionality and user requirements. Supports automatic recording of actions and automatic generation of test scripts in different languages such as. Net, Java, and Perl. Selenium is an acceptance testing tool ThoughtWorks specifically written for Web applications.

Selenium detailed description, please see Baidu Encyclopedia or wiki, here is not detailed. The current version of Selenium is 2.4.5.

The main introduction of the environment under the Mac and Windows building, Mac is the Unix family of operating systems, the installation of this article should also support other Linux operating systems.

Prepare your Mac system before installation:

1, download python3.3.5, according to the number of CPU bits of the system to choose 32 or 64-bit. 64-bit: HTTP://WWW.PYTHON.ORG/FTP/PYTHON/3.3.5/PYTHON-3.3.5-MACOSX10.6.DMG 32-bit: http://www.python.org/ftp/python/ 3.3.5/python-3.3.5-macosx10.5.dmg

2, download selenium2.45. Https://pypi.python.org/packages/source/s/selenium/selenium-2.45.0.tar.gz

3, download Setuptools, because python3.3.5 version does not have setuptools, need to install separately. https://pypi.python.org/packages/source/s/setuptools/setuptools-14.3.zip#md5=2929b7ebe39ad47f37a25b5a8e66371c

Note: This step is optional, if there is a network, can be installed through the command line, automatic download.

4, install Firefox browser.


Mac System Installation:

1, install python3.3.5, the installation of Python and ordinary software is no different, the above download is DMG. It is not detailed here. After successful installation, you can knock Python3 on the command line, because the MAC system has Python2 version by default, Python3 version is executed with python3 command. As shown below:

          xxx:selenium-2.45.0 fish$ Python3python 3.3.5 (v3.3.5:62cf4e77f785, Mar  

2, install Setuptools, if there is a network can be directly with the following command:

Curl Https://bootstrap.pypa.io/ez_setup.py-o-| Python3

If you do not have a network, install it directly with the downloaded file and tap the following command:

TAR-ZXVF setuptools-14.3.zipcd setuptools-14.3python3 setup.py Install
Note: Here you need to use the Python3 command, for other system installation, you can refer to Https://pypi.python.org/pypi/setuptools


3, Installation selenium2.4.5

TAR-ZXVF SELENIUM-2.45.0.TAR.GZCD selenium-2.45.0python3 setup.py Install

4, install Firefox browser, there is not much to say.


5, test script, write the following script, save into hellobaidu.py

From selenium import webdriverimport timedriver = Webdriver. Firefox () driver.get ("http://www.baidu.com") driver.find_element_by_id ("kw"). Send_keys ("Python Programming Development") Driver.find_ element_by_id ("su"). Click () time.sleep (5) #等待5s, close the browser. Driver.quit ()

After saving, do Python3 hellobaidu.py, and then look at the effect, is it done?! The detailed instructions follow up again.


Python Learning: selenium2 + python3.3.5 Development Environment Preparation

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.