Disabled button

Command cy.click automatically waits for the element to be enabled before clicking.

📺 Watch this example in the video A Cypress Example With Disabled Button And Has Text jQuery Selectorsopen in new window.

<div>
  <label>My button</label>
  <button disabled>Click</button>
</div>
<script>
  setTimeout(() => {
    document
      .querySelector('div button')
      .removeAttribute('disabled')
  }, 1000)
</script>
cy.get('div')
  .find('button')
  // this assertion is optional
  // .should('not.be.disabled')
  .click()