Python Selenium錯誤小結

2021-08-20 12:55:24 字數 676 閱讀 3167

因為要使用web應用,所以開始用起了,selenium包,安裝倒是挺容易的,但就是出了很多bug。。

filenotfounderror: [winerror 2] 系統找不到指定的檔案。
通過錯誤反饋發現是要把該軟體加到路徑裡面,但是,設定了系統環境變數後發現還是不行,

最後,使用了乙個非常原始的方法:

browser=webdriver.chrome(「c:/program files/chromdriver/」)

但這樣還是有問題:

permissionerror: [winerror 5] 拒絕訪問。

during handling of the above exception, another exception occurred:

通過查詢別人已有的經驗發現了解決方案;

1browser=webdriver.chrome("c:/program files/chromdriver/chromedriver.exe")

2browser=webdriver.chrome('c:\program files\chromdriver\chromedriver')

這兩種方式都可以執行,目前尚未確認那種更好,乙個是網路呼叫,乙個是檔案呼叫吧。

Python Selenium環境搭建

安裝python 設定 python 的環境變數 安裝目錄 安裝目錄 scripts 使用 pip安裝 selenium pip install selenium 安裝完python pip工具,在安裝目錄的 scripts 目錄下。在 dos下直接執行 pip install selenium 即...

Python Selenium 學習筆記

1 判斷元素是否存在 try driver.find element.xx a true except a false if a true print 元素存在 elif a false print 元素不存在 2 判斷元素是否顯示 driver.find element by id outputb...

Python Selenium環境搭建

linux,mac等系統自帶python,因此這裡主要講windows版本搭建。python3 安裝 其他版本 web based installer 需要聯網安裝,embeddable zip file 壓縮包,嵌入式版本,可嵌入其他應用。第一步 執行python 3.6.x amd64.exe ...