Installing Python and Pip are described in the above article, not here. Install Seleinum directly
PIP3 Install Selenium
After the installation is complete,
PIP3 Show Selenium
Show
Name:selenium
version:3.4.3
Summary:python Bindings for Selenium
home-page:https://github.com/seleniumhq/selenium/
Author:unknown
Author-email:unknown
License:apache 2.0
Location:c:\program files\python35\lib\site-packages
Requires:
Proof of Successful Installation:
Now to test one, write a file baidu.py
#coding =utf-8
From selenium import Webdriver
Driver = Webdriver. Firefox ()
Driver.get ("http://www.baidu.com")
driver.find_element_by_id ("kw"). Sed_keys ("Selenium2")
driver.find_element_by_id ("su"). Click ()
Driver.quit ()
Once saved, execute Python baidu.py
Error:
File "/usr/local/lib/python2.7/dist-packages/selenium-3.0.0b2-py2.7.egg/selenium/webdriver/firefox/webdriver.py ", line +, in __init__self.service.start () File"/usr/local/lib/python2.7/dist-packages/selenium-3.0.0b2-py2.7.egg/ selenium/webdriver/common/service.py ", Line, Startos.path.basename (Self.path), self.start_error_message) Selenium.common.exceptions.WebDriverException:Message: ' geckodriver ' executable needs to is in PATH. This time, need to download geckodriver.exe:https://github.com/mozilla/geckodriver/releases Please select the download according to the system version, (such as Windows 64-bit system) After downloading the extract, copy the Getckodriver.exe to the Firefox installation directory, such as (C:\Program Files\Mozilla Firefox) and add the path in the environment variable path: C:\Program files\ Mozilla Firefox; If run, also reported error selenium.common.exceptions.WebDriverException:Message:Unable to find a Matchin
g set of capabilitiesThis note, Geckodriver.exe and Firefox version inconsistency caused by the need to find the corresponding version. OK, it's not too early, good night!
Python Selenium automation-environment building