简体   繁体   中英

Bug when I press the button with invokemember () Webbrowser

If I enter the credentials in a login and I manually press the button it makes me access the site without problems, otherwise if I use the method InvokeMember ("click");

It tells me incorrect credentials, even if they are right.

Example

webBrowser1.Document.GetElementById("").InvokeMember("click");
HtmlElementCollection elc = this.webBrowser1.Document.GetElementsByTagName("input");
foreach (HtmlElement el in elc)
{
    if (el.GetAttribute("type").Equals("submit"))
    {
        el.InvokeMember("onclick");

    }
}

I wait for the access to be done correctly, like when I press the button manually, even entering the credentials with GetElementById

Try this

First, get the submit button if you have ID. Then check whether it is exit or not

HtmlElement htmlElement = automationWebBrowser.Document.GetElementById("submitBtnRight");
if (htmlElement != null)
{
  htmlElement.InvokeMember("click");
}

If possible post your button HTML

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM