使用 Appium 的 Android 元素的 Xpath [英] Xpath for Android element using Appium

查看:30
本文介绍了使用 Appium 的 Android 元素的 Xpath的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是自动化的新手.我正在开发 Android + Robot Framework + Appium.我正在尝试访问图片上的这 3 个定位器,但似乎没有任何效果.

I am new to automation. I am working on Android + Robot Framework + Appium. I am trying to get access to this 3 locators on the picture, but nothing seems to work.

如您所见,其中一些甚至没有 id 或任何其他元素,所以我想我应该使用 xpath 来访问它们,但是层数太多了...

As you can see, some of them even don't have an id or any other elements, so I guess I should use xpath to access them, but there is so many layers...

有人可以帮我吗?

推荐答案

不确定您是否只使用 Appium Inspector.

Not sure if you are using Appium Inspector only.

但是你当然可以找到使用它的元素的X-Path(附图片):

But you can certainly find the X-Path to an element using it (image attached) :

注意:这是来自网络的随机图像,只是为了描述 x-path 是使用 Appium Inspector 检查的元素的属性.

Note : This is a random image from web just to depict the x-path is an attribute for elements inspected using Appium Inspector.

相反,要检查应用程序的 WebView 中的元素,我建议使用

On the contrary to inspect elements within a WebView for an application, I would suggest using

chrome://inspect/#devices

在您的 chrome 浏览器上.

on your chrome browser.

这篇关于使用 Appium 的 Android 元素的 Xpath的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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