Page 1 of 1

setting text box value

Posted: Wed Aug 24, 2011 10:43 pm
by chunkylover53
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

Re: setting text box value

Posted: Wed Aug 24, 2011 10:53 pm
by Ciege
I would issue a click on the InputTags then type the name and password in rather than trying to set the value.

Re: setting text box value

Posted: Thu Aug 25, 2011 10:06 am
by Todor
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.

Re: setting text box value

Posted: Thu Aug 25, 2011 9:30 pm
by chunkylover53
Hi,
I tried click(), click(new location()), and performclick().
None of them worked. Does it matter that these login controls might be silverlight?

Re: setting text box value

Posted: Fri Aug 26, 2011 9:45 am
by Todor
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 :)