WebBrowser 控件通过 Id 删除或隐藏元素
WebBrowser Control Delete or Hide Element by Id
我为一些无线路由器设备的支持用户制作了自动登录应用程序,一切正常,但我想隐藏一些选项我得到了所有元素 ID,但不知道如何隐藏或禁用这些元素。
Private Sub WebBrowser1_DocumentCompleted(sender As Object, e As WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
WebBrowser1.Document.GetElementById("username").InnerText = "suport"
WebBrowser1.Document.GetElementById("password").InnerText = "0123432"
WebBrowser1.Document.Forms(0).InvokeMember("submit")
'Dim doc1 = WebBrowser1.Document
If e.Url.ToString() = "http://" + lbBrowserIP.Text + ":8900/link.cgi" Then
WebBrowser1.Document.GetElementById("_wpa_key_t") "I want to disable or hide this Element"
End If
End Sub
获取元素后执行以下操作:
Dim ele = WebBrowser1.Document.GetElementById("_wpa_key_t") ;
If ele IsNot Nothing Then
ele.Style = "Display:none"
End If
希望支持你的问题
我为一些无线路由器设备的支持用户制作了自动登录应用程序,一切正常,但我想隐藏一些选项我得到了所有元素 ID,但不知道如何隐藏或禁用这些元素。
Private Sub WebBrowser1_DocumentCompleted(sender As Object, e As WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
WebBrowser1.Document.GetElementById("username").InnerText = "suport"
WebBrowser1.Document.GetElementById("password").InnerText = "0123432"
WebBrowser1.Document.Forms(0).InvokeMember("submit")
'Dim doc1 = WebBrowser1.Document
If e.Url.ToString() = "http://" + lbBrowserIP.Text + ":8900/link.cgi" Then
WebBrowser1.Document.GetElementById("_wpa_key_t") "I want to disable or hide this Element"
End If
End Sub
获取元素后执行以下操作:
Dim ele = WebBrowser1.Document.GetElementById("_wpa_key_t") ;
If ele IsNot Nothing Then
ele.Style = "Display:none"
End If
希望支持你的问题