Problem in accessing the element

Ask general questions here.
rohitjain3333
Posts: 20
Joined: Tue Sep 20, 2011 7:12 am

Problem in accessing the element

Post by rohitjain3333 » Wed Sep 21, 2011 11:45 am

I am trying to access the element wwhich has path which ends as " /text[@accessiblevalue='0.000001']"
but at run time the the accessiblevalue changes and it throws exception in finiding the path.

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

Re: Problem in accessing the element

Post by Support Team » Wed Sep 21, 2011 12:05 pm

Hi,

It seems that this is a dynamic attribute which changes after each restart of your AUT.
So you have to find a unique attribute to identify the element.
Are there any other attributes available for the element?
For more information please have a look at the following links:

http://www.ranorex.com/support/user-gui ... xpath.html
http://www.ranorex.com/blog/ranorexpath-tips-and-tricks
http://www.ranorex.com/blog/eliminate-d ... norexpaths

Regards,
Markus
Ranorex Support Team
.
Image

rohitjain3333
Posts: 20
Joined: Tue Sep 20, 2011 7:12 am

Re: Problem in accessing the element

Post by rohitjain3333 » Wed Sep 21, 2011 1:29 pm

how to write a regular expression to find numbers like 0.00001 or 56.
so at run time it will find that element.
i am doing like this Text [email protected] " .../text[@accessiblevalue='[0-9]*'] "
is this correct if not plz correct it.

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

Re: Problem in accessing the element

Post by Support Team » Wed Sep 21, 2011 1:41 pm

Hi,

your RanoreXPath holding the reg exp should look something like this:
/text[@accessiblevalue~'^[0-9]+\.?[0-9]*$']
  • ^ ... starts with
  • [0-9]+ ... a digit one or more times
  • \.? ... a "." zero or one times
  • [0-9]* ... a digit zero or more times
  • $ ... ends with
For more details about using regular expressions in RanoreXPath have a look at following chapter of our user guide:
http://www.ranorex.com/support/user-gui ... html#c3294

Regards,
Tobias
Support Team
.
Image

rohitjain3333
Posts: 20
Joined: Tue Sep 20, 2011 7:12 am

Re: Problem in accessing the element

Post by rohitjain3333 » Thu Sep 22, 2011 7:52 am

thanx a lot this solved my problem... :)