class FileDetector

final
webdriver.FileDetector
  └ FileDetector

A webdriver.FileDetector that may be used when running against a remote Selenium server.

When a file path on the local machine running this script is entered with WebElement#sendKeys, this file detector will transfer the specified file to the Selenium server's host; the sendKeys command will be updated to use the transfered file's path.

Note: This class depends on a non-standard command supported on the Java Selenium server. The file detector will fail if used with a server that only supports standard WebDriver commands (such as the ChromeDriver).

new FileDetector()

Parameters
None.

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.

Overrides: webdriver.FileDetector

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.