hi
i have a problem with web browser.i want to open a website like google in web browser and
writing in search box and then search it.
i can open sites in web browser but i don't know how to fill textboxes and submit it.
thanks
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
AbolfazlPosted Jun 27, 2014, 2:56 AM
but i use web browser,i can navigate to site but i can't change elements value like text boxes.
i use this code to fill google text box and click on search button:
private void button1_Click(object sender, EventArgs e)
{
webBrowser1.Navigate("google.com");
webBrowser1.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(web_h);
}
private void web_h(object sender, WebBrowserDocumentCompletedEventArgs e)
{
WebBrowser b = (WebBrowser)sender;
b.Document.GetElementById("gbqfq").InnerText = "door";
b.Document.GetElementById("gbqfba").InvokeMember("click");
}
but i face with this error: System.NullReferenceException
Anupam SinghPosted Jun 27, 2014, 2:41 AM
this may help : http://www.c-sharpcorner.com/UploadFile/6897bc/using-webbrowser-control/