Javascript 在CasperJS中移动鼠标触发悬停事件
我不明白,为什么Javascript 在CasperJS中移动鼠标触发悬停事件,javascript,phantomjs,casperjs,mousehover,Javascript,Phantomjs,Casperjs,Mousehover,我不明白,为什么mouse::move()不起作用。例如,关于 如您所见,共有10个元素,在每张图片上移动鼠标光标后,您将看到详细信息。我有一组每个元素的id。我想在每个元素上移动光标,然后选择器“div#hover_item_descriptors”将被更新,我将使用它。这是我的密码: this.eachThen(ids, function(resp){ var id = resp.data; this.then(function(){ this.mouse.move('sp
mouse::move()
不起作用。例如,关于
如您所见,共有10个元素,在每张图片上移动鼠标光标后,您将看到详细信息。我有一组每个元素的id。我想在每个元素上移动光标,然后选择器“div#hover_item_descriptors”将被更新,我将使用它。这是我的密码:
this.eachThen(ids, function(resp){
var id = resp.data;
this.then(function(){
this.mouse.move('span#' + id + '_name'); //moving at the name of element
});
this.waitUntilVisible('div#hover_item_descriptors div#sticker_info', function(){
// it`s never work, because moving doesn't work
});
});
为什么它不起作用呢?我也曾在这个问题上绊倒过,多亏了这个问题: 结果表明,如果将光标悬停在视口中不存在的元素上,则“悬停事件”将不起作用 因此,要使其工作,请设置保证超过页面高度的视口高度,例如:
var casper = require('casper').create({
viewportSize : { width: 1280, height: 5000 }
});