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

查看:21
本文介绍了如何借助 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.

推荐答案

好的,我推荐阅读这篇文章:http://www.w3schools.com/XPath/xpath_syntax.asp

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天全站免登陆