Selecting dynamic innertext

Ranorex Spy, Recorder, and Studio.
Raniv
Posts: 1
Joined: Wed Jan 13, 2016 11:53 am

Selecting dynamic innertext

Post by Raniv » Wed Jan 13, 2016 12:08 pm

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! :)

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

Re: Selecting dynamic innertext

Post by krstcs » Wed Jan 13, 2016 8:36 pm

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

nkarora
Posts: 12
Joined: Mon Dec 05, 2016 12:54 am

Re: Selecting dynamic innertext

Post by nkarora » Mon Dec 05, 2016 1:08 am

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

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

Re: Selecting dynamic innertext

Post by odklizec » Mon Dec 05, 2016 9:31 am

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

nkarora
Posts: 12
Joined: Mon Dec 05, 2016 12:54 am

Re: Selecting dynamic innertext

Post by nkarora » Mon Dec 05, 2016 10:21 pm

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

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

Re: Selecting dynamic innertext

Post by krstcs » Mon Dec 05, 2016 10:41 pm

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

nkarora
Posts: 12
Joined: Mon Dec 05, 2016 12:54 am

Re: Selecting dynamic innertext

Post by nkarora » Mon Dec 05, 2016 11:19 pm

Hi,
Please find attached snapshot of the application as requested.

Thanks
Nav
Attachments
Issue#1.rxsnp
(574.57 KiB) Downloaded 44 times

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

Re: Selecting dynamic innertext

Post by odklizec » Tue Dec 06, 2016 8:06 am

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

nkarora
Posts: 12
Joined: Mon Dec 05, 2016 12:54 am

Re: Selecting dynamic innertext

Post by nkarora » Tue Dec 06, 2016 10:08 pm

"/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.
Attachments
Errors_Screenshot.png
Errors_Screenshot.png (17.45 KiB) Viewed 1029 times

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

Re: Selecting dynamic innertext

Post by odklizec » Wed Dec 07, 2016 8:10 am

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?
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

nkarora
Posts: 12
Joined: Mon Dec 05, 2016 12:54 am

Re: Selecting dynamic innertext

Post by nkarora » Wed Dec 07, 2016 10:02 pm

Thanks for support. It appear to me that you don't have any answer for my problem.

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

Re: Selecting dynamic innertext

Post by odklizec » Thu Dec 08, 2016 8:31 am

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!
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