i'm using the mshtml.tlb for loading/parsing html and i'd like extend it for clicking elements by code. the problem is trapping the loading-process after eg. a button was clicked. in my specific case i'd like to perform a user-login.
here's my code:
Dim WithEvents m_doc As HTMLDocument
' load page
Set m_docNU = New HTMLDocument
Set开发者_JAVA百科 m_doc = m_docNU.createDocumentFromUrl(m_url, vbNullString)
Do While m_doc.readyState = "loading" Or m_doc.readyState = "interactive"
DoEvents
Loop
set txtUsername = m_doc.getElementById("username")
set txtPasswort = m_doc.getElementById("passwort")
set myButton = m_doc.getElementById("submit")
myButton.click
now here's the big question mark: how to continue vb6- like "wait until page is loaded"? i've tried as above using a do while-loop and checking the readyState, but for some reason the readyState doesn't change after clicking the button ..
any ideas?
thanks
ps: is there a more elegant way instead of the do while-loop? eg. using a progressbar?
use vb.net
wBrowser is a webbroser object
While wBrowser.ReadyState <> WebBrowserReadyState.Complete Application.DoEvents() End While
精彩评论