Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in DevOps and Agile by (19.7k points)

I'm using selenium webdriver, C#.

Is it possible to make work webdriver with Firefox select file dialog? Or must I use something like AutoIt?

1 Answer

0 votes
by (62.9k points)

If you're making an attempt to select a file for upload selenium 2 supports HTML file inputs.

For example:

HTML

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

Selenium Code

IWebElement element = driver.FindElement(By.Id("upload_here"));

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 would like to manipulate an arbitrary file selection dialog, you've got to travel outside of selenium.

If you are interested to learn Selenium on a much deeper level and want to become a professional in the testing domain, check out Intellipaat’s Selenium automation course!

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94.7k users

Browse Categories

...