Setting Value of an Input Tag in WebBrowser Control

前端 未结 1 927
天涯浪人
天涯浪人 2021-01-12 06:57

I am attempting to help a user log into their account using a custom WebBrowser control. I am trying to set the value of an input tag to the players username us

1条回答
  •  时光说笑
    2021-01-12 07:38

    webBrowser1.Document.GetElementById("navbar_username").InnerText ="Tester";
    webBrowser1.Document.GetElementById("navbar_password").InnerText = "xxxxxxxxxxx";
    
    foreach (HtmlElement HtmlElement1 in webBrowser1.Document.Body.All)
        {
        if (HtmlElement1.GetAttribute("value") == "Log in")
            {
            HtmlElement1.InvokeMember("click");
            break;
            }
        }
    

    you may find more here : http://deltahacker.gr/2011/08/15/ftiakste-to-diko-sas-robot/

    0 讨论(0)
提交回复
热议问题