0

How to get a list of disabled elements on a page using Cypress?

Thanks in advance.

2 Answers 2

1

A disabled html element has disabled attribute, e.g.:

<input type="text" id="name" name="name" disabled>

to find such elements in Cypress could be achieved with .get() command:

cy
  .get('[disabled]')
2
  • Thank you for your reply, but web elements does not have disabled property. then how to get list of disabled elements?
    – Rao Thota
    Sep 18, 2021 at 8:34
  • @RaoThota Then you need to update your question and tell us more. Find out how those disabled elements differ and then go write a selector for them.
    – pavelsaman
    Sep 18, 2021 at 16:13
0
cy.get("#name").should('have.attr', 'disabled');
1
  • 2
    Hi, and welcome to SQA stack exchange. Could you please edit your answer to explain how your answer improves on the existing answer?
    – Kate Paulk
    Nov 1, 2023 at 15:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.