Appium (已解决) 升级 Appium 1.5.0 之后遇到的一个严重问题

rhyme · 2016年03月01日 · 最后由 Chris Wú 回复于 2016年03月02日 · 1592 次阅读

使用 find by name 方法时报错

Appium log 如下:

使用 1.4.16 版本,未发现上述问题,怀疑是 1.5.0 的问题,于是,到 github 去搜了一下,果然,已经有人提交了 issue,npm install appium on windows not support driver.findElement(By.name("Add Contact")) 提醒大家,升级要谨慎。。。

可使用 findElementByAndroidUIAutomator("text(String)") 方法代替

共收到 15 条回复 时间 点赞

这次的 1.5.0 是完成了代码重构。。

这个不是 bug,是因为 by name 的这种定位方式已经在 1.5 中被移除了。

#2 楼 @b_88 真的么?我看官方文档没有说 remove 啊

#1 楼 @lihuazhang 尝鲜有风险,哈哈

#1 楼 @lihuazhang
#2 楼 @b_88
是的,很不幸,确实移除了

Locator strategy 'name' was deprecated in earlier versions of Appium and has been removed in 1.5.

#5 楼 @cy_suncheng 有什么取而代之的方法么?

#6 楼 @monkey 根据官方的文档,代替方法就是 accessibility_id

@monkey 但是这个方法不是早就支持了么? http://appium.io/slate/en/1.5/?ruby#new-locator-strategies

#6 楼 @monkey 经研究,可使用 findElementByAndroidUIAutomator("text(String)") 方法代替

感谢楼主尝鲜。

#9 楼 @cy_suncheng 嗯,这个可以理解了。这个是实用了新框架么?但是按照 release note 也没有说,我去看看

rhyme #12 · 2016年03月02日 Author

#11 楼 @monkey 我感觉是在弱化从 selenium 而来的方法,而是更多的是用 UIautomator,肤浅的个人理解,不知道对不对。

#12 楼 @cy_suncheng 看 api name 是这样的

#12 楼 @cy_suncheng 看 api name 是这样的

升級前看看 release note 是常識吧。。

https://github.com/appium/appium/releases

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册