copy and paste values

Ask general questions here.
strannik
Posts: 60
Joined: Tue Apr 29, 2014 3:00 pm

copy and paste values

Post by strannik » Wed Sep 10, 2014 4:45 pm

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.
You do not have the required permissions to view the files attached to this post.

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

Re: copy and paste values

Post by Support Team » Fri Sep 12, 2014 2:52 pm

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

strannik
Posts: 60
Joined: Tue Apr 29, 2014 3:00 pm

Re: copy and paste values

Post by strannik » Mon Sep 15, 2014 7:36 pm

Thank you, Robert.
I will try it and let you know results.

strannik
Posts: 60
Joined: Tue Apr 29, 2014 3:00 pm

Re: copy and paste values

Post by strannik » Tue Sep 16, 2014 9:05 pm

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.

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

Re: copy and paste values

Post by Support Team » Fri Sep 19, 2014 12:07 pm

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

strannik
Posts: 60
Joined: Tue Apr 29, 2014 3:00 pm

Re: copy and paste values

Post by strannik » Fri Sep 19, 2014 4:50 pm

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.

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

Re: copy and paste values

Post by Support Team » Mon Sep 22, 2014 4:11 pm

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