# Stub window.print
You can find this recipe shown in the video Stub window.print Method (opens new window).
# App calls the window.print
method
cy.window().then((w) => {
cy.stub(w, 'print').as('print')
})
cy.get('#print').click()
cy.get('@print').should('be.calledOnce')
# Onclick button attribute
cy.window().then((w) => {
cy.stub(w, 'print').as('print')
})
cy.get('#print').click()
cy.get('@print').should('be.calledOnce')