c# - Get the latest html after ajax call in webbrowser control? -
there lot of kind of questions , not able find solution problem.
i have webpage , after webpage loads ajax called , load table data may takes 2 seconds.
i want data inside table.
when try access table using document text not have table html. still have initial html has loaded before ajax call.
webbrowser1.update(); //didn't work
then tried didn't work
private void timer_tick(object sender, eventargs e) //interval of 5000 { if (webbrowser1.readystate == webbrowserreadystate.complete) { htmlelement element = webbrowser1.document.getelementbyid("tabletype3"); if (element != null) { string webbrowsercontent = element.innerhtml; timer.stop(); } } }
then tried didn't work
private void waittillpageloadscompletly(webbrowser webbrcontrol) { webbrowserreadystate loadstatus; int waittime = 20000; int counter = 0; while (true) { loadstatus = webbrcontrol.readystate; application.doevents(); if ((counter > waittime) || (loadstatus == webbrowserreadystate.uninitialized) || (loadstatus == webbrowserreadystate.loading) || (loadstatus == webbrowserreadystate.interactive)) { break; } counter++; } counter = 0; while (true) { loadstatus = webbrcontrol.readystate; application.doevents(); if (loadstatus == webbrowserreadystate.complete && webbrcontrol.isbusy != true) { break; } counter++; } }
in debugging saw table contents in webbrowser1.document.nativehtmldocument2 cant accessed because of internal class.
is there other way solve problem.
i used openwebkitsharp solved problem html content rendered js. if can change library, go link check solution: get final html content after javascript finished open webkit sharp
Comments
Post a Comment