I've been trying to login to a site using a WebBrowser control automatically by using the GetElementByTag / GetElemenByName methods but with not much success. (WFA - C#)
I believe the main reason is the fact that the site is in JavaScript.
I've done some research and found two methods:
- by mimicking the site login form I could use something called POST. (or something of that sort)
- inject a javascript input to all the input fields in the site
I have no idea how to approach this problem, and due to my total lack of experience with javaScript or any web based programing, I could realy use any advice or solution for the matter at hand.
/** EDIT 1 thank you for your quick response. ive tried to use your code and still facing the same exception throw..
here is the code : (I trimmed it a bit)
public WorkerClass(string url)
{
webBrowser1 = new WebBrowser();
webBrowser1.Navigate(url);
webBrowser1.Document.GetElementById("c_Username").InnerText = "?????";
webBrowser1.Document.GetElementById("c_Password").InnerText = "?????";
}
and I get a "System.NullReferenceExeption" on the username line above.
the site im trying to access is - "http://www.gool.co.il"...maybe my approach is wrong?!