我希望page.evaluate在我的onLoadFinished完成时运行。但是以下错误即将来临 消息:ReferenceError:找不到变量:page
我的代码是:
page.property('onLoadFinished', function(status) {
if(status==="success")
{
try{
console.log('==== onLoadFinished()'+status);
page.evaluate(function () {
console.log("++++++++++++++++++"+document);
var Import = document.getElementById("Import");
if (Import){
console.log("+"+Import);
document.getElementById("start").value = "somedate";
document.getElementById("Import").click();
}else{console.log("Import not found");}
})
}catch(ex){
var fullMessage = "\nJAVASCRIPT EXCEPTION";
fullMessage += "\nMESSAGE: " + ex.toString();
for (var p in ex) {
fullMessage += "\n" + p.toUpperCase() + ": " + ex[p];
}
console.log(fullMessage);
}
}
})