Appium问题解决方案(4)- selenium.common.exceptions.InvalidSelectorException: Message: Locator Strategy 'name' is not supported for this session
时间:2020-05-20 11:35:08
收藏:0
阅读:103
背景
使用Appium Server 1.15.1版本
执行了以下脚本
test = driver.find_element_by_name("自动化测试") print(test.text)
报了以下错误

圈重点
selenium.common.exceptions.InvalidSelectorException: Message: Locator Strategy ‘name‘ is not supported for this session
简译: by_name 这种定位元素方式已经不支持了
然后查了下资料,发现是在appium1.5之后, by_name 的这种定位方式已经彻底移除
解决方法一
最简单,不再用 by_name 定位方式了,改用id、class、xpath、accessibility id
解决方法二
看了网上的教程【driver.js】,最终发现也是没用的,这里就不展开了~还是换个定位方式叭!
原文:https://www.cnblogs.com/poloyy/p/12922261.html
评论(0)