Link to home
Create AccountLog in
Avatar of FVIAH
FVIAHFlag for United States of America

asked on

Automating an embedded browser

I have an embedded browser application that is in development to log users into known websites. I have the name and the password fields filling out ok, but I need to submit the form from there by either automatically clicking the submit button or having the application submit the form to continue.  Below is my current code. I tried converting the HTMLelement to a Button but it is not allowed.




        private void atgLoginButton_Click(object sender, EventArgs e)
        {

            HtmlDocument doc = webBrowser1.Document;

            HtmlElement nameElement = doc.GetElementById("tb");
            HtmlElement passElement = doc.GetElementById("tbxPass");
            HtmlElement buttonElement = doc.GetElementById("btnLogIn");

            nameElement.InnerText = "XXXXXX";
            passElement.InnerText = "XXXXXX";
 
        }
Avatar of Kamal Khaleefa
Kamal Khaleefa
Flag of Kuwait image

add a javascript code to do the click

example

doc.GetElementById("your button id").Click();
ASKER CERTIFIED SOLUTION
Avatar of FVIAH
FVIAH
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of FVIAH

ASKER

Found solution