Search code examples
javascriptcypressend-to-end

How to select text in editor using cypress


I am tester and beginer in Cypress. I have a editor and typing it any text. After typing I want to select my typing text and do with it anything /ex. change a style/

this is my html code

<div class="editor">
    <p> my text </p>
</div>

Does anyone have a way on how to do that?


Solution

  • Set type to {selectall} - https://docs.cypress.io/api/commands/type.html#Week-Inputs

    cy.get('.editor').type('{selectall}');