setting text box value

Ask general questions here.
chunkylover53
Posts: 23
Joined: Wed Oct 06, 2010 8:21 pm

setting text box value

Post by chunkylover53 » Wed Aug 24, 2011 10:43 pm

Hi,
I have the following code running on windows 2008 with IE browser an current ranorex version.

InputTag userName = gmsLogin.FindSingle(".//input[@id='UsernameMaskTextBox']");
userName.Value= "user1";
InputTag password = gmsLogin.FindSingle(".//input[@id='PasswordMaskTextbox']");
password.Value = "Apollo";

The problem I am running into is that the background text (watermark)of the input tags is being set.
So when I click the login button the page thinks there is no username and password entered.
Any ideas to get around this?
Thanks

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: setting text box value

Post by Ciege » Wed Aug 24, 2011 10:53 pm

I would issue a click on the InputTags then type the name and password in rather than trying to set the value.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

Todor
Posts: 66
Joined: Mon Jul 25, 2011 11:28 am

Re: setting text box value

Post by Todor » Thu Aug 25, 2011 10:06 am

chunkylover53 wrote:The problem I am running into is that the background text (watermark)of the input tags is being set.
Does the program just add your values to the existing values in the inputbox?

If it does just do it like Ciege said:

Code: Select all

DivTag x = gmsLogin; // I assume that this is a DivTag if not just change it.

((InputTag)x.FindSingle(".//input[@id='UsernameMaskTextBox']")).Click();
((InputTag)x.FindSingle(".//input[@id='UsernameMaskTextBox']")).Value="user1";

((InputTag)x.FindSingle(".//input[@id='PasswordMaskTextboxTextBox']")).Click();
((InputTag)x.FindSingle(".//input[@id='PasswordMaskTextboxTextBox']")).Value="Apollo";
otherwise, from my point of view, you can comment the Click() Methods out.

chunkylover53
Posts: 23
Joined: Wed Oct 06, 2010 8:21 pm

Re: setting text box value

Post by chunkylover53 » Thu Aug 25, 2011 9:30 pm

Hi,
I tried click(), click(new location()), and performclick().
None of them worked. Does it matter that these login controls might be silverlight?

Todor
Posts: 66
Joined: Mon Jul 25, 2011 11:28 am

Re: setting text box value

Post by Todor » Fri Aug 26, 2011 9:45 am

Normally not. I have worked on a silverlight platform and i haven't had any problems so far.
If the click() Method does not work are you sure that these two objects are found by ranorex (?), because that could be the problem. Can you post the full path to these two objects? maybee we can help you then :)