Search code examples
javascriptautomationcypress

Cypress error. cy.type() failed because it requires a valid typeable element


cy.type() failed because it requires a valid typeable element.

The element typed into was:

...

A typeable element matches one of the following selectors: a[href] area[href] input select textarea button iframe [tabindex] [contenteditable]

I was trying to locate a field to enter date and it shows an error like this. But i have automated the field like same before without any errors.


Solution

  • You should be able to find an <input> within the <div>.

    Not sure exactly what selectors you used, but this would be an example:

    cy.get('div.mat-form-field-infix')
      .find('input')
      .type('21-10-2022')