I am trying to enter information in to a login form on this site: http://www.clover.com/home/login
I am building a windows form App in VB.net, vs 2015, and using the WebBrowser control. I have the following code in my WB controls DocumentCompleted event:
Dim PWord As HtmlElement
PWord = wb.Document.GetElementById("password")
If PWord IsNot Nothing Then
PWord.InnerText = "password"
For the life of me, I can not determine why I can not find the "password" field (or Email field, login button, etc) on this page by their ID's. I get the fail message no matter which element's ID I try to use.
A little background: I am completely blind and use a screen reader (jaws for windows) to access my computer, so if I have royally screwed up this post (wrong section of the forums, incorrect use of link/code tags, etc) I greatly apologize.
It looks like that site loads data asynchronously after the initial page load. The workaround would be to have a timer that gets enabled in your DocumentCompleted event. The tick handler should be your current code. Three seconds seems to be enough of an interval:
Private Sub wb_DocumentCompleted(sender As Object, e As WebBrowserDocumentCompletedEventArgs) Handles wb.DocumentCompleted Timer1.Start() End Sub Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick Dim PWord As HtmlElement = wb.Document.GetElementById("password") If PWord IsNot Nothing Then PWord.InnerText = "password" Else MsgBox("fail..Again!") End If Timer1.Stop() End Sub