selenoid: File upload doesn't work

🐛 Bug Report

File upload is not working using RemoteWebDriver. It is working fine running locally but fails on Remote.

Last compatible WebDriver version 4.0.0-alpha05 Stop working since 4.0.0-alpha07 Still not working in 4.0.0-beta2

Unable to upload file: System.NotImplementedException: unknown command: unknown command: session/eaee033d03861677627f084357ea877a/se/file
   at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
   at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.Remote.RemoteWebDriver.InternalExecute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.Remote.RemoteWebElement.Execute(String commandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.Remote.RemoteWebElement.UploadFile(String localFile)
   at OpenQA.Selenium.Remote.RemoteWebElement.SendKeys(String text)
   at SeleniumExtras.PageObjects.WebElementProxy.SendKeys(String text)

To Reproduce

driver.FindElement(By.Id("upload")).SendKeys(file);

Expected behavior

File uploaded successfully

Test script or set of commands reproducing this issue

                var chromeOptions = new ChromeOptions();

                chromeOptions.AddArguments("headless", "--window-size=1920,1080", "--safebrowsing-disable-download-protection");

                chromeOptions.AddUserProfilePreference("download.default_directory", "/home/selenium/Downloads");
                chromeOptions.AddUserProfilePreference("download.prompt_for_download", false);
                chromeOptions.AddUserProfilePreference("download.directory_upgrade", true);
                chromeOptions.AddUserProfilePreference("safebrowsing.enabled", false);

                chromeOptions.SetLoggingPreference(LogType.Browser, LogLevel.All);
                var driver = new RemoteWebDriver(new Uri(Browser.HubUri), chromeOptions);

                driver.Navigate().GoToUrl("<URL>");

                IAllowsFileDetection fileDetectionDriver = (IAllowsFileDetection)driver;
                fileDetectionDriver.FileDetector = new LocalFileDetector();

                var file = "<File_Path>";

                driver.FindElement(By.Id("upload")).SendKeys(file);

Environment

Selenoid: 1.10.3 Browser: Chrome Browser version: 89.0.4389.114 Browser Driver version: Selenium.WebDriver.ChromeDriver -Version 89.0.4389.2300 Language Bindings version: C#

Notes

Related bug for WebDriver https://github.com/SeleniumHQ/selenium/issues/9350

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 38 (18 by maintainers)

Most upvoted comments

@phyt3r ok, will release this soon.

Currently we fixed this stuff in recent Moon version by supporting /se/ prefix.

@dbudim we are thinking about possible implementation.

this may be a little off topic, but it would have been super helpful earlier. i needed to work around this issue for ruby, so i made a workaround for in the capybara gem

@vania-pooh it worked for me with aerokube/selenoid:latest and selenium:4.0.0. Thanks

Applied a fix. Please try with aerokube/selenoid:latest.

@vania-pooh I have same issue on my project using Selenium 4.0.0-rc-1 and selenoid 1.10.4

Can I expect the problem to be fixed for selenoid?

@kndani they will reject saying that on Selenium server it works.