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,220 points
1,775 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,420 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 12, 2018 in Selenium by nsv999
• 5,110 points
1,701 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,110 points
219 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,110 points
931 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
1,114 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
855 views
0 votes
1 answer
0 votes
1 answer