Miccroft
Miccroft

Reputation: 1

TypeText is typing wrong

I'm having trouble typing a string in a input text. In some input texts it works perfectly but in others it doesn't.

For example a string has the value "master", but the result in the page is like "mastrer"

code:

    private void login(object sender, EventArgs e)
    {
        WatiN.Core.IE browser = new WatiN.Core.IE();
        browser.GoTo("http://184.10.01.30/lgggo");
        browser.TextField(Find.ById("igtxttxtUsuario")).TypeText("master");
        browser.TextField(Find.ById("igtxttxtSenha")).TypeText("master");
        browser.Element(Find.ById("btnEntrar")).Click();
    }

page:

input name="txtUsuario" id="txtUsuario" type="hidden" value="mastrer"

input name="txtUsuario_p" id="txtUsuario_p" type="hidden" value="mastrer"

input class="splashInput" id="igtxttxtUsuario" style="width: 239px;" type="text" Object="[object Object]" _old="true" editID="txtUsuario" value="mastrer"

input name="txtSenha" id="txtSenha" type="hidden" value="mastrer"/>

input name="txtSenha_p" id="txtSenha_p" type="hidden" value="mastrer"/>

input class="splashInput" id="igtxttxtSenha" style="width: 215px;" type="password" Object="[object Object]" _old="true" editID="txtSenha" value="mastrer"

While debugging I see the application mysteriously backing a position and putting that "r" between "t" and "e" which doen't exist.

Does anybody have any suggestion?

Upvotes: 0

Views: 179

Answers (1)

alonp
alonp

Reputation: 1337

Try to use set attribute to a value...

browser.TextField(Find.ById("igtxttxtUsuario")).SetAttributeValue("value", "master");

This should work

Upvotes: 0

Related Questions