首页 > 移动平台 > 详细

Appium问题解决方案(4)- selenium.common.exceptions.InvalidSelectorException: Message: Locator Strategy 'name' is not supported for this session

时间:2020-05-20 11:35:08      阅读:102      评论:0      收藏:0      [点我收藏+]

背景

使用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】,最终发现也是没用的,这里就不展开了~还是换个定位方式叭!

Appium问题解决方案(4)- selenium.common.exceptions.InvalidSelectorException: Message: Locator Strategy 'name' is not supported for this session

原文:https://www.cnblogs.com/poloyy/p/12922261.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!