【问题标题】:How to simulate mouse wheel in Cypress?如何在 Cypress 中模拟鼠标滚轮?
【发布时间】:2021-11-16 16:07:29
【问题描述】:

我无法模拟鼠标滚轮。这段代码似乎什么也没做。

cy.get('#elId')
 .trigger('mousemove')
 .trigger('wheel', { deltaY: -10, force: true })

【问题讨论】:

  • 你想达到什么目的?
  • 除非有非常具体的原因,否则我不明白为什么您无法使用 scrollTo() 获得相同的结果
  • 我想模拟鼠标滚轮的移动。即使使用 scrollTo() 我什么也得不到

标签: cypress


【解决方案1】:
cy.get('#elId').trigger("wheel", { deltaY: -66.666666, wheelDelta: 120, wheelDeltaX: 0, wheelDeltaY: 120, bubbles: true})

试试上面的

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-10-16
    • 1970-01-01
    • 2017-09-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-18
    相关资源
    最近更新 更多