selenium環境搭建----windows篇

  • 環境配置

python 3.7.2 (安裝 selenium 插件) 、  chrome谷歌瀏覽器76.0.3809.132版本(通過瀏覽器:chrome://version/ 查看版本)

chromedriver.exe 插件(http://chromedriver.storage.googleapis.com/index.html),將它放入E盤(例如)

  • 測試代碼執行:
from selenium import webdriver
if __name__ == '__main__':

    chrome_driver='E:\chromedriver.exe'
    driver = webdriver.Chrome(executable_path=chrome_driver)
    driver.get("http://www.baidu.com")
    pass

執行結果:彈出chrome谷歌瀏覽器,進入百度頁面

兼容其他瀏覽器:

https://www.selenium.dev/documentation/zh-cn/getting_started_with_webdriver/third_party_drivers_and_plugins/

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章