android - 例如 : I would want to write an xpath that would click an element based on the input value

标签 android xpath robotframework

下面是我尝试为其编写 XPath 的元素
<div class="displayInlineBlock Roman30Px_New bsbAccountFont ng-binding">123456</div>
上面的元素在页面上很多,可以使用末尾的值来区分,即 123456。

我尝试过的 XPath 是这种方式,在尝试时我发现有一个包含值 123456 的 innerText。
//*[@class='displayInlineBlock Roman30Px_New bsbAccountFont ng-binding']
我不确定如何为我输入的每个特定值单击此元素。
我尝试过的其他几种方法是
xpath=from_frst_part=//div[innerText='123456'']/innerText
但没有任何效果。

我在想的另一种方法是查找页面上的元素数量并获取属性,但我觉得它又长又麻烦。

最佳答案

我认为合适的 xpath 也可以是这样,通过使用 and 关键字而不是将属性分隔到单个括号中://div[@class='displayInlineBlock Roman30Px_New bsbAccountFont ng-binding' and text()='123456']

关于android - 例如 : I would want to write an xpath that would click an element based on the input value,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59496131/

相关文章:

python - RobotFramework中货币字符串的数值计算

Android位图形菱形

android - 无法从 Android 上创建的 ZIP 存档中提取文件(特定于设备/操作系统)

android - Webview shouldoverrideurlloading 不起作用

python - 我可以使用 python、selenium 和 lxml 解析 xpath 吗?

bash - 如何使用 Robot 框架在 bash 中获取源文件?

android - 连接 Galaxy Nexus 时收到错误 "DeviceMonitor] Failed to start monitoring"

C# HTMLAgilityPack 选择不包含

xml - 如何在没有命名空间的情况下获取属性值?

python-2.7 - 是否可以使用机器人框架进行Windows Mobile测试?