mac 搭建selenium與ChromeDriver環境

轉載地址:https://www.jianshu.com/p/39716ea15d99?utm_source=oschina-apppython

 

安裝 selenium

☁  ~  pip3 install selenium
☁  ~  pip3 list selenium
Package    Version
---------- -------
pip        18.0
selenium   3.14.0
setuptools 40.2.0
urllib3    1.23
wheel      0.31.1

安裝 ChromeDriver 

官網查看最新版本web

查看最新版本與chrome的匹配chrome

 
ChromeDriver 2.41

查看chrome版本npm


 
chrome版本

根據本身的操做系統下載相應安裝包bash

 

能夠選擇到淘寶鏡像下載app

下載後,將安裝包加入到環境變量。以mac系統爲例,將chromedriver移至/usr/bin目錄下便可測試

 
   
  

驗證安裝

 

☁  ~  chromedriver
Starting ChromeDriver 2.41.578706 (5f725d1b4f0a4acbf5259df887244095596231db) on port 9515
Only local connections are allowed. 

測試可否調用chromeurl

☁  ~  ipython
Python 3.7.0 (default, Aug 22 2018, 15:22:33)
Type 'copyright', 'credits' or 'license' for more information IPython 6.5.0 -- An enhanced Interactive Python. Type '?' for help. In [1]: from selenium import webdriver In [2]: browser = webdriver.Chrome() In [3]: 
 
 

相關文章
相關標籤/搜索