天天看點

關于Selenium.common.exceptions.WebDriverException: Message: Invalid locator strategy: css selector 的問題pip 更新 Appium-Python-Client

在執行腳本時報Selenium.common.exceptions.WebDriverException: Message: Invalid locator strategy: css selector 的錯

出現這個問題時請先檢查你的selenium版本是否和Appium-Python-Client 的版本互相相容

如果你的selenium是3.4的版本,需要下載下傳 Appium-Python-Client 2.8的版本

如果selenium是2.53.6的請一定要下載下傳 Appium-Python-Client 2.6的版本

cmd嘗試更新Appium-Python-Client

pip 更新 Appium-Python-Client

第一種方法:

pip install --upgrade  Appium-Python-Client      

如果出現權限提醒:

sudo -H pip install --upgrade  Appium-Python-Client      

第二種方法:

git clone [email protected]:appium/python-client.git
cd python-client
python setup.py install      

 在實踐中發現,

site-packages目錄下webdriver的内容并沒有更新到最新版(0.26/0.27),

解決方案:

手動删除/site-packages/appium/目錄,然後重新安裝。

安裝後即可看到/site-packages/appium目錄下的webdriver内容更新到最新(根據github源碼判斷檔案長短)