I’ve been trying to fill some inputboxes with data using the following code:
GeckoHtmlElement checkElement = null;
GeckoDocument checkDoc = GeckowebBrowser.Window.Document;
checkElement = checkDoc.GetHtmlElementById("username");
if (checkElement!=null)
{
checkElement.InnerHtml = username;
}
The above code finds the correct element and sets InnerHtml to ‘username’ but I get nothing on the screen. Using breakpoints I confirmed that the InnerHtml was changed according to the plan. I also tried changing .TextContent (instead of .InnerHtml) but the result was the same. The Html code goes like this:
<input id="username" class="inputboxclass" type="text" name="myusername">
I use C# winforms .NET 4.5 and geckoFX 16 (XulRunner 16).
Edit: Here is the code that works (thanks to RENE Victor’s suggestion)
checkElement.SetAttribute("value", username);
Put this code in a standalone text file and open it in a browser:
As you see you want to modify the vale, not the InnerHtml.