0
由于某些原因,querySelector和get元素按类在元素上返回null。PhantomJS/SlimerJS通过document.querySelector()找不到元素
PhantomJS/SlimerJS
page.open('file:///Users/yeahsame/Desktop/index.html', function(status)
{
console.log("Starting execution");
document.querySelector("input")[0].value = "not working whatsoever";
phantom.exit();
});
HTML:在slimerjs回报
<!doctype html>
<body>
<input class="form-control email input-lg"></input>
<button class="btn" onclick="location.href='notexist.html'">submit</button>
</body>
运行 “document.querySelector(...)为空”