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