selenium environment to build

Premise: install Python, pip, chrome

  1. Command: pip install selenium
  2. The first installation error, the second successful installation

 

Installation chromedriver:

  1. Get the installed chrome version: chrome: // version / (chrome into the address bar)

 

 

  1. Download Mirror: https: //npm.taobao.org/mirrors/chromedriver/
    1. And try to find similar chromedriver chrome (the last 3 digits may vary)
    2. Can not find win64 and downloaded 32, it is also possible
  2. Store address: run the unzipped file into a chrome chromedriver.exe in: C: \ Program Files (x86) \ Google \ Chrome \ Application

 

Code validation:

from selenium import webdriver

driver = webdriver.Chrome(
    executable_path='C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe'
)

driver.get('http://www.baidu.com')

 

Guess you like

Origin www.cnblogs.com/George19950505/p/12635373.html