I'm making an Windows Form Application in C# with Visual Studio 2010.
What I want to do, is to go to an page with the webbrowser control, and then insert an value in an input box, and submit the form.
The navigating part isn't that hard, and is already handled. But i can't get the text inserting working...
The problem is that the input doesn't have in ID, only the name.
In JQuery the code will looks like this:
$('input[name="searchstring"]').val("hoi");
But how would that look in C# code? (or combi of C# and Javascript / Jquery)
I already have this code:
HtmlElementCollection playerSearchBox = webBrowserSearchPlayer.Document.GetElementsByTagName("searchstring");
playerSearchBox[0].InnerText = "hoi";
The error that I get with that C# code is as follow:
Value '0' is not valid for 'index'. 'index' should be between 0 and -1. parameters name: index
<searchstring>tag.HtmlElementCollection playerSearchBox = webBrowserSearchPlayer.Document.GetElementsByTagName("input"); playerSearchBox[2].InnerText = "hoi";