XPATH

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
regex
Posts: 48
Joined: Tue Aug 14, 2012 5:47 pm

XPATH

Post by regex » Thu Oct 04, 2012 8:56 pm

I am trying to use XPath to normalize the name of a dynamic element.

Code: Select all


.//div[#ID']/table/tbody/tr[2]/td[2]/iframe//a[#'IDctl00_ctl38_Btn']
This 38 changes based on row number. I want to use ~[0-9] so that it accepts any number and therefore finds it.

How? Like this? But it doesn't work:

.//div[#ID']/table/tbody/tr[2]/td[2]/iframe//a[@text~'IDctl00_ctl[0-9]_Btn']

But it's not finding the item.

sham526
Posts: 34
Joined: Wed Jul 07, 2010 7:12 am
Location: Hyderabad(INDIA)

Re: XPATH

Post by sham526 » Fri Oct 05, 2012 5:59 am

First Try This(matches all elements starting with text value ldc):

.//div[#ID']/table/tbody/tr[2]/td[2]/iframe//a[@text~'(?i:ldc.*)']

If Not then Try this(Case insensitive)

.//div[#ID']/table/tbody/tr[2]/td[2]/iframe//a[@text~'(?i:ldctl00_ct[0-9)_btn']