Web button click problem

MisterNick

Registered Member
Joined
Oct 22, 2014
Messages
80
Reaction score
61
Hello guys,

So, i'm trying to make a login software and when i try to enter the login information and click at "Submit" the software or idk what exactly, clean the 'username' field and the website automatically says "enter the username"

here's my code:
HtmlDocument doc = browser.Document;
HtmlElement elem1 = doc.GetElementById("pepName");
elem1.Focus();
elem1.InnerText = "pep";

var buttons = browser.Document.GetElementsByTagName("button");

foreach (HtmlElement button in buttons)
{
if (button.InnerText == "Submit")
{
button.InvokeMember("Click");
}
}

any suggestion about how to make that problem disappear? or should i use something else?
 
Could be a script in the webpage that clears the input field.
 
what about Selenium? if i'd use it will it make any difference?
 
Selenium is a good add-on for any project to automate webpages using any browser like chrome, firefox or any headless browsers like phantomjs etc.

What about awesomium? i need something that can be inserted directly in my project. With Selenium i can only open the web browser right? but i need something to use directly in my project. Kinda change default IE browser with something better
 
Maybe it's not enough to focus element, maybe site also checks for keypresses or hover events, like google and fb do for example. Probably you need to send native key presses to focused field, or send synthetisized keypress events if you're working with headless browsers (it can get tricky).
 
Back
Top