英文:
Finding a specific pattern using regex in xpath
问题
我想使用正则表达式在xpath中查找特定文本。
这是我的xpath:
locator://*[@class = 'android.widget.TextView' and contains(@text,'PriceBottomBarDialog-selector')]
这个"PriceBottomBarDialog-selector"保持不变,开头的文本会不断改变。有谁可以帮忙提供正则表达式模式?
谢谢
英文:
I want to find a specific text using regex in a xpath.
This is my xpath:
locator: //*[@class = 'android.widget.TextView' and contains(@text,'PriceBottomBarDialog-selector')]
This "PriceBottomBarDialog-selector" remains constant, the beginning text keeps changing. Can anyone please help with the regex pattern?
Thank you
答案1
得分: 1
你已经接近成功了。你需要修复[tag:xpath]部分,并且可以使用定位策略:
-
Xpath:
定位器://*[@class = 'android.widget.TextView' and contains(.,'PriceBottomBarDialog-selector')]
英文:
You were close. You need to fix up the [tag:xpath] and you can use the Locator Strategy:
-
Xpath:
locator: //*[@class = 'android.widget.TextView' and contains(.,'PriceBottomBarDialog-selector')]
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论