Appium新版本不再支持ByName定位了怎么办
appium版本在1.5以后就不再支持ByName的定位,本文章仅介绍在appium1.6.3/1.6.4/1.6.5版本下如何支持ByName定位,适用于安卓。
在使用appium1.5之后的版本时,你一定见过这个错误
org.openqa.selenium.InvalidSelectorException: Locator Strategy 'name' is not supported for this session
是否很心痛,曾经的定位神器居然ByName居然不再支持了,那我以前的脚本可怎么办,此时你去各种技术论坛或者群求助,会得到两种答案
1. 换其他定位方式,比如用xpath代替
2. 使用ByAByAccessibilityId代替,但实践证明这个方法并没有取代ByName
其中第一种是可取的,换其他定位方式,本文将交给大家一个不用换定位方式不用换之前脚本的方法来完成无缝升级appium版本的定位方式
一招修改源码解决问题根源,修改方法如下:
找到你的appium\node_modules\appium-android-driver\build\lib\driver.js 文件,只需要修改其中一行即可
this.locatorStrategies = ['xpath', 'id', 'class name', 'accessibility id', '-android uiautomator','name'];//注意原本是没有最后的name的,name就是咱们修改加上的
修改完成之后,保存,再次重启appium服务,就可以继续使用ByName定位啦,完美

---------------------
作者:wuyepiaoxue789
来源:CSDN
原文:https://blog.csdn.net/wuyepiaoxue789/article/details/78411170
版权声明:本文为博主原创文章,转载请附上博文链接!
Appium新版本不再支持ByName定位了怎么办的更多相关文章
- appium----新版appium 1.11.1 支持ByName定位
org.openqa.selenium.InvalidSelectorException: Locator Strategy 'name' is not supported for this sess ...
- appium新版本不支持findElementByName,切换到findElementByAndroidUIAutomator
appium 1.7.6 不支持findElementByName(locator) 不知道为什么? 脚本中许多这样的语句,麻烦事情多了 org.openqa.selenium.InvalidSel ...
- 新版appium 支持name定位的方法(没试 记录再此)
查找路径:appium-desktop\resources\app\node_modules\appium\node_modules\appium-android-driver\build\lib 修 ...
- appium1.6.3/1.6.4/1.6.5版本下如何支持安卓下ByName定位
1. 换其他定位方式,比如用xpath代替 2. 使用ByAccessibilityId代替,感觉没什么效果 一招修改源码解决问题根源,修改方法如下: 找到你的appium\node_modules\ ...
- Appium+python自动化12-appium元素定位
前言 appium定位app上的元素,可以通过id,name.class这些属性定位到 一.id定位 1.appium的id属性也就是通过UI Automator工具查看的resource-id属性
- appium+python自动化50-生成定位对象模板templet(jinja2)
前言 每次自己写pageobject定位元素对象太繁琐,格式都差不多,只是换个定位方法,这种就可以才有模板的方式,批量生成pageobject定位元素对象的模板 python里面生成模板有两个模块可以 ...
- Python3+Appium学习笔记09-元素定位android_uiautomator
appium是使用了uiautomator的框架的,所以uiautomator所带的定位方式.appium也是支持的 需要使用appium中find_element_by_android_uiauto ...
- python+Appium自动化:各种元素定位方法
name定位 driver.find_element_by_name('飞利浦净水').click() 测试结果报错:selenium.common.exceptions.InvalidSelecto ...
- GitHub不再支持密码验证解决方案:SSH免密与Token登录配置
今天提交代码,push到GitHub上,突然出现这个问题. remote: Support for password authentication was removed on August 13, ...
随机推荐
- vuex中strict严格模式
开启严格模式,仅需在创建 store 的时候传入strict: true const store = new Vuex.Store({ state, strict:true//开启严格模式后,只能通过 ...
- 细说JDK日志组件
1. 概述 JDK自带的日志组件在包java.util.logging下,如图: 2. 架构如上图所示,JDK日志组件核心元素包括:Logger,Handler,Filter和Formatter,他们 ...
- 【转载】C# List用法 List介绍
https://www.cnblogs.com/dyhao/p/9501479.html
- iOS快捷代码块
//数据请求 /**<#封装数据请求(只适用本人)#>*/ NSString * requestUrl = [NSString stringWithFormat:@"%@%@&q ...
- springboo05-redis
springboot中使用redis:(1).使用redis工具类手动操作缓存(2).使用cacheable注解到方法头,自动创建缓存数据 1.安装redis https://github.com/d ...
- win10编译caffe调用matlab接口
参考 https://www.cnblogs.com/njust-ycc/p/5776286.html https://www.cnblogs.com/heately/p/7922521.html
- Luogu P4859「已经没有什么好害怕的了」
以前开过一遍这题,以为很难没刚下去 今天$ review$一遍分析了一下感觉也还好 luogu 4859 题意:给定长度为$ n \leq 2000$的数组$ A,B$求完全匹配使得$A>B$的 ...
- mysql 案例 ~ 主从复制延迟之并行复制
一 概念说明 1 模型 并行复制是典型的生产者.消费者模式,Coordinator作为生产者,worker线程作为消费者. 2 Waiting for preceding transactio ...
- AOP 横行切面编程和 纵向编程 介绍
1 aop:面向切面(方面)编程,扩展功能不修改源代码实现 2 AOP采取横向抽取机制,取代了传统纵向继承体系重复性代码3 aop底层使用动态代理实现(1)第一种情况,有接口情况,使用动态代理创建接口 ...
- 黑马程序员_Java基础视频-深入浅出精华版--PPT 文件列表
\day01\code\第一章_Java概述.ppt;\day01\resource\资料\50道编程题(有精力的同学看看).doc;\day01\resource\资料\Sun_Java程序员认证考 ...