我遇到了问题:
2017-02-18T20:19:16 [DEBUG] WebPage - evaluateJavaScript“(function(){return(function(){\ n var ev = document.createEvent(\”MouseEvents \“); \ n ev。 initEvent(\“click \”,true,true); \ n \ n document.querySelector(\“#jeje \”)。dispatchEvent(ev); \ n})();})()“
2017-02-18T20:19:16 [DEBUG] WebPage - updateLoadingProgress:10
2017-02-18T20:19:16 [DEBUG] WebPage - evaluateJavaScript结果QVariant(无效)
代码JS:
page.open(address, settings, function(status) {
// Check for page load success
page.includeJs("http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js", function() {
if (status !== "success") {
console.log("==================Unable to access network==================");
} else {
// Wait for element to be visible
waitFor(function() {
// Check in the page if a specific element is now visible
return page.evaluate(function() {
return $("body").is(":visible");
});
}, function() {
console.log("==================The element should be visible now.==================");
page.evaluate(function() {
var ev = document.createEvent("MouseEvents");
ev.initEvent("click", true, true);
document.querySelector("#jeje").dispatchEvent(ev);
})
page.render(output);
phantom.exit();
});
}
})
});
我不明白这个问题。有人能帮助我吗?
谢谢