Page 1 of 1

copy and paste values

Posted: Wed Sep 10, 2014 4:45 pm
by strannik
Hi everybody,

I need to paste Odd Start number in Street Number field. I’m using GetValue and SetValue functions and it is working ok but in case if Odd Start field is = 0 my script fails because of system verification on Street Number field (zeros not allowed there.)

If Odd Start field is 0 I can take value form Even Start field. These fields never have zero values at the same time.
Any idea how to perform this?
Please see an attachment.
Thank you all.

Re: copy and paste values

Posted: Fri Sep 12, 2014 2:52 pm
by Support Team
Hello strannik,

You will need to implement this logic within a user code module. For example:
string text = "";
			
var oddStart = repo.TestHtml.OddStart;
var oddEnd = repo.TestHtml.OddEnd;
var eventStart = repo.TestHtml.EventStart;
var streetNumber = repo.TestHtml.StreetNumber;

			
if(oddStart.Value == "0")
{
    text = eventStart.Element.GetAttributeValueText("Value");
}else
{
   text = oddStart.Element.GetAttributeValueText("Value");
}
			
streetNumber.Element.SetAttributeValue("Value",text);
This sample shows how to get the text of a button and place it into a textfield.

Regards,
Robert

Re: copy and paste values

Posted: Mon Sep 15, 2014 7:36 pm
by strannik
Thank you, Robert.
I will try it and let you know results.

Re: copy and paste values

Posted: Tue Sep 16, 2014 9:05 pm
by strannik
Hi Robert,
Your script is working if all fields on the same page but is you need to click on button and get to Street Number field. I tried and can't implemented it may be you have some ideas.

Thank you for you help.

Re: copy and paste values

Posted: Fri Sep 19, 2014 12:07 pm
by Support Team
Hello strannik,

I’m afraid that we are not able to analyze your issue without further information. May I ask if it’s possible to explain the issue in more detail? Which steps should your automated test cover?

Additionally, please create a Ranorex snapshot of your application under test. Either upload the snapshot file to the forum or send it to [email protected]

Thanks,
Robert

Re: copy and paste values

Posted: Fri Sep 19, 2014 4:50 pm
by strannik
Thank you Robert,

Here is scenario: For manual activities

1. User searches for odd start, odd end and even start field by entering postal code and selecting Search button.
2. when the page is displayed there are many properties with those fields
3. user should remember values with those fields if odd start is = 0 then user will remember value in even start field
4. after that user clicks button select for chosen property and a new page is open where is Street Number field present
5. user enters number in this filed and selects Update button

Now I need to automate this process. I created user code model and attached it under script, which performs clicking on postal code field and enters first 3 digits of postal code and searches for properties after that script clicks on select button and nothing happened script will execute and value would be inserted in Street Number field. What I'm doing wrong?

If you need more info please let me know.

Re: copy and paste values

Posted: Mon Sep 22, 2014 4:11 pm
by Support Team
Hi strannik,

Unfortunately it is very hard to analyze your issue without access to your application and having your Ranorex solution. The problem sounds like a coding problem and not like an issue with Ranorex itself.
However, the easiest way would be to send us your Ranorex solution and give us access to your application or at least a Ranorex Snapshot file from your application.
This would really help us analyzing your issue.

Regards,
Bernhard