How to call a Function in c#

Asked

Viewed 143 times

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 HTML of the page:

  1. <a title="Clique aqui para fazer o login" href="javascript:submitFunction()" </a>

If anyone can help me...

1 answer

2


You can call the submitForm() with the method InvokeScript

webBrowser1.Document.InvokeScript("submitForm");
  • 1

    It worked out Thank you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.