How to call a javaScript Function in C #

0
var inputElements = webBrowser1.Document.GetElementsByTagName("input");
        foreach (HtmlElement i in inputElements){

            if(i.GetAttribute("name").Equals("user")){
                i.InnerText = "Teste";
            }

            if(i.GetAttribute("name").Equals("password")){

                i.Focus();
                i.InnerText = "1234";                   
            }               
        }

        var buttonElements = webBrowser1.Document.GetElementsByTagName("class");
        foreach (HtmlElement b in inputElements){

     if(b.GetAttribute("href").Equals("javascript:submitForm()")){      

                SendKeys.SendWait("click");
            }
        }

// Ex Page HTML:

  • <a title="Clique aqui para fazer o login" href="javascript:submitFunction()" </a>
  • If someone can help me ...

        
    asked by anonymous 29.03.2018 / 02:34

    1 answer

    2

    You can call submitForm() with method InvokeScript

    webBrowser1.Document.InvokeScript("submitForm");
    
        
    29.03.2018 / 02:42