Cypress · Method
cy.trigger
cy.trigger() dispatches a DOM event on an element, window, or document. Use it when an event handler needs an event that commands such as click() or type() do not fire.
Last updated
Syntax
.trigger(eventName)
.trigger(eventName, position)
.trigger(eventName, options)
.trigger(eventName, x, y)
.trigger(eventName, position, options)
.trigger(eventName, x, y, options)In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
cy.click()cy.type()cy.press()cy.hover()cy.viewport()cy.spy()