Assigning values at runtime

Ranorex Studio, Spy, Recorder, and Driver.
automationtool.1
Posts: 6
Joined: Fri Mar 06, 2009 8:10 am

Assigning values at runtime

Post by automationtool.1 » Fri Mar 06, 2009 2:23 pm

Hi,
I want to write a value for text box at runtime, how can i do that?
suppose there is a screen with a text box where we can enter value & save record. But while running the test again it gives Duplicate value error to avoid this error i want to increment value of text box each time i run the test. What will be the code?

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Post by Support Team » Fri Mar 06, 2009 3:25 pm

Something like the following code.

Code: Select all

// increments the text value 10 times and write it into the textbox
for(int i = 0;i<10;i++)
{
     repo.FormGoogle_Minus_GoogleMinus.TextSuche.DoubleClick();
     Keyboard.Press("test"+i);
 }
Regards,
Christian,
Ranorex Support Team

automationtool.1
Posts: 6
Joined: Fri Mar 06, 2009 8:10 am

Post by automationtool.1 » Sat Mar 07, 2009 6:26 am

i tried the code but it is not working at all... :(
where should i write the code ? in recording.cs file or Program.cs file?
also tell me where should i palce the for loop in the code?

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Post by Support Team » Mon Mar 09, 2009 11:23 am

I dont`t know anything about your testing code.
Could you post your code where you access to the text box.

Regards,
Christian,
Ranorex Support Team