Cannot type PINCODE number into digit, cypress not support cy.type() to this field

133 Views Asked by At

Got an issue with the cypress test cannot cover pincode functionality with the cypress test because I tried using cy.type() but got an error. My function to receive this element works when I check him for visibility but when I wanna type the pin code it failed with an error

pinCodeDigit() {return cy.get('[data-testid="pin-digit-0"]');}

How I use this In a test pinCodeDigit().type('1111');

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

The element typed into was:

<div data-testid="pin-digit-0" class="_digit_1lwa4_26"></div>

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

How can I put Pincode to pin-digit in cypress what method should I choose?

enter image description hereenter image description here

I tried to modify my function like this but nothing helped.

pinCodeDigit() {return cy.get('[data-testid="pin-digit-*"]'); }

1

There are 1 best solutions below

0
user16695029 On

It's possible that elements <div data-testid="pin-digit-0"> are only for displaying the digits as you type them, but there is another element in that block that accepts the typed digits.

Try searching for an <input>

cy.get('div[data-testid="check-pin"]`)
  .find('input')
  .type('1111')