selenium安裝后,需要安裝瀏覽器驅動


google的驅動:chromedriver.exe

驅動版本與chrome版本對應的目錄:
http://npm.taobao.org/mirrors/chromedriver/2.32/notes.txt
 
驅動各版本的下載地址:http://npm.taobao.org/mirrors/chromedriver
from selenium import webdriver
bs=webdriver.Chrome('C:\Program Files (x86)\Google\Chrome\Application\chromedriver')
chrome的首字母要大寫,chromedriver要放到chrome.exe的目錄下,調用時要給出chromedriver的全目錄包括文件名‘chromedriver.exe’
Firefox的驅動:從前的版本好像不需要安裝驅動,后來需要安裝firefoxdriver.exe,

Firefox Driver comes with Selenium/Webdriver itself. No need to launch an external server (like Chromedriver). It is all built-in.

http://code.google.com/p/selenium/wiki/FirefoxDriver

再后來據說被GeckoDriver 替代了,沒有核實,google用的比較順手。
note: as of selenium 3.0, FirefoxDriver has been replaced by GeckoDriver (which is external)


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM