Reputation: 53
I'm trying to hover over a button in Cypress and for that I've tried to use trigger('mouseover') but it is not working for me. Any suggestions?
it('hovering over button', () => {
cy.visit("http://www.qaclickacademy.com/practice.php");
cy.get('#mousehover').trigger('mouseover'); })
Upvotes: 2
Views: 3084
Reputation: 66
The answer above helped me to find the solution for me:
cy.get('.mouse-hover-content')
.should('be.hidden')
.invoke('css', 'visibility', 'visible')
Upvotes: 0
Reputation: 53
I've finally found a workaround for this. With the use of Invoke() method in my code I was able to hover over a button.
it('hovering over button', () => {
cy.visit("http://www.qaclickacademy.com/practice.php");
cy.get('.mouse-hover-content').should('be.hidden').invoke('show');
})
Upvotes: 1