How To capture Dynamic variables

Ask general questions here.
upendra
Posts: 13
Joined: Tue Oct 06, 2015 11:27 am

How To capture Dynamic variables

Post by upendra » Tue Oct 27, 2015 7:51 am

Hi,
i have a field(item) which is dynamically changing each time i run,so i want to capture this value and paste the same value in the other field.So how can i do this.
I am using record and playback.
Last edited by upendra on Tue Oct 27, 2015 5:01 pm, edited 1 time in total.

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

Re: How To capture Dynamic variables

Post by odklizec » Tue Oct 27, 2015 7:58 am

Hi,

Could you please post a Ranorex snapshot of the element in question? Screenshot is unfortunately not very useful here.

If you want to capture the value from that field and use the value in the same module, you can use simple Get/SetValue action. If you want to use the obtained value between multiple modules, you can use for example the approach described here:
http://www.ranorex.com/blog/sharing-dat ... to-another
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

upendra
Posts: 13
Joined: Tue Oct 06, 2015 11:27 am

Re: How To capture Dynamic variables

Post by upendra » Tue Oct 27, 2015 9:40 am

Hi odklizec,
Please find the screenshot as an attachment.
Thanks !


Regards
Upendra
Attachments
Field Changing dynamically.rar
(2.36 MiB) Downloaded 61 times

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

Re: How To capture Dynamic variables

Post by odklizec » Tue Oct 27, 2015 9:57 am

Thanks for the snapshot.

Here is the xpath to the element with text you want to get...
/form[@title~'^Oracle\ Retail\ Merchandisi']//container[@caption~'^Item\ Maintenance\ Window\ \ ']//container[@type='FScrollBox']//text[@accessiblename='Item']
So add this element to repository. Now you have to add GetValue action to recording module.

In Recording module, go to "Add New Action" combo and select "Get Value" item. Eventually, Drag&Drop the repo element to recording table and from the appeared context menu select "Get Value". Then you need to select "Text" attribute, which contains the text you are looking for. Finally, you need to create a new module variable, in which will be the obtained value stored. Then you can use this variable where you want.

What I'm not quite sure about is what would happen if there is a text before the separator? The thing is that on the screenshot, there appears to be two individual text labels? However, in posted snapshot, there seems to be just one text element recognized?
text.png
text.png (27.22 KiB) Viewed 919 times
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

upendra
Posts: 13
Joined: Tue Oct 06, 2015 11:27 am

Re: How To capture Dynamic variables

Post by upendra » Tue Oct 27, 2015 10:57 am

Hi odklizec ,
Thanks for your Reply.It is working as expected.

Regards
Upendra

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

Re: How To capture Dynamic variables

Post by odklizec » Wed Oct 28, 2015 8:18 am

You are welcome ;)
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