Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type() is not clearing the input before typing in React component (serenity3.6.7) #3078

Open
mrpet88 opened this issue Mar 6, 2023 · 4 comments
Labels
can't-fix We don't know how to do this at the moment

Comments

@mrpet88
Copy link

mrpet88 commented Mar 6, 2023

It seems that type() method is not working properly with latest version of serenity, in React components. Since I can not provide much details from my company's project, I created two repositories, where the issue is reproducible.

Problem: Typing on an React input component that already has value, is not clearing the input, but instead it types next to the previous value.

Info:

  • Works properly on old serenity 3.0.5 with selenium 3.x.x
  • Does not work with new serenity with selenium 4.x.x
  • Checked on firefox, still same behaviour
  • Checked on different driver version, still same behaviour
  • Type() works properly with serenity 3.6.7 on non-react component

Repositories to reproduce: -> Same test, different serenity version

Image:

  • clear-issue-serenity

P.S. With pure selenium 3.x.x and 4.x.x, clear() is not working properly as well, but since clear seems to be working properly with serenity 3.0.5, I thought is a good idea to post this issue here, besides selenium.

@mrpet88
Copy link
Author

mrpet88 commented Mar 7, 2023

One guess is that this is why it works properly on serenity 3.0.5:

if (!isMobileDriver()) {
            ClearContents.ofElement(getElement());
        }
        getElement().clear();
      
  public static void ofElement(WebElement element) {
        element.sendKeys(COMMAND_A, DELETE);
        element.sendKeys(CONTROL_A, DELETE);
    }

@wakaleo
Copy link
Member

wakaleo commented Mar 7, 2023

It's not the Serenity version, it's related to the underlying Selenium verion. I believe this is related to inconsistant behaviour of the clear method on different browsers, devices and OSs. The Control-A/Delete hack stopped working for some contexts in more recent versions of Selenium. I don't have a fix.

@wakaleo wakaleo added the can't-fix We don't know how to do this at the moment label Mar 7, 2023
@mrpet88
Copy link
Author

mrpet88 commented Mar 7, 2023

Yeah I also sent to selenium about this, unfortunatelly I don't think it will be handled there as well. Thanks @wakaleo

@TimB0
Copy link

TimB0 commented Nov 14, 2023

ClearContents.ofElement(getElement()); is currently working for me in Serenity 3.7.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
can't-fix We don't know how to do this at the moment
Projects
None yet
Development

No branches or pull requests

3 participants