0

This is a "Sign in" image link.

<div class="inputCol">
    <a href="javascript:document.loginForm.submit()">
        <img tabindex="3" src="/sams/en_US/images/bt-signIn.gif" border="0" alt="Sign In">
    </a>
</div>

What should I replace "???????" with in the following code to get the link element of the Signin image link and use "invokemember" to click it?

private void button2_Click(object sender, EventArgs e)
{

    webBrowser1.Navigate("samsclub.com/sams/account/signin/login.jsp");
    while (webBrowser1.ReadyState != WebBrowserReadyState.Complete)
    {
        Application.DoEvents();
    }
    webBrowser1.Document.GetElementById("mail").SetAttribute("value", "myusername");
    webBrowser1.Document.GetElementById("pw").SetAttribute("value", "mypassword");
    webBrowser1.Document.GetElementById("???????").InvokeMember("Click");
}
Michael Petrotta
  • 59,888
  • 27
  • 145
  • 179
Barry
  • 33
  • 1
  • 6
  • You will probably need to invoke the javascript itself and not the button. Here is another topic that covers invoking javascript with the webbrowser object. http://stackoverflow.com/questions/1437251/calling-a-javascript-function-in-the-c-sharp-webbrowser-control – CraigW Apr 14 '12 at 02:47
  • Or if you can use GetDocumentByTagName and get the Form element and then invoke the submit method. – CraigW Apr 14 '12 at 02:48
  • can you elaborate or share some sample code please Craigw – Barry Apr 14 '12 at 03:14

0 Answers0