# Class FileDetector

Used with WebElement#sendKeys on file input elements ({@code }) 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.

#### Hierarchy

- FileDetector

#####
Index

### Constructors

constructor

### Methods

handleFile

## Constructors

### constructor

- new FileDetector(): FileDetector

- #### Returns FileDetector

## Methods

### handleFile

- handleFile(driver, path): Promise<string>

- 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

  - ##### driver: WebDriver

    The driver for the current browser.

  - ##### path: string

    The path to process.

  #### Returns Promise<string>

  A promise for the processed file path.

  #### Package

Generated using TypeDoc