51Testing软件测试论坛

标题: 求助,元素定位 [打印本页]

作者: lotus002673    时间: 2016-11-9 15:20
标题: 求助,元素定位
本帖最后由 lotus002673 于 2016-11-9 15:27 编辑


各位大侠,下图是用ui Automator Viewer捕捉到的图,我怎样定位到Button这个元素啊?





我试过 WebElement el = driver.findElementByXPath("//android.widget.RelativeLayout/android.widget.Button[contains(@index,2)]");

说element could not be located.

请大侠指点,多谢了


作者: Miss_love    时间: 2016-11-9 15:44
用文本定位
作者: Miss_love    时间: 2016-11-9 15:44
Miss_love 发表于 2016-11-9 15:44
用文本定位

text
作者: lotus002673    时间: 2016-11-10 09:34
Miss_love 发表于 2016-11-9 15:44
text

好,我去试试
作者: lotus002673    时间: 2016-11-10 10:21
Miss_love 发表于 2016-11-9 15:44
text

value=绔嬪嵆浣撻獙

控制台里显示为乱码,是不是不支持中文啊
作者: SunFlower.Me    时间: 2017-3-6 11:02
求助  value值相对定位  我要定位的元素父类唯一 截取xpath为 /section/a[4]   元素:<a class="list-group-item">中文名字</a>




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2