Setting the string value to a repoitem Object Info

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
manalitatke
Posts: 36
Joined: Mon Jan 16, 2017 3:24 pm

Setting the string value to a repoitem Object Info

Post by manalitatke » Tue Oct 31, 2017 7:08 pm

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

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Setting the string value to a repoitem Object Info

Post by krstcs » Wed Nov 01, 2017 1:28 pm

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.
Shortcuts usually aren't...

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

Re: Setting the string value to a repoitem Object Info

Post by Support Team » Wed Nov 01, 2017 1:38 pm

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
.
Image

manalitatke
Posts: 36
Joined: Mon Jan 16, 2017 3:24 pm

Post by manalitatke » Thu Nov 16, 2017 5:15 pm

Hello, I tried using the regex pattern and it helps. Thanks

Vaughan.Douglas
Posts: 250
Joined: Tue Mar 24, 2015 5:05 pm
Location: Des Moines, Iowa, USA

Re: Setting the string value to a repoitem Object Info

Post by Vaughan.Douglas » Thu Nov 16, 2017 7:07 pm

I don't really follow what you're trying to do, but have to taken a look at this approach?
Doug Vaughan