Random Characters in String

94 views
Skip to first unread message

David

unread,
Aug 3, 2022, 8:49:04 PM8/3/22
to Automate
Hello,

I used to check elements via Inspect block and see if a word was present with a random string of characters attached, like this :
TextView : '* word to inspect *'

While the "*" meant random any characters. (not in Xpath). In Xpath, it doesn't work anymore. What is the replacement ? I always have to write the exact inspected element and sometimes I need the "*" to describe a random character,

Thanks!

Henrik "The Developer" Lindqvist

unread,
Aug 4, 2022, 11:21:15 AM8/4/22
to Automate
Use the XPath matches function e.g.:
//android.widget.TextView[fn:matches(@android:text, '.*word.*')]
or the custom glob function:
//android.widget.TextView[fn:glob(@android:text, '*word*')]

David

unread,
Aug 5, 2022, 7:12:22 AM8/5/22
to Automate
Thanks, it worked!
Reply all
Reply to author
Forward
0 new messages