How To set “Textbox” value in Gecko Browser?

2020-07-29 17:20发布

问题:

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

回答1:

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");
}


回答2:

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";