المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : set values programatically in a html input element



C# Programming
08-01-2009, 06:50 AM
hi, i m creating a bot for a browser game.

what i want do to is to enter the login page, fill username and password input box and press a submit button
(my application has a webbrowser object were i can check the bot´s work)

how can i do it in code?



WebBrowser_Main.Navigate("the_web_site");

HTMLDocument page = new HTMLDocumentClass();
page = (HTMLDocument) WebBrowser_Main.Document;

HtmlInputElement user = this.WebBrowser_Main.Document.All["user"];
user.SetAttribute("value", "my_username");

HtmlInputElement pass = this.WebBrowser_Main.Document.All["password"];
user.SetAttribute("value", "my_password");

HTMLInputElement btlogin = (HTMLInputElement)myDoc.all.item("btlogin", 0);
btlogin.click();




error message
Cannot convert type 'System.Windows.Forms.HtmlDocument' to 'mshtml.HTMLDocument'


it works with AxSHDocVw.AxWebBrowser but not with System.Windows.Forms.WebBrowser

nelsonpaixao@yahoo.com.br

trying to help & get help