sdd
sdd

Reputation: 153

How to handle FolderBrowserDialog using Selenium

I have seen questions related to File upload. But what I have is the FolderBrowserDialog. Can anyone help me to figure out how selenium can handle this for automation?

enter image description here

I am trying to do something like this -

public IWebElement BrowseWindow
    {
        get { return WebDriverProvider.Driver.WaitForAndFindElement(By.Name("FolderBrowserDialog")); }
    }

Upvotes: 0

Views: 520

Answers (1)

Saifur
Saifur

Reputation: 16201

Since, Selenium is a browser automation tool it does not have capabilities outside of browser. There are some third party libraries like AutoIt helps you with file browsing or upload but not a native support from Selenium. Selenium, however, has support for file upload with sendKeys() if that's the case here.

WebElement file = driver.findElement(By.name("name of file input tag"));
file.sendKeys("file path with extension");

Just a side note, hidden file input tag can still be used with sendKeys if done on FF or Chrome. IE still does not support hidden file input tag for file upload. See this

Upvotes: 2

Related Questions