question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem with fastSetValue on Material UI Components

See original GitHub issue

The problem

Material UI is one of the most popular React Components library. And when i’m trying to use Selenide with fastSetValues (setting values via js) it’s not working correctly.

Details

When Selenide sets value via JS Material UI component ( Autocomplete ) do not call hooks like onInputChange and others.

Tell us about your environment

  • Selenide Version: 5.8.0
  • Yandex browser: 20.2.0.1145
  • Browser Driver Version: 79
  • Selenium Version: embedded in Selenide
  • OS Version: mac OS

Code To Reproduce Issue [ Good To Have ]

To reproduce the bug you may run the test:

@Test
    void check() {
        Configuration.fastSetValue = true;
        open("https://rusakovstas.github.io/material-autocomplete/");
        $(byText("Вбейте что нибудь или скопируйте")).closest("div").$("input").setValue("123");
        $(byText("Поймали логику!")).shouldBe(visible);
    }

For now it’s failed. If you remove Configuration.fastSetValue = true; it works fine.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:16 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
rusakovStascommented, Mar 20, 2020

So, since the fix https://github.com/selenide/selenide/issues/1074#issuecomment-593118940 broke tests, i think there is nothing to do. Issue may be closed.

1reaction
rusakovStascommented, Mar 20, 2020

But for now you could use custom commands via execute method) For my case i wrote a command like this:

public static Command<SelenideElement> setValueAttribute(String value) {
       return (proxy, locator, args) -> {
           Selenide.executeJavaScript("arguments[0].focus(); arguments[0].setAttribute('value', arguments[1]);", proxy, value);
           events.fireEvent(locator.driver(), proxy, "keydown", "keypress", "input", "keyup", "change");
           return proxy;
       };
    }

And in tests it’s look like: $("input").execute(setValueAttribute("some value"));

Read more comments on GitHub >

github_iconTop Results From Across the Web

Problem rendering content of Material UI components in React
Text content of Material UI components is not rendered to final HTML. Render method of my component looks like:
Read more >
Take 1 Advanced Tray Regular Body Wash Fast Set Value ...
Take 1 Advanced Tray Regular Body Wash Fast Set Value Pack of 24 Cartridges. Log In to View Pricing and Order. 3995-055. In...
Read more >
Concept for Improvement of Afterload in an Ex Vivo Heart ...
The design of a component can be more or less suitable for sterilization and depends mainly on two things: geometry and material. Geometry-dependence...
Read more >
Globals - Material-UI
Globals. The overrides key enables you to customize the appearance of all instances of a component type, while the props key enables you...
Read more >
For even more dynamics: High Power supply module for drive ...
... drive component that works inconspicuously and reliably in the ... short recovery times with fast set value changes and load jumps.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found