Windows under Install configuration Python + Selenium to drive Firefox

Source: Internet
Author: User

The first step is to download the installation Python first, I downloaded the 3.5 version, this version, comes with the PIP tool, does not need to install the pip:)

Link Address: Python 3.5

Second step, execute pip install selenium install Selenium Library

Here, I thought it was over, just wrote a script-driven browser

The third step, however, the code simply can not run, tossing a half day, only to find that the original Selenium 3 version, need to install Geckodriver

Selenium relies on geckodriver to drive the browser.

Now that the installation is complete, you can run the following script to see what happens:)

 # Coding=utf-8  from   Selenium import webdriverdriver  =webdriver. Firefox () driver.  get  ( " http://www.baidu.com  "  ) driver.find_element_by_id (  " kw  " ). Send_keys ( " selenium2   " ) driver.find_element_by_id (  " su   " ). Click () Driver.quit ()  

Save this code as baidutest.py, and then Python baidutest.py can do it!

Windows under Install configuration Python + Selenium to drive Firefox

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.