selenoid
selenoid copied to clipboard
File not found when uploading multiple files at once
Hello guys,
is it possible to upload multiple files at once? Right now I'm getting selenium.common.exceptions.InvalidArgumentException: Message: invalid argument: File not found : /workspace/resources/file.jpg
I'm using this method on plain webdriver and works just fine:
'\n'.join(['/path1', '/path2'])
example:
input = driver.find_element_by_css_selector("input[type='file']")
input.send_keys("/path/to/file1\n/path/to/file2")
@rsporny what is your Selenoid version, browser name and version?
@vania-pooh aerokube/selenoid:latest, browser chrome (selenoid/vnc:chrome_77.0)
@rsporny take a look at these examples: https://aerokube.com/selenoid/latest/#_uploading_files_to_browser
that works fine, it just failing with multiple files at once. Could you, please, try above method
'\n'.join()
and let me know if if works for you?
I am having the same problem, in the end did you find any solution? Thanks
Ok maybe is late but i found a workaround to avoid this to fail on Selenoid, We must set the value of the file input element using javascript setting its value attribute.
var input = driver.find_element_by_css_selector("input[type='file']"); foreach(filePath in filePaths) { ExecuteJavascript("return arguments[0].value="", input); //simulates a clear ExecuteJavascript("return arguments[0].value=filePath, input); }
I have checked on C# and works fine that is the idea.
@vania-pooh heello my dear friend Vanya) well,i have the same problem with selenoid ([1.10.11]) and chrome=112.0.5615.49 and python 3.11 also try chrome=114.0.5735.133 this bug will be fixed some day? or just try some other solutions?
@wonder19 this is a rare use case, so PRs are welcome.