0

Hi;
I have a problem with webbrowser control. Code runs ok till it gets to
HtmlElement submit line where it returns a null error message
Object reference not set to an instance of an object.
The code works fine with the first element but not the second.
I would also like to save the website when the submit button is clicked.
Any help most welcome.
Thank you

private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            HtmlElement dropdown = this.wb.Document.All["ctl05_ddlGroupSelector"];
            dropdown.SetAttribute("selectedIndex", "1");
            HtmlElement submit = this.wb.Document.All["ct105_1bSubmit"];
            submit.InvokeMember("click");
        }

Edited by mike_2000_17: Fixed formatting

1
Contributor
1
Reply
2
Views
6 Years
Discussion Span
Last Post by valter
0

I have made some progress since asking this question. There is nothing wrong with the code, but the button on the website is in javascript.

<td><a id="ctl05_lbSubmit" class="submit-btn redbtn dark" href="javascript:__doPostBack('ctl05$lbSubmit','')"><span>Submit</span></a></td>


So my question now is how do I do a
wb.Document.InvokeScript( );
function for the data above.

Thanks

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.