geckodriver icon indicating copy to clipboard operation
geckodriver copied to clipboard

In Firefox SendKeys a String to a Input that is validating the text in real time

Open andonima opened this issue 4 months ago • 2 comments

System

  • Version: 0.35.0
  • Platform: Windows
  • Firefox: Firefox 130.0.1
  • Selenium: 4.25.0 C#

Testcase

I openned the issue on selenium project and they have derivated me here.

We normally execute our e2e tests on chrome, but we want to add firefox support and we the SendKeys method is not working as expected with inputs that have validations.

The simplest example is:

We want to clear the text of an email input and then writte a new email on it. (works perfectly on Chrome)

emailInput.Clear();
emailInput.SendKeys("[email protected]");

But on the frontend we are getting: image

My theory is that "the text stream" brokes when the element changes, because see how the input performs with human interaction. (We obviusly are using data-testid="email" to select the element. )

https://github.com/user-attachments/assets/2824dfe3-aa2c-4489-9bbb-6cb83ef40571

Input on error <input data-testid="email" matinput="" type="text" name="email" class="mat-mdc-input-element ng-tns-c11-70 mat-mdc-form-field-input-control mdc-text-field__input cdk-text-field-autofill-monitored ng-dirty ng-touched ng-invalid" placeholder="E-Mail" id="mat-input-13" required="" aria-required="true" aria-invalid="true" aria-describedby="mat-mdc-error-37 mat-mdc-error-9">

Input ok <input data-testid="email" matinput="" type="text" name="email" class="mat-mdc-input-element ng-tns-c11-8 ng-untouched ng-pristine mat-mdc-form-field-input-control mdc-text-field__input cdk-text-field-autofill-monitored ng-valid" placeholder="E-Mail" id="mat-input-6" required="" aria-required="true" aria-invalid="false">

We have a found a "dirty" workaround that is to substring the email to:

"example@c" "ompany.c" "om"

and doing the SendKeys 3 times.

But we have more inputs with different validation "urls, telephones etc..". and It would be a nightmare to handle them with that workaround.

Any clue?

Thanks in advance

Stacktrace

Trace-level log

andonima avatar Sep 27 '24 09:09 andonima