diff --git a/selenium-webdriver/selenium-webdriver-tests.ts b/selenium-webdriver/selenium-webdriver-tests.ts
index c93b96c00..4e5e9766b 100644
--- a/selenium-webdriver/selenium-webdriver-tests.ts
+++ b/selenium-webdriver/selenium-webdriver-tests.ts
@@ -586,6 +586,16 @@ function TestUnhandledAlertError() {
}
}
+function TestWebDriverFileDetector() {
+ var driver: webdriver.WebDriver = new webdriver.Builder().
+ withCapabilities(webdriver.Capabilities.chrome()).
+ build();
+
+ var fileDetector: webdriver.FileDetector = new webdriver.FileDetector();
+
+ fileDetector.handleFile(driver, 'path/to/file').then(function(path: string) {});
+}
+
function TestWebDriverLogs() {
var driver: webdriver.WebDriver = new webdriver.Builder().
withCapabilities(webdriver.Capabilities.chrome()).
diff --git a/selenium-webdriver/selenium-webdriver.d.ts b/selenium-webdriver/selenium-webdriver.d.ts
index b7afaa081..4d4829342 100644
--- a/selenium-webdriver/selenium-webdriver.d.ts
+++ b/selenium-webdriver/selenium-webdriver.d.ts
@@ -3645,6 +3645,41 @@ declare module webdriver {
//endregion
}
+ /**
+ * Used with {@link webdriver.WebElement#sendKeys WebElement#sendKeys} on file
+ * input elements ({@code }) to detect when the entered key
+ * sequence defines the path to a file.
+ *
+ * By default, {@linkplain webdriver.WebElement WebElement's} will enter all
+ * key sequences exactly as entered. You may set a
+ * {@linkplain webdriver.WebDriver#setFileDetector file detector} on the parent
+ * WebDriver instance to define custom behavior for handling file elements. Of
+ * particular note is the {@link selenium-webdriver/remote.FileDetector}, which
+ * should be used when running against a remote
+ * [Selenium Server](http://docs.seleniumhq.org/download/).
+ */
+ class FileDetector {
+ /** @constructor */
+ constructor();
+
+ /**
+ * 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.
+ *
+ * @param {!webdriver.WebDriver} driver The driver for the current browser.
+ * @param {string} path The path to process.
+ * @return {!webdriver.promise.Promise} A promise for the processed
+ * file path.
+ * @package
+ */
+ handleFile(driver: webdriver.WebDriver, path: string): webdriver.promise.Promise;
+ }
+
/**
* Creates a new WebDriver client, which provides control over a browser.
*