lundi 30 novembre 2015

Entering text in website textbox using c#

I am trying to automate fill the textbox of a website in c# and i used:

 private void button1_Click(object sender, EventArgs e)
    {
        System.Windows.Forms.WebBrowser webBrowser = new WebBrowser();
        HtmlDocument document = null;
        document=webBrowser.Document;
        System.Diagnostics.Process.Start("http://www.google.co.in");

        document.GetElementById("lst-ib").SetAttribute("value", "ss");
    }

I am getting An unhandled exception of type 'System.NullReferenceException' and the compiler is not processing the last line of the code. I have also tried innertext instead of setAttribute. I am using console application.




Aucun commentaire:

Enregistrer un commentaire