Appium 运行脚本报错InvalidSelectorException: Message: Locator Strategy 'css selector' is not supported for (转)


现象: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 
版权声明:本文为博主原创文章,转载请附上博文链接!


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM