Cy.click failed because the targetted element is disabled or its partially visible

Viewed 1173

cy.click failed with the reason - "The targetted element is disabled". But the targetted element is enabled here. The outerhtml of the targetted element is as below.

sometimes cy.click failed with the reason that targetted element is not fully visible. I.e if the button or anchor ag text is partially visible at that click fails

<a class="btn" data-click="myClickEvent" data-bind="enable: enabled, css: { 'disabled': !enabled() }, attr:{'test-id':text}" test-id="elementDataTestID">...</a>

enter image description here

I debug and found that "ensureNotDisabled" is getting callled and After evaluating subject.prop('disabled') it returns true which throws that error. Is any work around for this Except force:true. It works but doesn't wish to use............

Scenario 2: Another scenario where click fails is that if the button is not fully visible then also, its not working. enter image description here

enter image description here

Any solution apart from { force: true }

https://github.com/cypress-io/cypress/issues/8537 => Already raised an issue in cypress.io. But they are yet to reply.

Versions Cypress Version : 5.1. OS:- Windows 10 Browser:- Electron and Chrome

0 Answers
Related