Edit html in cypress

Viewed 97

Is there a way to make cypress change the html of a page.

I am trying to make a test for a vulnerability on my site however the vulnerability requires the user to change a tag on a html element. Is there a way to make cypress do this?

the element is a checkbox and it is disabled, however what i want cypress to do is remove the disabled tag and then click the checkbox.

<input type="checkbox" disabled>

then i want cypress to remove the disabled tag so it is

<input type="checkbox">
1 Answers

You can use removeAttr to remove the disabled tag. Something like:

cy.get('input[type="checkbox"]').invoke('removeAttr', 'disabled')
Related