We have a complicated Java/Selenium framework at my job and I am having a hard time uploading an image wit sendKeys() in a remote server. The code works locally, but not on our Selenoid server. I've done lots of research and found out this was stemming from W3C standards but I'm assuming it is fixed now.
Here is a piece of our code:
protected void sendKeysUploadPhoto(By by, String path) {
executeScript("arguments[0].style.display = 'block';", driver.findElement(by));
((RemoteWebDriver) driver).setFileDetector(new LocalFileDetector());
try {
driver.findElement(by).clear();
driver.findElement(by).sendKeys(path);
} catch (WebDriverException wex) {
Logger.fail("WebDriver Exception: ", wex);
}
}
I get the following error for the sendKeys() step:
org.openqa.selenium.UnsupportedCommandException: unknown command: unknown command: session/efe1d404f94de0019443b240970829d1/se/file