0 votes
1 view
in Devops and Agile by (19.8k 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 (63.4k 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.

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


Categories

...