Initially I used below code for clicking many input tags in a webpage.
HtmlElementCollection inputtags = webBrowser1.Document.GetElementsByTagName("input");
foreach (HtmlElement inputtag in inputtags)
{
inputtag.InvokeMember("click");
}
The above code works only for the first input box. It didn't work for remaining input tags.
After changing the code as below it started working for all input tags.
HtmlElementCollection inputtags = webBrowser1.Document.GetElementsByTagName("input");
int tagcount=inputtags.Count;
int loopvar=0;
while (loopvar < tagcount)
{
webBrowser1.Document.GetElementsByTagName("input")[loopvar].InvokeMember("click");
loopvar++;
}
More Articles...
No comments:
Post a Comment