0
  1. This is the code of the website :

    function checkSubmit(e)
    {
       if(e && e.keyCode == 13)
       {
          document.frmLogin.submit();
       }
    }
    <div class="enterButton" onclick="document.frmLogin.submit()">Sign in</div>
    
  2. This is what I tried in c# :

    HtmlElementCollection elc1 = webBrowser1.Document.GetElementsByTagName("div");
    foreach (HtmlElement element in elc1)
    {
        if (element.GetAttribute("InnerHtml").Equals("<DIV onclick=document.frmLogin.submit() class=enterButton>Sign in</DIV>"))
        {
            element.InvokeMember("submit()");
        }
    }
    
  3. The foreach is working and the if statement is working when it gets to the InvokeMember nothing happens.

Heretic Monkey
  • 11,687
  • 7
  • 53
  • 122
Nathan
  • 26
  • 4

2 Answers2

0

Sorry for the trouble I just was at the wrong element:

if (element.GetAttribute("InnerHtml").Equals("Sign in"))
{
element.InvokeMember("click");
}

now it works....

Nathan
  • 26
  • 4
-1

Try the Invoke member method without the brackets.

 element.InvokeMember("submit");