在VB.NET中单击href链接

时间:2015-09-27 05:38:21

标签: html vb.net webbrowser-control

如何使用VB.NET webbrowser点击此链接?

<li class="r"><a href="/nfx/basic/handle_action/?context_str=%7B%22breadcrumbs%22%3A%5B%5D%2C%22story_location%22%3A%22profile_someone_else%22%2C%22confirm_actions%22%3Afalse%2C%22is_from_feed_tombstone%22%3Afalse%2C%22actions_taken%22%3A%22%22%2C%22reportable_ent_token%22%3A%22100009299563743%22%2C%22is_impostor%22%3A%22%22%7D&amp;is_direct=1&amp;action_key=RESOLVE_PROBLEM&amp;redirect_uri=%2Fprofile.php%3Fid%3D100009299563743&amp;ext=1443590401&amp;hash=AeRKfkCXTvlGpyyP">Denunciar este perfil</a></li>

我尝试过这样的事情,但没有工作:

  Dim elements As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("a")
         For Each pElem As HtmlElement In elements
             If (pElem.OuterHtml.Contains("profile.php")) Then
                 pElem.InvokeMember("click")
             End If
         Next

1 个答案:

答案 0 :(得分:0)

我通过将webbrowser.navigate放在不同的计时器上并添加间隔来解决它。