class FileDetector

Used with WebElement#sendKeys on file input elements (<input type="file">) to detect when the entered key sequence defines the path to a file.

By default, WebElement's will enter all key sequences exactly as entered. You may set a file detector on the parent WebDriver instance to define custom behavior for handling file elements. Of particular note is the selenium-webdriver/remote.FileDetector, which should be used when running against a remote Selenium Server.

Instance Methods

handleFile(driver, path)code ยป

Handles the file specified by the given path, preparing it for use with the current browser. If the path does not refer to a valid file, it will be returned unchanged, otherwisee a path suitable for use with the current browser will be returned.

This default implementation is a no-op. Subtypes may override this function for custom tailored file handling.

Parameters
driverwebdriver.WebDriver

The driver for the current browser.

pathstring

The path to process.

Returns
webdriver.promise.Promise<string>

A promise for the processed file path.