Appium 運行腳本報錯InvalidSelectorException: Message: Locator Strategy 'css selector' is not su...

現象:Appium運行腳本報錯InvalidSelectorException: Message: Locator Strategy 'css selector' is not supported for this session,可是腳本里使用的定位元素方法爲find_element_by_id()
 
緣由:
 
根本緣由1:電腦裏安裝的selenium版本和Appium-Python-Client版本不兼容
 
緣由2:selenium版本以前是單獨安裝的3.12.0版本。Appium-Python-Client版本是經過Pycharm工具-settings- project Interpreter裏安裝的,安裝時沒有安裝所對應匹配的selenium版本,致使版本不兼容
 
pycharm 裏安裝包的地點:
 
 
解決方法:
 
總結:從cmd裏經過pip方法安裝Appium-Python-Client時會同時安裝正確對應的selenium版本(若是已經存在不兼容會卸載)。
 
方法:
 
1. Pycharm工具,先把Appium-Python-Client安裝包卸載掉
 
2. 經過pip從新安裝Appium-Python-Client


 
看截圖裏卸載掉了3.12.0,從新安裝了selenium3.141.0版本。
 
3. 從新運行腳本,問題解決了
--------------------- 
做者:hou_angela 
來源:CSDN 
相關文章
相關標籤/搜索