Cypress: cy.type() can only be called on textarea or text:

Created on 20 Mar 2018  路  6Comments  路  Source: cypress-io/cypress

Hey all. At first, sorry for my english, its bad
need to type text in the form. How to do this not only with the cy.type command. Is it possible?

Ubuntu 16.04
cypress version 2.1.0
selection_002

/code
cy.get('.textField_question-0-155').type('sad')
/code
``
selection_001
What is problem? Thanks

Most helpful comment

Use Cypress to select the div with contenteditable="true".
For example:
cy.get('[contenteditable]').type('some text")
In your case, use find to select something inside another selector:

cy.get('.textField_question-0-155').find('[contenteditable]').type('some text')

All 6 comments

The problem is that Cypress wants an input tag or textarea tag.
Edit: also found in the doc you can key on html tags that have a tag index https://docs.cypress.io/api/commands/type.html#Tabindex

Is this site publicly available? Are there no Input html elements?

Thanks for answer. I dont have input elements, and this site is not publicly. i saw tabindex, but i dont it in my page code. All what i have its "div" with .textField_question-0-155

Can you make a video of the interaction with the app?

Related proposal to turn off validation checking with type: https://github.com/cypress-io/cypress/issues/586

selection_004
selection_005

type

the field (袙邪褕 胁芯锌褉芯褋) on english = (your questions) in this field i need to type something, cy.type('blabla', {force: true} doesnt work. I can do this only with "type" command or i can do this with something else? And how to type some text in the field without type command or whose tag not called text or text area

Use Cypress to select the div with contenteditable="true".
For example:
cy.get('[contenteditable]').type('some text")
In your case, use find to select something inside another selector:

cy.get('.textField_question-0-155').find('[contenteditable]').type('some text')
Was this page helpful?
0 / 5 - 0 ratings