How to handle the popup of file upload in Windows OS with WebDriver?

0 votes

I saw another thread with solutions for uploading files using WebDriver. But none of them are working on the below sites.

http://www.uploadify.com/demos/
http://www.zamzar.com/

I'm using the below code and i'm still getting errors. Suggestions and edits are welcome :)

WebElement fileInput = driver.findElement(By.name("uploadfile"));
fileInput.sendKeys("C:/path/to/file.jpg");
Apr 25, 2018 in Selenium by kappa3010
• 2,010 points
1,537 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

The value of name locator has probably changed to "file_1" now. Or else you can use id locator with this value and try once "inputFile".

WebElement fileInput = driver.findElement(By.name("file_1"));
fileInput.sendKeys("C:/path/to/file.jpg");

If this still does not work, then try this:

driver.findElement(By.id("inputFile")).click();
driver.switchTo()
       .activeElement()
       .sendKeys("C:/path/to/file.jpg");
answered Apr 25, 2018 by king_kenny
• 3,590 points

Related Questions In Selenium

0 votes
1 answer
0 votes
1 answer

How to handle notifications in Python with Selenium (Chrome WebDriver)

Below will help you: You can disable the ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
1,376 views
0 votes
1 answer
0 votes
1 answer

How to handle drop downs using Selenium WebDriver in Java

First, find an XPath which will return ...READ MORE

answered Mar 27, 2018 in Selenium by nsv999
• 5,030 points
1,223 views
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,030 points
66 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
438 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
52 views
+2 votes
1 answer

How can we handle authentication popup in Selenium WebDriver using Java

The Alert Method, authenticateUsing() lets us skip ...READ MORE

answered Apr 18, 2018 in Selenium by king_kenny
• 3,590 points
2,896 views
0 votes
1 answer

How to open a browser windows silently in the background?

It is a little bit of a ...READ MORE

answered Apr 20, 2018 in Selenium by king_kenny
• 3,590 points
60 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.