[英]Finding a specific pattern using regex in xpath
I want to find a specific text using regex in a xpath.我想在 xpath 中使用正则表达式查找特定文本。
This is my xpath:这是我的 xpath:
locator: //*[@class = 'android.widget.TextView' and contains(@text,'PriceBottomBarDialog-selector')]
This "PriceBottomBarDialog-selector" remains constant, the beginning text keeps changing.这个“PriceBottomBarDialog-selector”保持不变,开始的文本不断变化。 Can anyone please help with the regex pattern?任何人都可以请帮助正则表达式模式吗?
Thank you谢谢
You were close.你很亲密。 You need to fix up the xpath and you can use the Locator Strategy :您需要修复xpath并且可以使用定位器策略:
Xpath: Xpath:
locator: //*[@class = 'android.widget.TextView' and contains(.,'PriceBottomBarDialog-selector')]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.