selenium-webdriver
Version:
The official WebDriver JavaScript bindings from the Selenium project
21 lines • 3.68 kB
HTML
<meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"><meta http-equiv="Content-Language" content="en"><meta http-equiv="X-UA-Compatible" content="IE=edge"><title>FileDetector</title><link href="dossier.css" rel="stylesheet" type="text/css"><header><div><form><div><input type="search" placeholder="Search" tabindex="1"></div></form></div></header><main><article><div class="parentlink"><b>Module:</b> <a href="module_selenium-webdriver.html">selenium-webdriver</a></div><div class="codelink"><a href="source/index.js.src.html#l58">View Source</a></div><h1>class FileDetector</h1><dl><dt>Alias for <code><a href="class_webdriver_FileDetector.html">webdriver.FileDetector</a></code></dl><p>Used with <a href="class_webdriver_WebElement.html#sendKeys"><code>WebElement#sendKeys</code></a> on file
input elements (<code><input type="file"></code>) to detect when the entered key
sequence defines the path to a file.</p>
<p>By default, <a href="class_webdriver_WebElement.html">WebElement's</a> will enter all
key sequences exactly as entered. You may set a
<a href="class_webdriver_WebDriver.html#setFileDetector">file detector</a> on the parent
WebDriver instance to define custom behavior for handling file elements. Of
particular note is the <a href="module_selenium-webdriver_remote_class_FileDetector.html"><code>selenium-webdriver/remote.FileDetector</code></a>, which
should be used when running against a remote
<a href="http://docs.seleniumhq.org/download/">Selenium Server</a>.</p>
<h3>new FileDetector()</h3><div><div class="fn-details"><div><b>Parameters</b></div><dl><dd>None.</dl></div></div><h2>Instance Methods</h2><div id="handleFile" class="function"><div><h3>handleFile(<wbr>driver, path)<span class="codelink"><a href="source/lib/webdriver/webdriver.js.src.html#l2489">code »</a></span></h3><p>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.</p>
<p>This default implementation is a no-op. Subtypes may override this
function for custom tailored file handling.</p>
<div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>driver<code><a href="class_webdriver_WebDriver.html">webdriver.WebDriver</a></code><dd><p>The driver for the current browser.</p>
<dt>path<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd><p>The path to process.</p>
</dl></div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="class_webdriver_promise_Promise.html">webdriver.promise.Promise</a><<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>></code><dd><p>A promise for the processed
file path.</p>
</dl></div></div></div></div></article><nav><h3><a href="index.html" tabindex="2">Overview</a></h3><div><input type="checkbox" id="nav-modules" checked/><label for="nav-modules"><h3><span class="selectable" tabindex="2">Modules</span></h3></label><div id="nav-modules-view"></div></div><div><input type="checkbox" id="nav-types" checked/><label for="nav-types"><h3><span class="selectable" tabindex="2">Types</span></h3></label><div id="nav-types-view"></div></div><h3><a href="Changes.html" tabindex="2">Changes</a></h3></nav></main><footer><div><a href="https://github.com/jleyba/js-dossier">Generated by dossier</a></div></footer><script src="types.js"></script><script src="dossier.js"></script>