0

我正在尝试为 Adnooka 获取余额检查器,但我什至无法通过登录。这是HTML:

        </div>
          <div class="control-group row-fluid">
          <label class="row-fluid " for="inputPassword">Password <div class="pull-right"><a class="muted"><small><a href='http://adnooka.com/recover'>Forgot your password ?</a></small></a></div></label>
          <div class="controls row-fluid input-append">
            <input type="password" id="inputPassword" placeholder="Password"  name="password" class="row-fluid" value=""> <span class="add-on"><i class="icon-lock"></i></span>
          </div>
        </div>
        <div class="control-group row-fluid fluid">
          <div class="controls span6">
          </div>
          <div class="controls span5 offset1" style=''>
            <button type='submit' class="btn btn-default" style='float:right'>Login<i class="gicon-chevron-right"></i></a>
          </div>
        </div>

但是按钮没有ID或名称,我该如何点击它?如何返回余额的值?

这是我到目前为止所得到的:

    WebBrowser1.Document.GetElementById("email").SetAttribute("value", textbox1.Text)
    WebBrowser1.Document.GetElementById("password").SetAttribute("value", pass.Text)
    Dim allelements As HtmlElementCollection = WebBrowser1.Document.All

    For Each webpageelement As HtmlElement In allelements

        If webpageelement.GetAttribute("type") = "submit" Then

            webpageelement.InvokeMember("click")

        End If

    Next

End Sub

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    WebBrowser1.Navigate("http://adnooka.com/login")
End Sub
4

1 回答 1

0

您可以在表单本身上调用 a submit,而不必找到要单击的按钮。

如果页面上只有一个表单,这应该可以工作。如果没有,请将 [0] 调整为所需的值:

WebBrowser1.Document.Forms[0].InvokeMember("submit")

有关详细信息,请参阅http://msdn.microsoft.com/en-us/library/system.windows.forms.htmldocument.forms.aspx 。

于 2013-08-28T18:17:27.267 回答