在XPath中使用正则表达式查找特定模式

问题描述

我想在xpath中使用正则表达式查找特定文本。

这是我的xpath:

locator: //*[@class = 'android.widget.TextView' and contains(@text,'PriceBottomBarDialog-selector')]

此“ PriceBottomBarDialog-selector”保持不变,开始的文本不断变化。有人可以帮忙处理正则表达式吗?

谢谢

解决方法

你很近。您需要修复,然后才能使用Locator Strategy

  • Xpath:

    locator: //*[@class = 'android.widget.TextView' and contains(.,'PriceBottomBarDialog-selector')]
    

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...