Piku
Piku

Reputation: 21

Finding a specific pattern using regex in xpath

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

Upvotes: 1

Views: 134

Answers (1)

undetected Selenium
undetected Selenium

Reputation: 193058

You were close. You need to fix up the and you can use the Locator Strategy:

  • Xpath:

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

Upvotes: 1

Related Questions