How To set “Textbox” value in Gecko Browser?

2020-07-29 17:22发布

if its Source name="login" then how can i set User Name Value Source Html For userbname textbox:

2条回答
手持菜刀,她持情操
2楼-- · 2020-07-29 17:50

Its simple in GeckoBrowser. Following two lines will set the Textbox value:

GeckoInputElement txtbox = new GeckoInputElement(geckobrowser1.Document.GetElementByName("login").DomObject);
txtbox.Value = "Your string";
查看更多
ら.Afraid
3楼-- · 2020-07-29 17:56

Gecko is not that different with IE . try this way

{
    HtmlElementCollection elements = Geckowebbrowser1.Document.GetElementsByTagName("input");
    elements(1).SetAttribute("value", USERBOX.Text);
    elements(2).SetAttribute("value", PASSBOX.Text);
    elements(3).InvokeMember("Click");
}
查看更多
登录 后发表回答