I am trying to upload multiple files to the page with
<input id="dropInput" type="file" multiple>
For one file it is as simple as:
driver.FindElement(By.Id("dropInput")).SendKeys(@"path-to-file");
As a user I can click Choose Files button and select number of files (with Ctrl) so in Open dialog I can see sth like: "file-1" "file-2"
From the script it does not work. I have tried different combinations of SendKeys argument:
@"file-1" + " " + @"file-2"
@"file-1" + ", " + @"file-2"
"\"path\\to\\file-1\" \"path\\to\\file-2\""
Path.GetFullPath(file-1) + " " + Path.GetFullPath(file-2)
"\"" + Path.GetFullPath(file-1) + "\" \"" + Path.GetFullPath(file-2) + "\""
The input accepts the last file only. The same with sending keys several times. For the last example I have got an exception:
unknown error: path is not absolute: "file-1" "file-2"
I am out of ideas.
I'd like to know if there is any simple solution for that before I'll start injecting jQuery scripts to the page under test.
Please advise.
Cheers, Przemek