'How to choose time of hold-click on button on Cypress?
I need to press on the button and hold it for about 10 sec. How can I do this?
I used this construction, but it doesn't work as I need:
button1.eq(2).click({ release:false} );
Solution 1:[1]
I think you need to use cy.trigger
, I'm not sure click
has that that option. You could do something like:
cy.get([your element]).trigger('mousedown')
cy.wait(3000)
cy.get([your element]).trigger('mouseleave')
That would hold the click for three seconds. I'm not a fan of cy.wait
(as the docs say, there is usually a batter way to do things!) but I think it's use is justified here.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Simon D |