Splinter是一個使用Python開發的開源Web應用測試工具。它可以幫你實現自動瀏覽站點和與其進行交互。python中實現自動化操作的庫有Splinter,selenium用于操控網站,其次,requests,scrapy,BeautifulSoup 用于獲取數據網站較多。scrapy其實是框架形式,適用于大規模爬蟲 Splinter可以直接使用pip install splinter安裝即可,不過直接使用需要自行下載WebDriver,比如使用的谷歌瀏覽器,需要下載Chromedriver.exe,放到python安裝目錄下即可。 測試代碼:
from splinter import BrowserMCBrowser=Browser("chrome")MCBrowser.visit("https://www.baidu.com/")運行py文件即可實現自動打開網頁并轉到百度網址。 具體關于庫的使用方法可以參考官方文檔: https://splinter.readthedocs.io/en/latest/index.html
新聞熱點
疑難解答