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

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

背景


使用Appium Server 1.15.1版本


执行了以下脚本

test = driver.find_element_by_name("自动化测试")

print(test.text)


报了以下错误

image.png


圈重点

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

相关文章
|
22天前
|
Web App开发 前端开发 Java
《手把手教你》系列技巧篇(九)-java+ selenium自动化测试-元素定位大法之By name(详细教程)
【4月更文挑战第1天】 这篇教程介绍了如何使用Selenium Webdriver通过name属性来定位网页元素,作为系列教程的一部分,之前讲解了id定位,后续还会有其他六种定位方法。文中以百度搜索为例,详细说明了定位搜索框(name="wd")并输入关键词“北京宏哥”的步骤,包括手动操作流程、编写自动化脚本以及代码实现。此外,还提供了查看和理解Selenium源码的方法,强调了`open implementation`选项用于查看方法的具体实现。整个过程旨在帮助读者学习Selenium的元素定位,并实践自动化测试。
41 0
|
3月前
Appium设置会话时长,解决调试代码时session失效的问题
Appium设置会话时长,解决调试代码时session失效的问题
33 0
|
4月前
|
移动开发 安全 测试技术
『App自动化测试之Appium应用篇』| 继承于selenium常用的元素定位方法有哪些?如何使用?
『App自动化测试之Appium应用篇』| 继承于selenium常用的元素定位方法有哪些?如何使用?
84 0
|
Java
Appium问题解决方案(8)- selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Could not sign with default certificate.
Appium问题解决方案(8)- selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Could not sign with default certificate.
891 0
Appium问题解决方案(8)- selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Could not sign with default certificate.
|
3月前
|
Python
Python Appium Selenium 查杀进程的实用方法
Python Appium Selenium 查杀进程的实用方法
35 1
|
jenkins Linux Shell
软件测试|一键搞定centos7的docker+selenium+appium+jenkins+android_app源码打包成apk的环境搭建
软件测试|一键搞定centos7的docker+selenium+appium+jenkins+android_app源码打包成apk的环境搭建
138 0
Selenium成长之路-08简单对象定位之class name方法
Selenium成长之路-08简单对象定位之class name方法
110 0
Selenium成长之路-08简单对象定位之class name方法
|
前端开发
Selenium成长之路-07简单对象定位之tag name方法
Selenium成长之路-07简单对象定位之tag name方法
92 0
Selenium成长之路-07简单对象定位之tag name方法
|
Web App开发
Selenium成长之路-06简单对象定位之name方法
Selenium成长之路-06简单对象定位之name方法
60 0
Selenium成长之路-06简单对象定位之name方法
|
Docker 容器
Docker selenium自动化 - 修改/dev/shm路径大小实例演示,“session deleted because of page crash“问题解决
Docker selenium自动化 - 修改/dev/shm路径大小实例演示,“session deleted because of page crash“问题解决
641 0
Docker selenium自动化 - 修改/dev/shm路径大小实例演示,“session deleted because of page crash“问题解决

热门文章

最新文章