Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I cannot upload files with selenium web driver. #4681

Closed
rleaplaza opened this issue Sep 11, 2017 · 4 comments
Closed

I cannot upload files with selenium web driver. #4681

rleaplaza opened this issue Sep 11, 2017 · 4 comments

Comments

@rleaplaza
Copy link

rleaplaza commented Sep 11, 2017

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

@jithinkmatthew
Copy link

jithinkmatthew commented Sep 12, 2017

Please check this issue.
mozilla/geckodriver#858

This configuration set working for me..!!

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

@barancev
Copy link
Member

barancev commented Sep 12, 2017

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

@rleaplaza
Copy link
Author

rleaplaza commented Sep 12, 2017

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.

@rakeshnambiar
Copy link

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.

@lock lock bot locked and limited conversation to collaborators Aug 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants