Build Python+selenium Environment under Windows

Source: Internet
Author: User

1. Install Python

https://www.python.org/

2, install setuptools(Python's basic Package tool)

:https://pypi.python.org/pypi/setuptools

Download ez_setup.py file

Open cmd, go to the directory where the ez_setup.py file is stored, execute the python ez_setup.py

3. Install pip(Python's installation package management tool)

:https://pypi.python.org/pypi/pip, download pip-6.1.1.tar.gz

CMD into the file directory after decompression, execute Python setup.py install

4, installation Selenium

CMD into the scripts directory, execute pip install-u Selenium

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

5. Demo

Installation is complete, you can try to write a small demo

From selenium import Webdriver
From selenium.common.exceptions import nosuchelementexception
From Selenium.webdriver.common.keys import keys

Browser = Webdriver. Firefox () # Get local session of Firefox
Browser.get ("http://www.baidu.com") # Load page
Browser.close ()

If you want to use IE, Chrom browser, also need to download the corresponding webdriver (download files Chromedriver.exe and IEDriverServer.exe)

Build Python+selenium Environment under Windows

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.