selenoid icon indicating copy to clipboard operation
selenoid copied to clipboard

File not found when uploading multiple files at once

Open rsporny opened this issue 5 years ago • 8 comments

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 avatar Dec 06 '19 10:12 rsporny

@rsporny what is your Selenoid version, browser name and version?

vania-pooh avatar Dec 06 '19 12:12 vania-pooh

@vania-pooh aerokube/selenoid:latest, browser chrome (selenoid/vnc:chrome_77.0)

rsporny avatar Dec 06 '19 12:12 rsporny

@rsporny take a look at these examples: https://aerokube.com/selenoid/latest/#_uploading_files_to_browser

vania-pooh avatar Dec 06 '19 15:12 vania-pooh

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?

rsporny avatar Dec 09 '19 10:12 rsporny

I am having the same problem, in the end did you find any solution? Thanks

maoso avatar Dec 09 '20 09:12 maoso

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.

maoso avatar Dec 09 '20 11:12 maoso

@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 avatar Aug 09 '23 12:08 wonder19

@wonder19 this is a rare use case, so PRs are welcome.

vania-pooh avatar Aug 10 '23 05:08 vania-pooh