I searched the internet and found examples for;
“How to click a button which is in a webBrowser(internet explorer) in C# ?”
And here is the code which is working on google;
JS :
void ClickButton(string attribute, string attName)
{
HtmlElementCollection col = webBrowser1.Document.GetElementsByTagName("input");
foreach (HtmlElement element in col)
{
if (element.GetAttribute(attribute).Equals(attName))
{
element.InvokeMember("click"); // Invoke the "Click" member of the button
}
}
}
But my webpage button has different tags. So the program can’t detect to click it.
My main question is; How to click this button programmatically ?
HTML :
<a class="orderContinue" href="Addresses" title="Sipar Ver">Sipar Devam</a>
Naturally the code you’ve posted won’t find the tag you’ve posted. It’s looking for tags of type
input:But as you say (and demonstrate):
Thus, you need to look for the tag(s) that you use. Something like this:
This would return the anchor elements within the document. Then, naturally, you need to find the specific one(s) you want to click. That’s what this line is doing:
Whether it finds the target tag(s) depends entirely on the values for those variables, which I assume you know and can manage.