Click here to Skip to main content
14,302,135 members
Rate this:
Please Sign up or sign in to vote.
Im trying to set a value to a textbox and i have found the HtmlElemnt i need and changed the value of the text box but it seems like the element won't update himself or trigger some lind mof userinput method. the web will say "You must fill this before you can finish" even when you can clearly see the text written there. the problem can be solved with a bit of a weird trick like :

           SendKeys.SendWait("  ");

but that won't work when the webbrowser control is invisible. here is the code :

HtmlElement Elem = webBrowser.Document.GetElementById("inputSession");
 Elem.SetAttribute("value" , "TEST ");
 HtmlElementCollection elements= webBrowser.Document.GetElementsByTagName("button");
 HtmlElement  EnterButton = elements[0];

here is the html code of the textBox:

<input id="inputSession" ios7fix="" class="username ng-valid ng-touched ng-dirty ng-valid-parse ng-not-empty" ng-class="{invalid: !gamePinValid}" placeholder="Game PIN" ng-model="gameId" type="tel" shake="badGameId" data-functional-selector="game-pin-input" aria-label="Game pin" ng-change="gameIdChanged()" ng-focus="gameIdFocused()" ng-blur="gameIdUnfocused()">

anyone know how would I be able to trigger / update this elements userinput methods ?

im using the WebBrowser control of winforms.

What I have tried:

already tried changing the class from
username ng-valid ng-touched ng-dirty ng-valid-parse ng-empty

username ng-valid ng-touched ng-dirty ng-valid-parse ng-not-empty

(It Changes when the user type something in the text box )
but it didn't do anything...

and the SendKeys.sendWait() + the HtmlElement.Focus() trick that did work perfectly when the browser was visble but i need the browser to be invisble

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100