Selenium WebDriver and browsers select file dialog

0 votes
I'm using selenium web driver, C#.

Is it possible to make work web driver with Firefox select file dialog? Should I use something like AutoIt?
Sep 3, 2018 in Selenium by Martin
• 4,320 points
10,667 views

1 answer to this question.

0 votes

If you are trying to select a file to upload Selenium 2 that supports HTML file inputs. For example:

HTML

<input type="file" id="uploadhere" />

The Selenium Code

IWebElement element = driver.FindElement(By.Id("uploadhere"));
element.SendKeys("C:\\Some_Folder\\MyFile.txt");

Basically you "type" (with SendKeys) the full file path to the file input element. Selenium handles the file selection dialog for you.

However, if you want to manipulate an arbitrary file selection dialog, then like Anders said, you have to go outside of Selenium.

answered Sep 3, 2018 by Meci Matt
• 9,460 points

Related Questions In Selenium

0 votes
1 answer

How do i change the location where my file gets downloaded in Selenium Webdriver and firefox driver?

There are a couple of errors there. ...READ MORE

answered Apr 13, 2018 in Selenium by nsv999
• 5,500 points
6,157 views
0 votes
1 answer
0 votes
1 answer

What's the diff between Selenium RC and Selenium WebDriver?

RC works by injecting the JavaScript functions ...READ MORE

answered Apr 5, 2018 in Selenium by nsv999
• 5,500 points
1,311 views
0 votes
2 answers

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,500 points
13,567 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,084 views
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,910 points
7,178 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,840 views
0 votes
1 answer
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP