c# - 0x80070005 (E_ACCESSDENIED) while searching for htmlelement -


i'm trying find submit button on page , submit form using webbrowser , part of code keeps giving me

an unhandled exception of type 'system.unauthorizedaccessexception' occurred in system.windows.forms.dll  additional information: access denied. (exception hresult: 0x80070005 (e_accessdenied)) 

the code is:

     htmldocument pagehtml = this.webbrowser1.document;      htmlelementcollection page = pagehtml.all;                  foreach (htmlelement element in page)                 {                     if (element.getattribute("type") == "submit") //line highlighted during error                     {                         element.invokemember("click");                     }                 } 

not sure why doing found different way it

                htmlelementcollection page = webbrowser1.document.getelementsbytagname("input");                 foreach (htmlelement element in page)                 {                     if (element.getattribute("value").contains("submit"))                     {                         element.invokemember("click");                     }                 } 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -