mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 12:56:46 +08:00
[selenium-webdriver] adding typings for remote file detector
Needed to mark indexd.d.ts with TypeScript Version 2.1 since the existing test requires TS 2.1. Also, needed to mark protractor-helpers with TS 2.1 since it's Jasmine dependency requries TS 2.1.
This commit is contained in:
1
protractor-helpers/index.d.ts
vendored
1
protractor-helpers/index.d.ts
vendored
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/wix/protractor-helpers
|
||||
// Definitions by: John Cant <https://github.com/johncant/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
/// <reference types="selenium-webdriver" />
|
||||
|
||||
|
||||
1
selenium-webdriver/index.d.ts
vendored
1
selenium-webdriver/index.d.ts
vendored
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/SeleniumHQ/selenium/tree/master/javascript/node/selenium-webdriver
|
||||
// Definitions by: Bill Armstrong <https://github.com/BillArmstrong>, Yuki Kokubun <https://github.com/Kuniwak>, Craig Nishina <https://github.com/cnishina>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
import * as chrome from './chrome';
|
||||
import * as edge from './edge';
|
||||
|
||||
38
selenium-webdriver/remote.d.ts
vendored
38
selenium-webdriver/remote.d.ts
vendored
@@ -65,3 +65,41 @@ export class DriverService {
|
||||
*/
|
||||
stop(): webdriver.promise.Promise<any>;
|
||||
}
|
||||
|
||||
/**
|
||||
* A {@link webdriver.FileDetector} that may be used when running
|
||||
* against a remote
|
||||
* [Selenium server](http://selenium-release.storage.googleapis.com/index.html).
|
||||
*
|
||||
* When a file path on the local machine running this script is entered with
|
||||
* {@link webdriver.WebElement#sendKeys 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).
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
export class FileDetector extends webdriver.FileDetector {
|
||||
/**
|
||||
* @constructor
|
||||
**/
|
||||
constructor();
|
||||
|
||||
/**
|
||||
* Prepares a `file` for use with the remote browser. If the provided path
|
||||
* does not reference a normal file (i.e. it does not exist or is a
|
||||
* directory), then the promise returned by this method will be resolved with
|
||||
* the original file path. Otherwise, this method will upload the file to the
|
||||
* remote server, which will return the file's path on the remote system so
|
||||
* it may be referenced in subsequent commands.
|
||||
*
|
||||
* @param {!webdriver.WebDriver} driver The driver for the current browser.
|
||||
* @param {string} file The path of the file to process.
|
||||
* @return {!webdriver.promise.Promise<string>} A promise for the processed
|
||||
* file path.
|
||||
*/
|
||||
handleFile(driver: webdriver.WebDriver, file: string): webdriver.promise.Promise<string>;
|
||||
}
|
||||
|
||||
11
selenium-webdriver/test/remote.ts
Normal file
11
selenium-webdriver/test/remote.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import * as remote from "selenium-webdriver/remote";
|
||||
import * as webdriver from "selenium-webdriver";
|
||||
|
||||
function TestRemoteFileDetector() {
|
||||
const driver: webdriver.WebDriver = new webdriver.Builder()
|
||||
.withCapabilities(webdriver.Capabilities.chrome())
|
||||
.build();
|
||||
|
||||
const fileDetector: remote.FileDetector = new remote.FileDetector();
|
||||
fileDetector.handleFile(driver, 'path/to/file').then((path: string) => { /* empty */ });
|
||||
}
|
||||
@@ -30,6 +30,7 @@
|
||||
"testing.d.ts",
|
||||
"test/index.ts",
|
||||
"test/chrome.ts",
|
||||
"test/firefox.ts"
|
||||
"test/firefox.ts",
|
||||
"test/remote.ts"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user