Unable to Detect 'disabled' Attribute in <a /> Tag
See original GitHub issueCurrent behavior:
running cy.get().should(‘be.disabled’) on an will return false, even when attr exists.
Desired behavior:
should return true, when disabled. This works for <button /> tag.
Steps to reproduce: (app code and test code)
<a data-cy="test" disabled />
cy.get([data-cy=test]).should('be.disabled')
=> will fail
Versions
cypress@3.4.1 react@16.9.0
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
How to use the disabled attribute for a <a> tag in HTML
There is no disabled attribute like this (<a href="#" disabled>) for "a" tag. you can try disabling using css so just add class...
Read more >HTML attribute: disabled - HTML: HyperText Markup Language
The Boolean disabled attribute, when present, makes the element not mutable, focusable, or even submitted with the form.
Read more >HTML disabled Attribute
The disabled attribute is a boolean attribute. When present, it specifies that the element should be disabled. A disabled element is unusable. The...
Read more >How to Check if Your Buttons Are Disabled or Not In Cypress
To check if your buttons are disabled in Cypress or not, you can use the should('be.disabled') or should('not.be.enabled') assertions.
Read more >HTML disabled Attribute
A <fieldset> tag with a disabled attribute. All controls inside the fieldset are disabled and cannot be selected. ... For additional details see...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I found this way
cy.get('.ag-filter-select').should('have.attr', 'disabled', 'disabled')
and it works.I also had the same issue. cy.get().should(‘be.disabled’) returned false when attr is disabled.
but it works in this way: