.net - How to detect if there is running Javascript in an VB.NET WebBrowser-object -
the situation:
using vb.net framework 3.5 , visual studio 2005 crated project uses webbrowser object in working thrat. breaking down basics, looks like:
dim bwbcompleteddocument boolean = false sub wbcompleteddocument(byval sender object, byval e system.windows.forms.webbrowserdocumentcompletedeventargs) bwbcompleteddocument = true end sub private sub form1_load(byval sender object, byval e system.eventargs)handles me.load dim th new system.threading.thread(addressof worker) th.setapartmentstate(threading.apartmentstate.sta) th.start() end sub sub worker() dim wb new webbrowser wb.scripterrorssuppressed = true addhandler wb.documentcompleted, addressof wbcompleteddocument wb.navigate("google.de") dim start date = while start.addseconds(20) > application.doevents() if (bwbcompleteddocument = true) , (wb.isbusy = false) , (wb.readystate = webbrowserreadystate.complete) exit end if loop if bwbcompleteddocument = false exit sub end if 'more code here end sub
there no gui of browser works fine. navigate page catch documentcompleted-event, check readystate , if isbuisy , go on code.
the problem
there sites start execute javascript-code when onload-event occurs. if proceed .net code after wb-object has loaded page, wb stops executing javascript.
the question
there way determine if there javascript running in webbrowser-object and/or wait finish?
if able add javascript page raise event signal .net application @ correct moment. or set status in javascript , have .net application poll it.
see: how handle javascript events via webbrowser control winforms
Comments
Post a Comment