如何在VB中单击此按钮?

时间:2014-04-07 10:50:15

标签: .net vb.net winforms webbrowser-control

这是按钮元素:

<input type="image" class="btnClaim" src="http://cdn1.swagbucks.com/content/results/images/btnClaimPrize.png" onclick="sb_vd.capSubmit();">

我已尝试过此代码:

 Dim allelements As HtmlElementCollection = WebBrowser1.Document.All
                        For Each element As HtmlElement In allelements
                            If element.GetAttribute("class") = "btnClaim" Then
                                element.InvokeMember("click")

但它没有点击按钮。如何以编程方式单击此按钮?

1 个答案:

答案 0 :(得分:0)

可以使用javascript

  window.onload=function()
  {
   img_click();
  }
  function img_click()
  {
    //do the code
  }