How do I Get Value and then Set Value

Ranorex Spy, Recorder, and Studio.
kdreiling
Posts: 9
Joined: Mon Sep 24, 2012 9:45 pm
Location: Kansas City

How do I Get Value and then Set Value

Post by kdreiling » Tue Oct 01, 2013 9:35 pm

I would appreciate a little help from my friends in the user community. First, I am not a developer, so please don't get too technical. I have a recording that I want to Get Value of the Current Date and Time, and then Set Value of the variable I've created and add 30 seconds to it. I have attached a screen shot of the recording.

Any tips would be most appreciated.
Attachments
GETandSET.png
Get Value and Set Value in a recording
GETandSET.png (12.53 KiB) Viewed 6728 times

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

Re: How do I Get Value and then Set Value

Post by Support Team » Wed Oct 02, 2013 4:46 pm

Hello,

This needs to be done using a User Code action.
You would only need to create this method in a Recording.UserCode.cs and call it via 'User Code' action.
It will log the current time, add 30 seconds and log this new time into report.
public void getCurrenTtime()
{
	System.DateTime curTime = System.DateTime.Now; // get current time

	Report.Info("Current time:" + curTime.ToString());       	
	curTime = curTime.AddSeconds(30); // add 30 seconds
	Report.Info("New time: " + curTime.ToString());       	
}
Regards,
Markus (T)
.
Image

amit_kumar
Posts: 5
Joined: Wed Oct 23, 2013 10:55 am

Re: How do I Get Value and then Set Value

Post by amit_kumar » Wed Oct 23, 2013 12:42 pm

Then what is use of GET VALUE property which is in the "Add new action" tab?
Can we use GET VALUE to get the text value from the pop up window. Then export this value to the external excel sheet.

For example:- We run a recording after some time this will give a pop up window in which we will get a text value. now i want to store that value into external excel sheet? but how? using renorex tool. Kindly guide me. I have attached a screen shot of the recording.
Attachments
New Picture.JPG
New Picture.JPG (157.85 KiB) Viewed 6682 times

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

Re: How do I Get Value and then Set Value

Post by Support Team » Wed Oct 23, 2013 1:07 pm

Hi,

In general it should be possible to export it to Excel.

In order to create a Get Value action select the specific repo item which represents the element where the value is shown and drag and drop it to your action table and select Get Value. Then you just need to select the right attribute, where the specific value is saved to, and a variable where the value of the specific attribute should be saved to.

Regards,
Markus
.
Image

amit_kumar
Posts: 5
Joined: Wed Oct 23, 2013 10:55 am

Re: How do I Get Value and then Set Value

Post by amit_kumar » Thu Oct 24, 2013 1:48 pm

Hi Markus,

I would appreciate a little help from my friends in the user community. Can u tell me which Attribute i have to choose to get the text value from pop up window. I tried with each of the Attribute but unable to get the text value from the pop up window.
I am a tester kindly don't go in depth.
As i have to test 1200 test cases, and every time I want the text value i.e. "False" or "True" from the pop up window. Kindly guide me.

Regards,
Amit kumar

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

Re: How do I Get Value and then Set Value

Post by Support Team » Fri Oct 25, 2013 10:59 am

Hi,

Without additional information about the control I am not able to tell you which attribute you need to use, but you can use the Spy tool to check if there is an attribute which is set to the specific value.
If you need further assistance/guidance I would need a Ranorex snapshot file of the window.
This will help me to tell you if there is an attribute which contains the text.

Regards,
Markus
.
Image