" ' " single quote sign in Cypress

Viewed 1760

I want to write a test like:

cy.get('table').contains('th', 'Reviewer's comment').should('exist');

in the application I have a column called 'Reviewer's comment' but in the contains I am not able to use single quote sign, I was trying with the code ' but does not work:

enter image description here

Any idea how to resolve it?

1 Answers

Since you tagged , I'm assuming that code is TypeScript. In TypeScript (and in JavaScript too), you can escape ' using \', but you don't need to escape if you use " to delimit the sting. Try this:

cy.get('table').contains('th', "Reviewer's comment").should('exist');
Related