Selenium WebDriver and browsers select file dialog

0
0

I’m using selenium webdriver, C#.

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

  • You must to post comments
0
0

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

HTML

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

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.

  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Website