selenium icon indicating copy to clipboard operation
selenium copied to clipboard

I cannot upload files with selenium web driver.

Open rleaplaza opened this issue 9 years ago • 4 comments

I have a problem uploading a file via selenium web driver v.3.5.3 in firefox 55.0.3 Geckodriver 0.18.0 Both of the instructions are correct.: WebElement elem=driver.findElement(By.xpath("//input[@type='file']")); elem.sendKeys("C:\opt\formatos_excel_importacion\prueba.txt"); In Google chrome it works fine, but it doesn't do the same in firefox. 2017-09-11 15_07_03-tests - d__tests - tests - _src_testsolicitudchrome java - intellij idea The error says: Exception in thread "main" org.openqa.selenium.InvalidArgumentException: File not found: C:\opt\formatos_excel_importacion\prueba.txt

rleaplaza avatar Sep 11 '17 19:09 rleaplaza

Please check this issue. https://github.com/mozilla/geckodriver/issues/858

This configuration set working for me..!!

Geckodriver - 0.17.0 FireFox - 54.0 (64-bit) Os - Mac Selenium Version - v.3.5.3

jithinkmatthew avatar Sep 12 '17 08:09 jithinkmatthew

Please provide full stacktrace for exception org.openqa.selenium.InvalidArgumentException: File not found: C:\opt\formatos_excel_importacion\prueba.txt

barancev avatar Sep 12 '17 08:09 barancev

Thanks for the advices, I found the solution to my problem. FirefoxProfile profile=new FirefoxProfile(); profile.setPreference("dom.file.createInChild",true); DesiredCapabilities capabilities=DesiredCapabilities.firefox(); capabilities.setCapability(FirefoxDriver.PROFILE,profile); driver=new FirefoxDriver(capabilities); Now I can upload files normally. I know the problem will be solved for the next Firefox version.

rleaplaza avatar Sep 12 '17 14:09 rleaplaza

Hi @rleaplaza Have you tried this with Chrome browser? I am facing similar problem with chromedrive latest version & browser version version: 70.0.3538.110.

rakeshnambiar avatar Nov 27 '18 13:11 rakeshnambiar