Scrapy對接Selenium

首先pip安裝selenium,而後下載瀏覽器驅動html

 

WebDrive下載地址git

chrome的webdriver:http://chromedriver.storage.googleapis.com/index.htmlgithub

Firefox Firefox驅動下載地址爲:https://github.com/mozilla/geckodriver/releases/web

根據操做系統,以及瀏覽器版本,下載相應的驅動,並將下載的webdriver的路徑設置到環境變量中chrome

 

 

 將下載好的zip解壓出來、直接將裏面的exe文件放到運行環境的目錄下便可api

 

 

 

簡單使用瀏覽器

在中間件進行操做,不去調用下載器,直接返回一個response對象google

導入包:from selenium import webdriverspa

 

 

 

無窗口模式操作系統

再導入一個包:from selenium.webdriver.chrome.options import Options

相關文章
相關標籤/搜索