WPF Webbrowser Loop Through Html Elements And Submit
A question was raised on vbforums on how to invoke click a button using WPF webbrowser control. This sample loads google.com page and writes a sample text on the textbox and then invoking the click button. HTMLDocument document = (HTMLDocument)wbGetHost.Document; foreach (IHTMLElement myelem in document.getElementsByTagName( "input" )) { if (myelem.id != null ) { if (myelem.id.Equals( "lst-ib" ) && myelem.className.Equals( "lst lst-tbb" ) && !document.documentElement.innerHTML.ToLower().Contains( "wikipedia" )) { HTMLInputElement el = myelem as HTMLInputElement; el. value = "Bill Gates" ; HTMLInputElement searchButton = (HTMLInputElement)document.all.item( "btnK" , 0); searchButton.click(); break ; } } } Greg