T
T
TechNOIR2018-05-20 00:07:19
C++ / C#
TechNOIR, 2018-05-20 00:07:19

C#. How to get a link when clicking on an object in WebBrowser?

Good afternoon.
I go to the site in WebBrowser. The site has links, buttons, etc.
I want to click on them and get their link. How can I do that? What kind of event?
thanks in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem, 2018-05-20
@TechNOIR

HtmlElementCollection links = webBrowser1.Document.GetElementsByTagName("a");

foreach (HtmlElement link in links)
{
  if (link.OuterHtml.ToString().Contains("pgmiImageLink"))
    link.InvokeMember("click");
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question