I'm running my Selenium tests through Zalenium docker image. I have a test that requires a .pdf document uploading to the application. The directory I will be using to store all my .pdfs is: D:\Automation\KITS Automation\exports-endtoend-tests\Defra.Exports.EndToEnd.Tests\bin\Debug\netcoreapp2.1 I have added this path to my docker CMD window as below:
docker run --rm -ti --name zalenium -p 4444:4444 -v /var/run/docker.sock:/var/run/docker.sock -v /tmp/videos:/home/seluser/videos -v /d:/automation/kits automation/exports-endtoend-tests/defra.exports.endtoend.tests/bin/debug/netcoreapp2.1 --privileged dosel/zalenium start
Once added docker requests to share this file with a confirmation popup box however when I run the test I still see the error below
OpenQA.Selenium.WebDriverException : invalid argument: File not found : D:\Automation\KITS Automation\exports-endtoend-tests\Defra.Exports.EndToEnd.Tests\bin\Debug\netcoreapp2.1\test-ehc.pdf
c# Code that executes uploading the file:
string folder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string filePath = Path.Combine(folder, "test-ehc.pdf");
driver.FindElement(By.Id("file")).SendKeys(filePath)