https://cypress.io logo
`cy.get(…).invoke("attr", "target", "_self")` fail...
# i-need-help
h
I’m trying to follow a link that has
target="_blank"
and this is supposed to change the target attribute before visiting it. But the action seems to hang and fail on
invoke .attr()
with the following message: > Cannot set property message of [object DOMException] which has only a getter Now the selector in
cy.get
is very simple and works on its own, so I don’t get what’s happening. The whole command looks like that:
Copy code
cy.get("[data-cy=voir-fiche-spectacle]")
         .invoke("attr", "target", "_self")
         .click()