Page 1 of 1

Selecting dynamic innertext

Posted: Wed Jan 13, 2016 12:08 pm
by Raniv
Dear all,

Please help me with the following problem.

I am creating a automated test flow through a website which give a track and trace code at the end of the flow.
Which means that this code is changed every single time you finish a new flow. This is what the track and trace code looks like (example) : BFC3W-9USDJN-3SEDCD, so with a new flow the next code could look like ERD2W-SD3TGW-WSCD4E. When I used the spy it says that it's a innertext.

Now the problem at hand. I want to highlight the code and copy it to a input field where I can be directed to the next page in order to track my order with this Track and Trace code. However Ranorex recorder does not select/highlight the code as I did in my recording.

What do I have to do? I am really new with Ranorex as I am trying it out for my company. So I am not familiar yet with different functions that I can use. Perhaps I can use a "Get Value" function. I tried it, but I used it incorrect. Is there another way to fix my problem or please help me understand how to use the "Get Value" function, because I don't really get the explanations on the website itself.

Thank you in advance for all the help! :)

Re: Selecting dynamic innertext

Posted: Wed Jan 13, 2016 8:36 pm
by krstcs
You don't need to highlight/select the text to get the value. Just get the innertext value of the element using the GetValue action in a Ranorex test module. Save the value into a test module variable and pass it to the next part of your test by mapping it to a test case parameter or global parameter.

Re: Selecting dynamic innertext

Posted: Mon Dec 05, 2016 1:08 am
by nkarora
I have similar issue. Dynamic innertext tag only and no other tag is recognized therefore cannot get the value.
I need message which is displayed dynamically and store in Parent UItag and Child Li tag has dynamic inner text value which i need to validate.
Can you suggest

Regards
Nav

Re: Selecting dynamic innertext

Posted: Mon Dec 05, 2016 9:31 am
by odklizec
Hi Nav,

Unfortunately, there is not enough information in your post to provide a reasonable answer. Please upload a Ranorex snapshot (not screenshot!) of the problematic element(s). Without at least the snapshot, there is not much we can do for you.

Re: Selecting dynamic innertext

Posted: Mon Dec 05, 2016 10:21 pm
by nkarora
Hi,
Just want to clarify the issue. Following is the Ranorex spy view.

DOM 'Application'
+ Head
- Body
- Div 'New container'
- Div 'Column right'
- UI 'info'
- Li 'Message [no]'

I need to validate the message displayed therefore required to capture the value. The Element don't any unique tag, Inner text changes every time with different message. Can you please suggest to capture value from the above dynamic element.

Thanks
Nav

Re: Selecting dynamic innertext

Posted: Mon Dec 05, 2016 10:41 pm
by krstcs
Unfortunately, that does not clarify much. As Pavel asked, please post a RANOREX SNAPSHOT of the element in question.

Screenshots and partial descriptions do not help. What you have given us is about 2% of the information that a SNAPSHOT contains. We can use that to help demonstrate reliable XPaths and attributes to use to identify the object in question.

So, again, please post a RANOREX SNAPSHOT of the element(s) in question. Without that we won't be able to provide much help.

See the following page in the User Guide to learn how to create a SNAPSHOT: Creating Ranorex Snapshot Files

Re: Selecting dynamic innertext

Posted: Mon Dec 05, 2016 11:19 pm
by nkarora
Hi,
Please find attached snapshot of the application as requested.

Thanks
Nav

Re: Selecting dynamic innertext

Posted: Tue Dec 06, 2016 8:06 am
by odklizec
Hi,

Thanks for the snapshot. Because you saved the snapshot for entire app, without pointing at the exact element you want to obtain the innertext from, I can only assume (from your previous description) that you want to validate the innertext from "Li" tag belonging to Ul 'Info' tag? Luckily the Ul tag has an unique ID, so the xpath should look like this:

Code: Select all

/dom[@domain='vtcsdc2uatst01.victcs.ap.serco.com']//ul[#'info']/li
Simply create a new repo item with above xpath and then use Validate action to validate its InnerText.

I'm afraid, I don't see any 'trace code' as you described it in your initial post. So if you want to validate/read inner text from another element, please post an xpath pointing to the particular element eventually, create another snapshot, but this time, trace the exact element (with spy) you want to read the InnerText from. Thanks.

Re: Selecting dynamic innertext

Posted: Tue Dec 06, 2016 10:08 pm
by nkarora
"/dom[@domain='vtcsdc2uatst01.victcs.ap.serco.com']//ul[#'info']/li"
The element suggested above only works when there is only One li tag under UI 'info' tag but there are more than one li tag depend on the action in the application.

I can send you the snapshot with multi tag if required.

Re: Selecting dynamic innertext

Posted: Wed Dec 07, 2016 8:10 am
by odklizec
Hi,

I'm afraid, I'm a bit lost here. The description of the problem in your original request looks quite different from the snapshot you posted. I probably don't understand what exactly you want to achieve? Where in the posted snapshot is the trace ID you asked about in the original post? And what exactly do you want to do with the data from "li" element from the snapshot (and which one exactly)? As there could be multiple "li" tags on the page, you need to specify which one do you want to process or process them all?

Re: Selecting dynamic innertext

Posted: Wed Dec 07, 2016 10:02 pm
by nkarora
Thanks for support. It appear to me that you don't have any answer for my problem.

Re: Selecting dynamic innertext

Posted: Thu Dec 08, 2016 8:31 am
by odklizec
Well, I'm afraid, without consistent description of your problem, there is really nothing else I can do for you. Maybe if you describe what exactly do you want to achieve (and with proper snapshot matching the description), I or anyone else here can suggest something useful? Good luck!