InvokeMember("click") webBrowser help
- by Tom
I am trying to automate a web page via the weBrowser and the button that i'm trying to click has no ID only a value. here's the html code for it:
Accept
I can't useGetElementById as the button has no ID.
If I do
HtmlElement goButton = this.webBrowser1.Document.All["Accept"];
goButton.InvokeMember("click");
My script stops showing a nullreference error highlighting the "goButton.InvokeMember("click");"
If I do
var inputControls = (from HtmlElement element in webBrowser1.Document.GetElementsByTagName("input") select element).ToList();
HtmlElement submitButton = inputControls.First(x = x.Name == "Accept");
My script give me an "Sequence contains no matching element" error at the "HtmlElement submitButton" line
and sometimes the page has more than one of these Accept buttons, so I would need to be able to tell the difference between each one as well or at least be able to click on one without the script breaking
Any help with this will be greatly appreciated