How to identify dynamic string end with special characters.

Mobile Testing, Android App Testing.
jwei
Posts: 8
Joined: Fri Nov 09, 2012 7:34 pm

How to identify dynamic string end with special characters.

Post by jwei » Wed Nov 21, 2012 12:42 am

I want to select a checkbox which shows dynamically, how can i use regular expression to capture it regardless the name.

example: @name='document_id[]', all names end with "_id[]". I use $ sign, but it does not.

omayer
Posts: 458
Joined: Thu Oct 28, 2010 6:14 pm

Re: How to identify dynamic string end with special characters.

Post by omayer » Wed Nov 21, 2012 5:50 am

this might work
@name~'.*id[]'
Tipu

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: How to identify dynamic string end with special characters.

Post by Support Team » Wed Nov 21, 2012 1:22 pm

Hello,

Please try to use the following expression:

Code: Select all

@name~'.*_id\[\]$'
Special characters in regular expressions like [] have to be escaped by using a backslash.
Please take a look at our section RanoreXPath in our User Guide for more information.

Regards,
Markus (T)
.
Image