I am using axWebBrowser
to do some web automation.
When the system triggers the NewWindow2
event, it is unable to keep track of an HTML element in the new window. After debugging, I noticed that the axWebBrowser1.ReadyState
is equal to ReadyState_Complete
although the new window hasn't finished loading.
private void axWebBrowser1_DocumentComplete(object sender, AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e) {
if (axWebBrowser1.ReadyState == SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE) {
// some code...
}
}
How can I wait for the new window to finish loading so I can detect the HTML element in it?