Click here to Skip to main content
15,938,578 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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
Updated 19-Jul-22 5:33am

1 solution

Have you managed to find a solution?
Share this answer
Richard Deeming 19-Jul-22 11:55am    
If you want to ask for more information, click the "Have a Question or Comment?" button under the question and post a comment.

Do not post your comment as a "solution" to the question.

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

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900