I would like to read this last year. I also tried to integrate or "inject" jQuery into the Windows Scripting host environment. Also tried Powershell. No one worked. However, I managed to use this "InternetExplorer.Application" object with IE7, IE8, and now IE9.
try{ var ie = new ActiveXObject("InternetExplorer.Application"); ie.navigate(url); ie.visible = false; ie.left=800; ie.top=0; ie.height=600; ie.width=900; //use this with ie.visible = true; do{} while (ie.busy); } catch (e){ console.log("Exception thrown: "+e) } finally { IE_waitLoad(ie); var webpage=ie.document.body.innerHTML ; $("#cache").append($(webpage)); ie.quit(); }
After that, jQuery is your friend. Yet again!!!
I found this nice wait function somewhere on the web:
function IE_waitLoad(pIE) { var stat, dstart; stat = 0; while(true){ if(stat == 0) { if(!pIE.Busy){ if(pIE.Document.readyState == "complete") { dstart = new Date().getTime(); stat = 1; } } }else{ if(!pIE.Busy && pIE.Document.readyState == "complete") { if(new Date().getTime() >= dstart + 1000){ break; } }else{ stat = 0; } } sleep(1000) } }
The navigation function has all of these optional parameters.
source share