我在用Capybara + Poltergeist抓取仪表板时看到了此错误。我已经尝试了其他帖子中建议的选项,但是还不能使用。
function anim(element, animationName, callback) {
const node = document.querySelector(element)
node.classList.add('animated', animationName)
function handleAnimationEnd() {
node.classList.remove('animated', animationName)
node.removeEventListener('animationend', handleAnimationEnd)
if (typeof callback === 'function') callback()
}
node.addEventListener('animationend', handleAnimationEnd)
}
我尝试过的选项
Firing a click at co-ordinates [1571.5, 584] failed. Poltergeist detected another element with CSS selector 'html body div#app div.layout div div.dashboard div.dashboard-content div.monitor div.fixed.loading.show' at this position. It may be overlapping the element you are trying to interact with. If you don't care about overlapping elements, try using node.trigger('click').
Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new(app, window_size: [1600, 1200])
end
代替trigger("click")
。这不会引发错误,但是无法获得正确的html响应。 有人可以给我一些建议吗?