testdevlab / TestUI

MIT License
33 stars 9 forks source link

New TestUI version 2.0.0, sendKeys() function not working correctly #94

Closed Erli96 closed 2 months ago

Erli96 commented 1 year ago

When trying to send a String file path to an UIElement as in this code section:

 profileTabPage.getUploadAvatarButton().sendKeys(file.getAbsolutePath());

an Exception is thrown:


UnsupportedCommandException: unknown command: unknown command: session/aae6b3f0979e16cd767342dd08b8fa24/se/file
Timeout: 4 s.
Caused by: UnsupportedCommandException: unknown command: unknown command: session/aae6b3f0979e16cd767342dd08b8fa24/se/file
testUI.Utils.TestUIException: UnsupportedCommandException: unknown command: unknown command: session/aae6b3f0979e16cd767342dd08b8fa24/se/file
Timeout: 4 s.
Caused by: UnsupportedCommandException: unknown command: unknown command: session/aae6b3f0979e16cd767342dd08b8fa24/se/file
    at testUI.Utils.TestUIException.handleError(TestUIException.java:19)
    at testUI.elements.Element.sendKeys(Element.java:403)
    at stepdefinitions.app.AccountSettingsSteps.updateAvatar(AccountSettingsSteps.java:54)
alvarolaserna commented 1 year ago

What's the file variable? how it is defined? is it a File class? or is it somehting you have developed?

or better, can you get the string returned by file.getAbsolutePath() and check that it is an actual string? and can you post it here, if you can, or try to reproduce the issue with a similar string.

Thanks

Erli96 commented 1 year ago

Well file variable is an object of File class.

 File file = new File(Path.of("A", "B", "C", "D","example").toString());

A String path is passed as argument to File constructor and actually it is a real String, I checked it. And also the tests are running fine when running locally. But we are getting this UnsupportedCommandException on 2.0.0 version only when running the tests using a remote Selenium server, not on another occasion. When using the old version it was fine on both the remote Selenium server and locally.

alvarolaserna commented 1 year ago

cant reproduce it, I have tried with the following code:

        ChromeOptions options = new ChromeOptions();
        Configuration.softAsserts = false;
        Configuration.remote = "http://localhost:4444/wd/hub/";
        options.addArguments("--user-agent=Agent", "headless");
        Configuration.chromeOptions = options;
        selenideBrowserCapabilities.setBrowserName("chrome");
        open("https://www.whatsmyua.info/");
        E(byCssSelector("textarea")).waitFor(10).untilHasText("Agent");
        File file = new File("pom.xml");
        E(byCssSelector("textarea")).sendKeys(file.getAbsolutePath());
  It works as expected. Please if you use any example, dont put external libraries, or tell me which are those, `Path.of` is not included in my Java distribution.
alvarolaserna commented 2 months ago

closing it since there is no response, Ill reopen if something new comes up