Selenium+python Environment Configuration

Source: Internet
Author: User

Because of the project, more recently used UFT to automate the test work, six months did not use selenium, so on their own computer reconfiguration of the selenium environment based on python3.x, the configuration process is generally as follows:

1. Selenium Installation

Selenium the environment configuration under Python is relatively simple, just install the selenium package in Python.

2. Webdriver Installation

However, Webdriver for different browsers need to be installed separately.

Prior to the use of python2, there is no separate driver for Firefox browser, but this discovery for Firefox, also need to install third-party drivers: geckodriver

Otherwise the error is:

Selenium.common.exceptions.WebDriverException:Message: ' geckodriver ' executable needs to is in PATH.

Exception attributeerror: "' Service ' object has no attribute ' process '"

After downloading the driver (http://docs.seleniumhq.org/download/), unzip the driver and place it in the Firefox directory, then add the path to the system environment variable path and restart the Python environment. You can complete the Webdriver installation

3. Other browsers

For Chromedriver, the installation process is similar, no longer repeat

After the installation is complete, you can simply use the following code to test the installation effect:

1  from Import Webdriver 2 3 Driver = webdriver. Firefox ()4 driver.get ("http://www.cnblogs.com/persistz/") #URL

Selenium+python Environment Configuration

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.