From e761557592ae2482374a06306c0cf8b02eaf2913 Mon Sep 17 00:00:00 2001 From: Simon Gellis Date: Fri, 3 Feb 2017 23:03:13 -0500 Subject: [PATCH] Removes deprecated methods and updates some signatures --- selenium-webdriver/executors.d.ts | 11 - selenium-webdriver/firefox.d.ts | 8 +- selenium-webdriver/http.d.ts | 7 +- selenium-webdriver/index.d.ts | 383 +++++------------------------- selenium-webdriver/test/index.ts | 92 ++----- 5 files changed, 88 insertions(+), 413 deletions(-) delete mode 100644 selenium-webdriver/executors.d.ts diff --git a/selenium-webdriver/executors.d.ts b/selenium-webdriver/executors.d.ts deleted file mode 100644 index c7bf15ef8d..0000000000 --- a/selenium-webdriver/executors.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import * as webdriver from './index'; - -/** - * Creates a command executor that uses WebDriver's JSON wire protocol. - * @param {(string|!promise.Promise)} url The server's URL, - * or a promise that will resolve to that URL. - * @param {?string=} opt_proxy (optional) The URL of the HTTP proxy for the - * client to use. - * @returns {!./lib/command.Executor} The new command executor. - */ -export function createExecutor(url: string | webdriver.promise.Promise, opt_agent?: string, opt_proxy?: string): webdriver.Executor; diff --git a/selenium-webdriver/firefox.d.ts b/selenium-webdriver/firefox.d.ts index 7678c404ce..76f4f3d147 100644 --- a/selenium-webdriver/firefox.d.ts +++ b/selenium-webdriver/firefox.d.ts @@ -197,11 +197,13 @@ export class Options { setProxy(proxy: webdriver.ProxyConfig): Options; /** - * Sets whether to use Mozilla's Marionette to drive the browser. + * Sets whether to use Mozilla's geckodriver to drive the browser. This option + * is enabled by default and required for Firefox 47+. * - * @see https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver + * @param {boolean} enable Whether to enable the geckodriver. + * @see https://github.com/mozilla/geckodriver */ - useMarionette(marionette: any): Options; + useGeckoDriver(enable: boolean): Options; /** * Converts these options to a {@link capabilities.Capabilities} instance. diff --git a/selenium-webdriver/http.d.ts b/selenium-webdriver/http.d.ts index a0a25a7955..abe54a518e 100644 --- a/selenium-webdriver/http.d.ts +++ b/selenium-webdriver/http.d.ts @@ -99,10 +99,11 @@ export function sendRequest(options: Object, onOk: any, onError: any, opt_data?: */ export class Executor { /** - * @param {!HttpClient} client The client to use for sending requests to the - * server. + * @param {!(HttpClient|IThenable)} client The client to use for sending + * requests to the server, or a promise-like object that will resolve to + * to the client. */ - constructor(client: HttpClient); + constructor(client: HttpClient | webdriver.promise.IThenable); /** * Defines a new command for use with this executor. When a command is sent, diff --git a/selenium-webdriver/index.d.ts b/selenium-webdriver/index.d.ts index 25b9b96017..446286c8fe 100644 --- a/selenium-webdriver/index.d.ts +++ b/selenium-webdriver/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Selenium WebDriverJS 2.53 +// Type definitions for Selenium WebDriverJS 3.0.1 // Project: https://github.com/SeleniumHQ/selenium/tree/master/javascript/node/selenium-webdriver -// Definitions by: Bill Armstrong , Yuki Kokubun , Craig Nishina +// Definitions by: Bill Armstrong , Yuki Kokubun , Craig Nishina , Simon Gellis // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 @@ -14,8 +14,6 @@ import * as safari from './safari'; export namespace error { class IError extends Error { constructor(opt_error?: string); - - code(): number; } /** @@ -1037,32 +1035,6 @@ export namespace promise { */ then(opt_callback?: (value: T) => IThenable | R, opt_errback?: (error: any) => any): Promise; - /** - * Registers a listener for when this promise is rejected. This is synonymous - * with the {@code catch} clause in a synchronous API: - *

-     *   // Synchronous API:
-     *   try {
-     *     doSynchronousWork();
-     *   } catch (ex) {
-     *     console.error(ex);
-     *   }
-     *
-     *   // Asynchronous promise API:
-     *   doAsynchronousWork().thenCatch(function(ex) {
-     *     console.error(ex);
-     *   });
-     * 
- * - * @param {function(*): (R|promise.Promise.)} errback The function - * to call if this promise is rejected. The function should expect a single - * argument: the rejection reason. - * @return {!promise.Promise.} A new promise which will be - * resolved with the result of the invoked callback. - * @template R - */ - thenCatch(errback: (error: any) => any): Promise; - /** * Registers a listener for when this promise is rejected. This is synonymous * with the {@code catch} clause in a synchronous API: @@ -1089,47 +1061,6 @@ export namespace promise { catch(errback: Function): Promise; - /** - * Registers a listener to invoke when this promise is resolved, regardless - * of whether the promise's value was successfully computed. This function - * is synonymous with the {@code finally} clause in a synchronous API: - *

-     *   // Synchronous API:
-     *   try {
-     *     doSynchronousWork();
-     *   } finally {
-     *     cleanUp();
-     *   }
-     *
-     *   // Asynchronous promise API:
-     *   doAsynchronousWork().thenFinally(cleanUp);
-     * 
- * - * Note: similar to the {@code finally} clause, if the registered - * callback returns a rejected promise or throws an error, it will silently - * replace the rejection error (if any) from this promise: - *

-     *   try {
-     *     throw Error('one');
-     *   } finally {
-     *     throw Error('two');  // Hides Error: one
-     *   }
-     *
-     *   promise.rejected(Error('one'))
-     *       .thenFinally(function() {
-     *         throw Error('two');  // Hides Error: one
-     *       });
-     * 
- * - * - * @param {function(): (R|promise.Promise.)} callback The function - * to call when this promise is resolved. - * @return {!promise.Promise.} A promise that will be fulfilled - * with the callback result. - * @template R - */ - thenFinally(callback: Function): Promise; - // endregion } @@ -1144,13 +1075,8 @@ export namespace promise { * the next turn of the event loop, the rejection will be passed to the * {@link promise.ControlFlow} as an unhandled failure. * - *

If this Deferred is cancelled, the cancellation reason will be forward to - * the Deferred's canceller function (if provided). The canceller may return a - * truth-y value to override the reason provided for rejection. - * - * @extends {promise.Promise} */ - class Deferred extends Promise { + class Deferred { // region Constructors /** @@ -2121,32 +2047,6 @@ export class AlertPromise extends Alert implements promise.IThenable { */ then(opt_callback?: Function, opt_errback?: Function): promise.Promise; - /** - * Registers a listener for when this promise is rejected. This is synonymous - * with the {@code catch} clause in a synchronous API: - *


-   *   // Synchronous API:
-   *   try {
-   *     doSynchronousWork();
-   *   } catch (ex) {
-   *     console.error(ex);
-   *   }
-   *
-   *   // Asynchronous promise API:
-   *   doAsynchronousWork().thenCatch(function(ex) {
-   *     console.error(ex);
-   *   });
-   * 
- * - * @param {function(*): (R|promise.Promise.)} errback The function - * to call if this promise is rejected. The function should expect a single - * argument: the rejection reason. - * @return {!promise.Promise.} A new promise which will be - * resolved with the result of the invoked callback. - * @template R - */ - thenCatch(errback: (error: any) => any): promise.Promise; - /** * Registers a listener for when this promise is rejected. This is synonymous * with the {@code catch} clause in a synchronous API: @@ -2171,52 +2071,6 @@ export class AlertPromise extends Alert implements promise.IThenable { * @template R */ catch(errback: Function): promise.Promise; - - - /** - * Registers a listener to invoke when this promise is resolved, regardless - * of whether the promise's value was successfully computed. This function - * is synonymous with the {@code finally} clause in a synchronous API: - *

-   *   // Synchronous API:
-   *   try {
-   *     doSynchronousWork();
-   *   } finally {
-   *     cleanUp();
-   *   }
-   *
-   *   // Asynchronous promise API:
-   *   doAsynchronousWork().thenFinally(cleanUp);
-   * 
- * - * Note: similar to the {@code finally} clause, if the registered - * callback returns a rejected promise or throws an error, it will silently - * replace the rejection error (if any) from this promise: - *

-   *   try {
-   *     throw Error('one');
-   *   } finally {
-   *     throw Error('two');  // Hides Error: one
-   *   }
-   *
-   *   promise.rejected(Error('one'))
-   *       .thenFinally(function() {
-   *         throw Error('two');  // Hides Error: one
-   *       });
-   * 
- * - * - * @param {function(): (R|promise.Promise.)} callback The function - * to call when this promise is resolved. - * @return {!promise.Promise.} A promise that will be fulfilled - * with the callback result. - * @template R - */ - thenFinally(callback: Function): promise.Promise; -} - -/** @deprecated Use {@link error.UnexpectedAlertOpenError} instead. */ -export class UnhandledAlertError extends error.UnexpectedAlertOpenError { } /** @@ -2495,6 +2349,15 @@ export class Builder { setScrollBehavior(behavior: number): Builder; /** + * Sets the http agent to use for each request. + * If this method is not called, the Builder will use http.globalAgent by default. + * + * @param {http.Agent} agent The agent to use for each request. + * @return {!Builder} A self reference. + */ + usingHttpAgent(agent: any): Builder; + + /** * Sets the URL of a remote WebDriver server to use. Once a remote URL has been * specified, the builder direct all new clients to that server. If this method * is never called, the Builder will attempt to create all clients locally. @@ -3122,19 +2985,6 @@ export class Executor { execute(command: Command): promise.Promise } -/** - * Wraps a promised {@link Executor}, ensuring no commands are executed until - * the wrapped executor has been fully resolved. - * @implements {Executor} - */ -export class DeferredExecutor { - /** - * @param {!promise.Promise} delegate The promised delegate, which - * may be provided by any promise-like thenable object. - */ - constructor(delegate: promise.Promise); -} - /** * Describes an event listener registered on an {@linkplain EventEmitter}. */ @@ -3287,12 +3137,53 @@ export class Navigation { } interface IWebDriverOptionsCookie { + + /** + * The name of the cookie. + */ name: string; + + /** + * The cookie value. + */ value: string; + + /** + * The cookie path. Defaults to "/" when adding a cookie. + */ path?: string; + + /** + * The domain the cookie is visible to. Defaults to the current browsing + * context's document's URL when adding a cookie. + */ domain?: string; + + /** + * Whether the cookie is a secure cookie. Defaults to false when adding a new + * cookie. + */ secure?: boolean; - expiry?: number; + + /** + * Whether the cookie is an HTTP only cookie. Defaults to false when adding a + * new cookie. + */ + httpOnly?: boolean; + + /** + * When the cookie expires. + * + * When {@linkplain Options#addCookie() adding a cookie}, this may be specified + * in _seconds_ since Unix epoch (January 1, 1970). The expiry will default to + * 20 years in the future if omitted. + * + * The expiry is always returned in seconds since epoch when + * {@linkplain Options#getCookies() retrieving cookies} from the browser. + * + * @type {(!Date|number|undefined)} + */ + expiry?: number | Date; } /** @@ -3313,18 +3204,14 @@ export class Options { /** * Schedules a command to add a cookie. - * @param {string} name The cookie name. - * @param {string} value The cookie value. - * @param {string=} opt_path The cookie path. - * @param {string=} opt_domain The cookie domain. - * @param {boolean=} opt_isSecure Whether the cookie is secure. - * @param {(number|!Date)=} opt_expiry When the cookie expires. If specified - * as a number, should be in milliseconds since midnight, - * January 1, 1970 UTC. + * @param {IWebDriverOptionsCookie} spec Defines the cookie to add. * @return {!promise.Promise} A promise that will be resolved * when the cookie has been added to the page. + * @throws {error.InvalidArgumentError} if any of the cookie parameters are + * invalid. + * @throws {TypeError} if `spec` is not a cookie object. */ - addCookie(name: string, value: string, opt_path?: string, opt_domain?: string, opt_isSecure?: boolean, opt_expiry?: number | Date): promise.Promise; + addCookie(spec: IWebDriverOptionsCookie): webdriver.promise.Promise; /** * Schedules a command to delete all cookies visible to the current page. @@ -4061,7 +3948,7 @@ export class WebDriver { * by the driver. Unlike other commands, this error cannot be suppressed. In * other words, scheduling a command to find an element doubles as an assert * that the element is present on the page. To test whether an element is - * present on the page, use {@link #isElementPresent} instead. + * present on the page, use {@link #findElements}. * * The search criteria for an element may be defined using one of the * factories in the {@link By} namespace, or as a short-hand @@ -4093,24 +3980,6 @@ export class WebDriver { */ findElement(locator: By | Function): WebElementPromise; - /** - * Schedules a command to test if an element is present on the page. - * - * If given a DOM element, this function will check if it belongs to the - * document the driver is currently focused on. Otherwise, the function will - * test if at least one element can be found with the given search criteria. - * - * @param {!(by.By|Function)} locator The locator to use. - * @return {!promise.Promise} A promise that will resolve - * with whether the element is present on the page. - * @deprecated This method will be removed in Selenium 3.0 for consistency - * with the other Selenium language bindings. This method is equivalent - * to - * - * driver.findElements(locator).then(e => !!e.length); - */ - isElementPresent(locatorOrElement: By | Function): promise.Promise; - /** * Schedule a command to search for multiple elements on the page. * @@ -4366,13 +4235,6 @@ interface IWebElement { */ isDisplayed(): promise.Promise; - /** - * Schedules a command to retrieve the outer HTML of this element. - * @return {!promise.Promise} A promise that will be resolved with - * the element's outer HTML. - */ - getOuterHtml(): promise.Promise; - /** * @return {!promise.Promise.} A promise * that resolves to this element's JSON representation as defined by the @@ -4381,13 +4243,6 @@ interface IWebElement { */ getId(): promise.Promise; - /** - * Schedules a command to retrieve the inner HTML of this element. - * @return {!promise.Promise} A promise that will be resolved with the - * element's inner HTML. - */ - getInnerHtml(): promise.Promise; - // endregion } @@ -4398,7 +4253,7 @@ interface IWebElementFinders { * be returned by the driver. Unlike other commands, this error cannot be * suppressed. In other words, scheduling a command to find an element doubles * as an assert that the element is present on the page. To test whether an - * element is present on the page, use {@code #isElementPresent} instead. + * element is present on the page, use {@code #findElements}. * *

The search criteria for an element may be defined using one of the * factories in the {@link By} namespace, or as a short-hand @@ -4434,17 +4289,6 @@ interface IWebElementFinders { */ findElement(locator: By | Function): WebElementPromise; - /** - * Schedules a command to test if there is at least one descendant of this - * element that matches the given search criteria. - * - * @param {!(Locator|By.Hash|Function)} locator The - * locator strategy to use when searching for the element. - * @return {!promise.Promise.} A promise that will be - * resolved with whether an element could be located on the page. - */ - isElementPresent(locator: By | Function): promise.Promise; - /** * Schedules a command to find all of the descendants of this element that * match the given search criteria. @@ -4551,18 +4395,13 @@ export class WebElement implements Serializable { */ getId(): promise.Promise; - /** - * @deprecated Use {@link #getId()} instead. - */ - getRawId(): any; - /** * Schedule a command to find a descendant of this element. If the element * cannot be found, a {@link bot.ErrorCode.NO_SUCH_ELEMENT} result will * be returned by the driver. Unlike other commands, this error cannot be * suppressed. In other words, scheduling a command to find an element doubles * as an assert that the element is present on the page. To test whether an - * element is present on the page, use {@link #isElementPresent} instead. + * element is present on the page, use {@link #findElements}. * * The search criteria for an element may be defined using one of the * factories in the {@link By} namespace, or as a short-hand @@ -4596,22 +4435,6 @@ export class WebElement implements Serializable { */ findElement(locator: By | Function): WebElementPromise; - /** - * Schedules a command to test if there is at least one descendant of this - * element that matches the given search criteria. - * - * @param {!(by.By|Function)} locator The locator strategy to use when - * searching for the element. - * @return {!promise.Promise} A promise that will be - * resolved with whether an element could be located on the page. - * @deprecated This method will be removed in Selenium 3.0 for consistency - * with the other Selenium language bindings. This method is equivalent - * to - * - * element.findElements(locator).then(e => !!e.length); - */ - isElementPresent(locator: By | Function): promise.Promise; - /** * Schedules a command to find all of the descendants of this element that * match the given search criteria. @@ -4817,20 +4640,6 @@ export class WebElement implements Serializable { */ takeScreenshot(opt_scroll?: boolean): promise.Promise; - /** - * Schedules a command to retrieve the outer HTML of this element. - * @return {!promise.Promise.} A promise that will be - * resolved with the element's outer HTML. - */ - getOuterHtml(): promise.Promise; - - /** - * Schedules a command to retrieve the inner HTML of this element. - * @return {!promise.Promise} A promise that will be resolved with the - * element's inner HTML. - */ - getInnerHtml(): promise.Promise; - /** @override */ serialize(): promise.Promise; } @@ -4908,74 +4717,6 @@ export class WebElementPromise extends WebElement implements promise.IThenable(opt_callback?: (value: WebElement) => R, opt_errback?: (error: any) => any): promise.Promise; - /** - * Registers a listener for when this promise is rejected. This is synonymous - * with the {@code catch} clause in a synchronous API: - *


-   *   // Synchronous API:
-   *   try {
-   *     doSynchronousWork();
-   *   } catch (ex) {
-   *     console.error(ex);
-   *   }
-   *
-   *   // Asynchronous promise API:
-   *   doAsynchronousWork().thenCatch(function(ex) {
-   *     console.error(ex);
-   *   });
-   * 
- * - * @param {function(*): (R|promise.Promise.)} errback The function - * to call if this promise is rejected. The function should expect a single - * argument: the rejection reason. - * @return {!promise.Promise.} A new promise which will be - * resolved with the result of the invoked callback. - * @template R - */ - thenCatch(errback: (error: any) => any): promise.Promise; - - - /** - * Registers a listener to invoke when this promise is resolved, regardless - * of whether the promise's value was successfully computed. This function - * is synonymous with the {@code finally} clause in a synchronous API: - *

-   *   // Synchronous API:
-   *   try {
-   *     doSynchronousWork();
-   *   } finally {
-   *     cleanUp();
-   *   }
-   *
-   *   // Asynchronous promise API:
-   *   doAsynchronousWork().thenFinally(cleanUp);
-   * 
- * - * Note: similar to the {@code finally} clause, if the registered - * callback returns a rejected promise or throws an error, it will silently - * replace the rejection error (if any) from this promise: - *

-   *   try {
-   *     throw Error('one');
-   *   } finally {
-   *     throw Error('two');  // Hides Error: one
-   *   }
-   *
-   *   promise.rejected(Error('one'))
-   *       .thenFinally(function() {
-   *         throw Error('two');  // Hides Error: one
-   *       });
-   * 
- * - * - * @param {function(): (R|promise.Promise.)} callback The function - * to call when this promise is resolved. - * @return {!promise.Promise.} A promise that will be fulfilled - * with the callback result. - * @template R - */ - thenFinally(callback: () => any): promise.Promise; - /** * Registers a listener for when this promise is rejected. This is synonymous * with the {@code catch} clause in a synchronous API: diff --git a/selenium-webdriver/test/index.ts b/selenium-webdriver/test/index.ts index 5d32724b15..80f489d5ac 100644 --- a/selenium-webdriver/test/index.ts +++ b/selenium-webdriver/test/index.ts @@ -1,16 +1,10 @@ import * as webdriver from 'selenium-webdriver'; import * as chrome from 'selenium-webdriver/chrome'; import * as firefox from 'selenium-webdriver/firefox'; +import * as http from 'selenium-webdriver/http'; import * as remote from 'selenium-webdriver/remote'; -import * as executors from 'selenium-webdriver/executors'; import * as testing from 'selenium-webdriver/testing'; -function TestExecutors() { - var exec: webdriver.Executor = executors.createExecutor('url'); - var promise: webdriver.promise.Promise; - exec = executors.createExecutor(promise); -} - function TestBuilder() { var builder: webdriver.Builder = new webdriver.Builder(); @@ -219,11 +213,6 @@ function TestCommand() { command = command.setParameters({ param: 123 }); } -function TestDeferredExecutor() { - var promise: webdriver.promise.Promise; - var executor: webdriver.DeferredExecutor = new webdriver.DeferredExecutor(promise); -} - function TestCommandName() { var command: string; @@ -469,14 +458,6 @@ function TestSession() { var data: string = session.toJSON(); } -function TestUnhandledAlertError() { - var someFunc = (error: webdriver.UnhandledAlertError) => { - var baseError: Error = error; - var str: string = error.getAlertText(); - str = error.toString(); - }; -} - function TestWebDriverFileDetector() { var driver: webdriver.WebDriver = new webdriver.Builder(). withCapabilities(webdriver.Capabilities.chrome()). @@ -519,13 +500,21 @@ function TestWebDriverOptions() { var options: webdriver.Options = new webdriver.Options(driver); var promise: webdriver.promise.Promise; + var name: string = 'name'; + var value: string = 'value'; + var path: string = 'path'; + var domain: string = 'domain'; + var secure: boolean = true; + var httpOnly: boolean = true; + // Add Cookie - promise = options.addCookie('name', 'value'); - promise = options.addCookie('name', 'value', 'path'); - promise = options.addCookie('name', 'value', 'path', 'domain'); - promise = options.addCookie('name', 'value', 'path', 'domain', true); - promise = options.addCookie('name', 'value', 'path', 'domain', true, 123); - promise = options.addCookie('name', 'value', 'path', 'domain', true, Date.now()); + promise = options.addCookie({ name, value }); + promise = options.addCookie({ name, value, path }); + promise = options.addCookie({ name, value, path, domain }); + promise = options.addCookie({ name, value, path, domain, secure }); + promise = options.addCookie({ name, value, path, domain, secure, httpOnly }); + promise = options.addCookie({ name, value, path, domain, secure, httpOnly, expiry: 123 }); + promise = options.addCookie({ name, value, path, domain, secure, httpOnly, expiry: Date.now() }); promise = options.deleteAllCookies(); promise = options.deleteCookie('name'); @@ -585,7 +574,8 @@ function TestWebDriverWindow() { function TestWebDriver() { var session: webdriver.Session = new webdriver.Session('ABC', webdriver.Capabilities.android()); var sessionPromise: webdriver.promise.Promise; - var executor: webdriver.Executor = executors.createExecutor('http://someserver'); + var httpClient: http.HttpClient = new http.HttpClient('http://someserver'); + var executor: http.Executor = new http.Executor(httpClient); var flow: webdriver.promise.ControlFlow = new webdriver.promise.ControlFlow(); var driver: webdriver.WebDriver = new webdriver.WebDriver(session, executor); driver = new webdriver.WebDriver(session, executor, flow); @@ -638,9 +628,6 @@ function TestWebDriver() { stringPromise = driver.getTitle(); stringPromise = driver.getWindowHandle(); - booleanPromise = driver.isElementPresent(webdriver.By.className('ABC')); - booleanPromise = driver.isElementPresent(webdriver.By.js('function(){}')); - var options: webdriver.Options = driver.manage(); var navigation: webdriver.Navigation = driver.navigate(); var locator: webdriver.TargetLocator = driver.switchTo(); @@ -691,14 +678,11 @@ function TestWebElement() { element = element.findElement(webdriver.By.id('ABC')); element.findElements(webdriver.By.className('ABC')).then((elements: webdriver.WebElement[]) => {}); - booleanPromise = element.isElementPresent(webdriver.By.className('ABC')); stringPromise = element.getAttribute('class'); stringPromise = element.getCssValue('display'); driver = element.getDriver(); - stringPromise = element.getInnerHtml(); element.getLocation().then((location: webdriver.ILocation) => {}); - stringPromise = element.getOuterHtml(); element.getSize().then((size: webdriver.ISize) => {}); stringPromise = element.getTagName(); stringPromise = element.getText(); @@ -712,7 +696,6 @@ function TestWebElement() { voidPromise = element.sendKeys('A', 1, webdriver.Key.BACK_SPACE, stringPromise); voidPromise = element.submit(); element.getId().then((id: string) => {}); - element.getRawId().then((id: string) => {}); element.serialize().then((id: webdriver.IWebElementId) => {}); booleanPromise = webdriver.WebElement.equals(element, new webdriver.WebElement(driver, 'elementId')); @@ -734,10 +717,6 @@ function TestWebElementPromise() { elementPromise.then((element: webdriver.WebElement) => {}); elementPromise.then((element: webdriver.WebElement) => {}, (error: any) => {}); elementPromise.then((element: webdriver.WebElement) => 'foo', (error: any) => {}).then((result: string) => {}); - - elementPromise.thenCatch((error: any) => {}).then((value: any) => {}); - - elementPromise.thenFinally(() => {}); } function TestLogging() { @@ -963,10 +942,6 @@ function TestPromiseClass() { promise = promise.then((a: string) => 'cde'); promise = promise.then((a: string) => 'cde', (e: any) => {}); promise = promise.then((a: string) => 'cde', (e: any) => 123); - - promise = promise.thenCatch((error: any) => {}); - - promise.thenFinally(() => {}); } function TestThenableClass() { @@ -981,39 +956,6 @@ function TestThenableClass() { thenable = thenable.then((a: string) => 'cde'); thenable = thenable.then((a: string) => 'cde', (e: any) => {}); thenable = thenable.then((a: string) => 'cde', (e: any) => 123); - - thenable = thenable.thenCatch((error: any) => {}); - - thenable.thenFinally(() => {}); -} - -function TestErrorCode() { - var errorCode: number; - - errorCode = new webdriver.error.ElementNotSelectableError().code(); - errorCode = new webdriver.error.ElementNotVisibleError().code(); - errorCode = new webdriver.error.InvalidArgumentError().code(); - errorCode = new webdriver.error.InvalidCookieDomainError().code(); - errorCode = new webdriver.error.InvalidElementCoordinatesError().code(); - errorCode = new webdriver.error.InvalidElementStateError().code(); - errorCode = new webdriver.error.InvalidSelectorError().code(); - errorCode = new webdriver.error.NoSuchSessionError().code(); - errorCode = new webdriver.error.JavascriptError().code(); - errorCode = new webdriver.error.MoveTargetOutOfBoundsError().code(); - errorCode = new webdriver.error.NoSuchAlertError().code(); - errorCode = new webdriver.error.NoSuchElementError().code(); - errorCode = new webdriver.error.NoSuchFrameError().code(); - errorCode = new webdriver.error.NoSuchWindowError().code(); - errorCode = new webdriver.error.ScriptTimeoutError().code(); - errorCode = new webdriver.error.SessionNotCreatedError().code(); - errorCode = new webdriver.error.StaleElementReferenceError().code(); - errorCode = new webdriver.error.TimeoutError().code(); - errorCode = new webdriver.error.UnableToSetCookieError().code(); - errorCode = new webdriver.error.UnableToCaptureScreenError().code(); - errorCode = new webdriver.error.UnexpectedAlertOpenError().code(); - errorCode = new webdriver.error.UnknownCommandError().code(); - errorCode = new webdriver.error.UnknownMethodError().code(); - errorCode = new webdriver.error.UnsupportedOperationError().code(); } async function TestAsyncAwaitable() {