InnertTextValue using Xpath

Class library usage, coding and language questions.
omayer
Posts: 458
Joined: Thu Oct 28, 2010 6:14 pm

InnertTextValue using Xpath

Post by omayer » Fri Apr 12, 2013 11:47 pm

How to retrieved "55337" value from innertext using xpath, currently read the innertext as
"Burnsville, MN 55337 United States of America "

//div[#'flashRoot_1']/table/tbody/tr/td[1]/table[1]//table//tr[1]/td[@innertext~'[0-9]']
Thank you in advance
Tipu

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3937
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: InnertTextValue using Xpath

Post by odklizec » Sat Apr 13, 2013 9:25 am

Hi,

You mean you want to retrieve the ZIP code and use it in variable? If you know the number is always 5 digits long, use this reg exp...

Code: Select all

\d{5}
In recording module, it could look like this...
InnerText.png
InnerText.png (21.34 KiB) Viewed 851 times
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

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

Re: InnertTextValue using Xpath

Post by omayer » Sat Apr 13, 2013 10:27 am

Thank you odklizec, same result using "//table//tr[1]/td[@innertext~'\\d{5}']", Not getting the zipcode
Tipu

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3937
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: InnertTextValue using Xpath

Post by odklizec » Sat Apr 13, 2013 1:52 pm

Not getting where? What exactly you trying to achieve? Could you please share an example project?

I tried the example I gave you and the variable was correctly filled with 5 digits (extracted from your example string).
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration