Page 1 of 1

Setting the string value to a repoitem Object Info

Posted: Tue Oct 31, 2017 7:08 pm
by manalitatke
Hello,


With regards to the post below:

https://www.ranorex.com/forum/how-to-se ... t5773.html


I wanted to ask if there is any update on the newer versions of Ranorex.



I want to convert a string to a repoitem Object

Eg: Want to track the above element:

Voltage = 122.07 Volts

Now, everytime i am going to test the UI, the value of this voltage is going to change anywhere from 120 to 180.

For converting the repoitem to string, and then performing a substring operation (getting only the numerical part - 122.07), followed by double conversions and arithmetic operations is successful for checking the range in user code.

However, i want to introduce a mouse click event for this string item after performing all these operations in user code

Is there any way to convert string to a repo-item info for handling the mouse click event?


Ranorex Version: 7.2.0
Windows 7

Re: Setting the string value to a repoitem Object Info

Posted: Wed Nov 01, 2017 1:28 pm
by krstcs
Please post a Ranorex Snapshot (NOT a screenshot!) of the element in question. Without it there's not much we can do.

My suggestion would be to stop trying to do all that converting and use the label as the marker for the value, but again, without a snapshot it will be impossible to give you any meaningful help.

Re: Setting the string value to a repoitem Object Info

Posted: Wed Nov 01, 2017 1:38 pm
by Support Team
Hello Manlitatke,

Based on your requirements, I am failing to see why you need to convert a string to a repoitem. You can use RegEx in your RanorexPath to select the correct object, for example: /*[innertext~'1([2-7][0-9]|[8][0]) Volts']. This RegEx pattern will only find the object if it is within the specified range (120-180), which means you can use a simple Validate > Exist action to validate it exists and is within the required range without any coding or extra steps. If you need to pull the exact value without the ' Volts', you can use a Get-Value > Innertext and trim " Volts" off the end (in code).

I hope this helps! With more information of your issue and a Ranorex Snapshot, we will be able to better assist you.

Cheers,
Ned

Posted: Thu Nov 16, 2017 5:15 pm
by manalitatke
Hello, I tried using the regex pattern and it helps. Thanks

Re: Setting the string value to a repoitem Object Info

Posted: Thu Nov 16, 2017 7:07 pm
by Vaughan.Douglas
I don't really follow what you're trying to do, but have to taken a look at this approach?