c# - Waiting for WebBrowser ajax content -
c# - Waiting for WebBrowser ajax content -
i want pause execution of thread until particular div has been loaded via ajax webbrowser instance. can continuously check presence of div doing like:
while (browser.document.getelementbyid("divid") == null) { thread.sleep(200); } however, sleeping thread browser in between loops blocks browser loading content in first place. seems, therefore, need execute browser.navigate method in separate thread - can go on check/wait presence of div whilst webbrowser instance continues loading url asked to.
my attempts @ this, however, have failed , i'd value input on how should go this. thought dispatching new thread new thread(() => { browser.navigate(url); }); work after doing so, nil loads , browser.readystate remains 'uninitialized'. presume i'm misunderstanding how go threading procedures c# , value advice!
don't block main thread's message pump. since browser sta component, xmlhttprequest won't able raise events background thread if block message pump. can't navigate in background thread. windows forms wrapper of webbrowser activex not back upwards access other threads ui thread. utilize timer instead.
c# .net multithreading browser
Comments
Post a Comment