如何借助UIAutomator for Android App创建Xpath? [英] How to create Xpath with the help of UIAutomator for android App?

查看:89
本文介绍了如何借助UIAutomator for Android App创建Xpath?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何借助UIAutomator for Android App创建Xpath?

How to create Xpath with the help of UIAutomator for android App?

链接到任何指南都将非常有帮助.当前,UIautomator不提供Xpath.我想知道创建xpath的步骤.

Link to any guide would be very helpful. Currently UIautomator does not gives Xpath. I want to know the steps to create a xpath.

推荐答案

好,所以我建议阅读这篇文章:

Ok so I recommend reading this article: http://www.w3schools.com/XPath/xpath_syntax.asp

但是,如果您想找到带有文本"hello world"的 TextView ,可以给您一个想法,您可以使用以下xpath:

But to give you an idea if you wanted to find a TextView with the text "hello world" you could use this xpath:

//android.widget.TextView[@text='hello world']

//表示获取任何元素

//android.widget.TextView 表示获取具有 android.Widget.TextView

//android.widget.TextView [@ text ='hello world'] 表示获取类的任何元素 android.Widget.TextView ,属性"text"等于"hello world"

//android.widget.TextView[@text='hello world'] means get any element of class android.Widget.TextView with attribute "text" equal to "hello world"

我希望这个解释能对您有所帮助.如果您想更好地理解,请阅读该文章

I hope this explanation helps. If you want a better understanding read that article

这篇关于如何借助UIAutomator for Android App创建Xpath?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆