FVIAH
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(objec t sender, EventArgs e)
{
HtmlDocument doc = webBrowser1.Document;
HtmlElement nameElement = doc.GetElementById("tb");
HtmlElement passElement = doc.GetElementById("tbxPas s");
HtmlElement buttonElement = doc.GetElementById("btnLog In");
nameElement.InnerText = "XXXXXX";
passElement.InnerText = "XXXXXX";
}
private void atgLoginButton_Click(objec
{
HtmlDocument doc = webBrowser1.Document;
HtmlElement nameElement = doc.GetElementById("tb");
HtmlElement passElement = doc.GetElementById("tbxPas
HtmlElement buttonElement = doc.GetElementById("btnLog
nameElement.InnerText = "XXXXXX";
passElement.InnerText = "XXXXXX";
}
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Found solution
example
doc.GetElementById("your button id").Click();