+ * var e1 = element.findElement(By.id('foo'));
+ * var e2 = element.findElement({id:'foo'});
+ *
+ *
+ * Note that JS locator searches cannot be restricted to a subtree. All such
+ * searches are delegated to this instance's parent WebDriver.
+ *
+ * @param {webdriver.Locator|Object.
+ * element.sendKeys("text was",
+ * webdriver.Key.CONTROL, "a", webdriver.Key.NULL,
+ * "now text is");
+ * // Alternatively:
+ * element.sendKeys("text was",
+ * webdriver.Key.chord(webdriver.Key.CONTROL, "a"),
+ * "now text is");
+ * async, autofocus, autoplay, checked, compact, complete, controls, declare, + * defaultchecked, defaultselected, defer, disabled, draggable, ended, + * formnovalidate, hidden, indeterminate, iscontenteditable, ismap, itemscope, + * loop, multiple, muted, nohref, noresize, noshade, novalidate, nowrap, open, + * paused, pubdate, readonly, required, reversed, scoped, seamless, seeking, + * selected, spellcheck, truespeed, willvalidate + * + *
Finally, the following commonly mis-capitalized attribute/property names + * are evaluated as expected: + *
Note that JS locator searches cannot be restricted to a subtree of the
+ * DOM. All such searches are delegated to this instance's parent WebDriver.
+ *
+ * @param {webdriver.Locator|Object. The search criteria for find an element may either be a
+ * {@code webdriver.Locator} object, or a simple JSON object whose sole key
+ * is one of the accepted locator strategies, as defined by
+ * {@code webdriver.Locator.Strategy}. For example, the following two statements
+ * are equivalent:
+ * When running in the browser, a WebDriver cannot manipulate DOM elements
+ * directly; it may do so only through a {@link webdriver.WebElement} reference.
+ * This function may be used to generate a WebElement from a DOM element. A
+ * reference to the DOM element will be stored in a known location and this
+ * driver will attempt to retrieve it through {@link #executeScript}. If the
+ * element cannot be found (eg, it belongs to a different document than the
+ * one this instance is currently focused on), a
+ * {@link bot.ErrorCode.NO_SUCH_ELEMENT} error will be returned.
+ *
+ * @param {!(webdriver.Locator|Object. If this Deferred is rejected and there are no listeners registered before
+ * the next turn of the event loop, the rejection will be passed to the
+ * {@link webdriver.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 {webdriver.promise.Promise}
+ */
+ class Deferred extends Promise {
+ //region Constructors
+
+ /**
+ *
+ * @param {Function=} opt_canceller Function to call when cancelling the
+ * computation of this instance's value.
+ * @param {webdriver.promise.ControlFlow=} opt_flow The control flow
+ * this instance was created under. This should only be provided during
+ * unit tests.
+ * @constructor
+ */
+ constructor(opt_canceller?: any, opt_flow?: webdriver.promise.ControlFlow);
+
+ //endregion
+
+ //region Properties
+
+ /**
+ * The consumer promise for this instance. Provides protected access to the
+ * callback registering functions.
+ * @type {!webdriver.promise.Promise}
+ */
+ promise: webdriver.promise.Promise;
+
+ //endregion
+
+ //region Methods
+
+ /**
+ * Rejects this promise. If the error is itself a promise, this instance will
+ * be chained to it and be rejected with the error's resolved value.
+ * @param {*=} opt_error The rejection reason, typically either a
+ * {@code Error} or a {@code string}.
+ */
+ reject(opt_error?: any): void;
+ errback(opt_error?: any): void;
+
+ /**
+ * Resolves this promise with the given value. If the value is itself a
+ * promise and not a reference to this deferred, this instance will wait for
+ * it before resolving.
+ * @param {*=} opt_value The resolved value.
+ */
+ fulfill(opt_value?: any): void;
+
+ /**
+ * Cancels the computation of this promise's value and flags the promise as a
+ * rejected value.
+ * @param {*=} opt_reason The reason for cancelling this promise.
+ */
+ cancel(opt_reason?: any): void;
+
+ /**
+ * Removes all of the listeners previously registered on this deferred.
+ * @throws {Error} If this deferred has already been resolved.
+ */
+ removeAll(): void;
+
+ //endregion
+ }
+
+ interface IControlFlowTimer {
+ clearInterval: (ms: number) => void;
+ clearTimeout: (ms: number) => void;
+ setInterval: (fn: any, ms: number) => number;
+ setTimeout: (fn: any, ms: number) => number;
+ }
+
+ /**
+ * Handles the execution of scheduled tasks, each of which may be an
+ * asynchronous operation. The control flow will ensure tasks are executed in
+ * the ordered scheduled, starting each task only once those before it have
+ * completed.
+ *
+ * Each task scheduled within this flow may return a
+ * {@link webdriver.promise.Promise} to indicate it is an asynchronous
+ * operation. The ControlFlow will wait for such promises to be resolved before
+ * marking the task as completed.
+ *
+ * Tasks and each callback registered on a {@link webdriver.promise.Deferred}
+ * will be run in their own ControlFlow frame. Any tasks scheduled within a
+ * frame will have priority over previously scheduled tasks. Furthermore, if
+ * any of the tasks in the frame fails, the remainder of the tasks in that frame
+ * will be discarded and the failure will be propagated to the user through the
+ * callback/task's promised result.
+ *
+ * Each time a ControlFlow empties its task queue, it will fire an
+ * {@link webdriver.promise.ControlFlow.EventType.IDLE} event. Conversely,
+ * whenever the flow terminates due to an unhandled error, it will remove all
+ * remaining tasks in its queue and fire an
+ * {@link webdriver.promise.ControlFlow.EventType.UNCAUGHT_EXCEPTION} event. If
+ * there are no listeners registered with the flow, the error will be
+ * rethrown to the global error handler.
+ *
+ * @extends {webdriver.EventEmitter}
+ */
+ class ControlFlow extends webdriver.EventEmitter {
+
+ //region Constructors
+
+ /**
+ * @param {webdriver.promise.ControlFlow.Timer=} opt_timer The timer object
+ * to use. Should only be set for testing.
+ * @constructor
+ */
+ constructor(opt_timer?: webdriver.promise.IControlFlowTimer);
+
+ //endregion
+
+ //region Properties
+
+ /**
+ * The timer used by this instance.
+ * @type {webdriver.promise.ControlFlow.Timer}
+ */
+ timer: webdriver.promise.IControlFlowTimer;
+
+ //endregion
+
+ //region Static Properties
+
+ /**
+ * The default timer object, which uses the global timer functions.
+ * @type {webdriver.promise.ControlFlow.Timer}
+ */
+ static defaultTimer: webdriver.promise.IControlFlowTimer;
+
+ /**
+ * Events that may be emitted by an {@link webdriver.promise.ControlFlow}.
+ * @enum {string}
+ */
+ static EventType: {
+ /** Emitted when all tasks have been successfully executed. */
+ IDLE: string;
+
+ /** Emitted whenever a new task has been scheduled. */
+ SCHEDULE_TASK: string;
+
+ /**
+ * Emitted whenever a control flow aborts due to an unhandled promise
+ * rejection. This event will be emitted along with the offending rejection
+ * reason. Upon emitting this event, the control flow will empty its task
+ * queue and revert to its initial state.
+ */
+ UNCAUGHT_EXCEPTION: string;
+ };
+
+ /**
+ * How often, in milliseconds, the event loop should run.
+ * @type {number}
+ * @const
+ */
+ static EVENT_LOOP_FREQUENCY: number;
+
+ //endregion
+
+ //region Methods
+
+ /**
+ * Resets this instance, clearing its queue and removing all event listeners.
+ */
+ reset(): void;
+
+ /**
+ * Returns a summary of the recent task activity for this instance. This
+ * includes the most recently completed task, as well as any parent tasks. In
+ * the returned summary, the task at index N is considered a sub-task of the
+ * task at index N+1.
+ * @return {!Array. Condition functions may schedule sub-tasks with this instance, however,
+ * their execution time will be factored into whether a wait has timed out.
+ *
+ * In the event a condition returns a Promise, the polling loop will wait for
+ * it to be resolved before evaluating whether the condition has been satisfied.
+ * The resolution time for a promise is factored into whether a wait has timed
+ * out.
+ *
+ * If the condition function throws, or returns a rejected promise, the
+ * wait task will fail.
+ *
+ * @param {!Function} condition The condition function to poll.
+ * @param {number} timeout How long to wait, in milliseconds, for the condition
+ * to hold before timing out.
+ * @param {string=} opt_message An optional error message to include if the
+ * wait times out; defaults to the empty string.
+ * @return {!webdriver.promise.Promise} A promise that will be resolved when the
+ * condition has been satisified. The promise shall be rejected if the wait
+ * times out waiting for the condition.
+ */
+ wait(condition: any, timeout: number, opt_message?: string): webdriver.promise.Promise;
+
+ /**
+ * Schedules a task that will wait for another promise to resolve. The resolved
+ * promise's value will be returned as the task result.
+ * @param {!webdriver.promise.Promise} promise The promise to wait on.
+ * @return {!webdriver.promise.Promise} A promise that will resolve when the
+ * task has completed.
+ */
+ await(promise: webdriver.promise.Promise): webdriver.promise.Promise;
+
+ //endregion
+ }
+ }
+
+ module error {
+
+ // NOTE: A class was used instead of an Enum so that it could be extended in Protractor.
+ class ErrorCode {
+ static SUCCESS: number;
+
+ static NO_SUCH_ELEMENT: number;
+ static NO_SUCH_FRAME: number;
+ static UNKNOWN_COMMAND: number;
+ static UNSUPPORTED_OPERATION: number; // Alias for UNKNOWN_COMMAND.
+ static STALE_ELEMENT_REFERENCE: number;
+ static ELEMENT_NOT_VISIBLE: number;
+ static INVALID_ELEMENT_STATE: number;
+ static UNKNOWN_ERROR: number;
+ static ELEMENT_NOT_SELECTABLE: number;
+ static JAVASCRIPT_ERROR: number;
+ static XPATH_LOOKUP_ERROR: number;
+ static TIMEOUT: number;
+ static NO_SUCH_WINDOW: number;
+ static INVALID_COOKIE_DOMAIN: number;
+ static UNABLE_TO_SET_COOKIE: number;
+ static MODAL_DIALOG_OPENED: number;
+ static NO_MODAL_DIALOG_OPEN: number;
+ static SCRIPT_TIMEOUT: number;
+ static INVALID_ELEMENT_COORDINATES: number;
+ static IME_NOT_AVAILABLE: number;
+ static IME_ENGINE_ACTIVATION_FAILED: number;
+ static INVALID_SELECTOR_ERROR: number;
+ static SESSION_NOT_CREATED: number;
+ static MOVE_TARGET_OUT_OF_BOUNDS: number;
+ static SQL_DATABASE_ERROR: number;
+ static INVALID_XPATH_SELECTOR: number;
+ static INVALID_XPATH_SELECTOR_RETURN_TYPE: number;
+ // The following error codes are derived straight from HTTP return codes.
+ static METHOD_NOT_ALLOWED: number;
+ }
+
+ /**
+ * Error extension that includes error status codes from the WebDriver wire
+ * protocol:
+ * http://code.google.com/p/selenium/wiki/JsonWireProtocol#Response_Status_Codes
+ *
+ * @extends {Error}
+ */
+ class Error {
+
+ //region Constructors
+
+ /**
+ * @param {!bot.ErrorCode} code The error's status code.
+ * @param {string=} opt_message Optional error message.
+ * @constructor
+ */
+ constructor(code: number, opt_message?: string);
+
+ //endregion
+
+ //region Static Properties
+
+ /**
+ * Status strings enumerated in the W3C WebDriver working draft.
+ * @enum {string}
+ * @see http://www.w3.org/TR/webdriver/#status-codes
+ */
+ static State: {
+ ELEMENT_NOT_SELECTABLE: string;
+ ELEMENT_NOT_VISIBLE: string;
+ IME_ENGINE_ACTIVATION_FAILED: string;
+ IME_NOT_AVAILABLE: string;
+ INVALID_COOKIE_DOMAIN: string;
+ INVALID_ELEMENT_COORDINATES: string;
+ INVALID_ELEMENT_STATE: string;
+ INVALID_SELECTOR: string;
+ JAVASCRIPT_ERROR: string;
+ MOVE_TARGET_OUT_OF_BOUNDS: string;
+ NO_SUCH_ALERT: string;
+ NO_SUCH_DOM: string;
+ NO_SUCH_ELEMENT: string;
+ NO_SUCH_FRAME: string;
+ NO_SUCH_WINDOW: string;
+ SCRIPT_TIMEOUT: string;
+ SESSION_NOT_CREATED: string;
+ STALE_ELEMENT_REFERENCE: string;
+ SUCCESS: string;
+ TIMEOUT: string;
+ UNABLE_TO_SET_COOKIE: string;
+ UNEXPECTED_ALERT_OPEN: string;
+ UNKNOWN_COMMAND: string;
+ UNKNOWN_ERROR: string;
+ UNSUPPORTED_OPERATION: string;
+ }
+
+ //endregion
+
+ //region Properties
+
+ /**
+ * This error's status code.
+ * @type {!bot.ErrorCode}
+ */
+ code: number;
+
+ /** @type {string} */
+ state: string;
+
+ /** @override */
+ message: string;
+
+ /** @override */
+ name: string;
+
+ /** @override */
+ stack: string;
+
+ /**
+ * Flag used for duck-typing when this code is embedded in a Firefox extension.
+ * This is required since an Error thrown in one component and then reported
+ * to another will fail instanceof checks in the second component.
+ * @type {boolean}
+ */
+ isAutomationError: boolean;
+
+ //endregion
+
+ //region Methods
+
+ /** @return {string} The string representation of this error. */
+ toString(): string;
+
+ //endregion
+ }
+ }
+
+ module process {
+
+ /**
+ * Queries for a named environment variable.
+ * @param {string} name The name of the environment variable to look up.
+ * @param {string=} opt_default The default value if the named variable is not
+ * defined.
+ * @return {string} The queried environment variable.
+ */
+ function getEnv(name: string, opt_default?: string): string;
+
+ /**
+ * @return {boolean} Whether the current process is Node's native process
+ * object.
+ */
+ function isNative(): boolean;
+
+ /**
+ * Sets an environment value. If the new value is either null or undefined, the
+ * environment variable will be cleared.
+ * @param {string} name The value to set.
+ * @param {*} value The new value; will be coerced to a string.
+ */
+ function setEnv(name: string, value: any): void;
+
+ }
+
+ /**
+ * Creates new {@code webdriver.WebDriver} clients. Upon instantiation, each
+ * Builder will configure itself based on the following environment variables:
+ * Example: If an element is provided, the mouse will first be moved to the center
+ * of that element. This is equivalent to:
+ * Warning: this method currently only supports the left mouse button. See
+ * http://code.google.com/p/selenium/issues/detail?id=4047
+ *
+ * @param {(webdriver.WebElement|webdriver.Button)=} opt_elementOrButton Either
+ * the element to interact with or the button to click with.
+ * Defaults to {@link webdriver.Button.LEFT} if neither an element nor
+ * button is specified.
+ * @param {webdriver.Button=} opt_button The button to use. Defaults to
+ * {@link webdriver.Button.LEFT}. Ignored if a button is provided as the
+ * first argument.
+ * @return {!webdriver.ActionSequence} A self reference.
+ */
+ mouseDown(opt_elementOrButton?: webdriver.WebElement, opt_button?: number): ActionSequence;
+ mouseDown(opt_elementOrButton?: number): ActionSequence;
+
+ /**
+ * Releases a mouse button. Behavior is undefined for calling this function
+ * without a previous call to {@link #mouseDown}.
+ *
+ * If an element is provided, the mouse will first be moved to the center
+ * of that element. This is equivalent to:
+ * Warning: this method currently only supports the left mouse button. See
+ * http://code.google.com/p/selenium/issues/detail?id=4047
+ *
+ * @param {(webdriver.WebElement|webdriver.Button)=} opt_elementOrButton Either
+ * the element to interact with or the button to click with.
+ * Defaults to {@link webdriver.Button.LEFT} if neither an element nor
+ * button is specified.
+ * @param {webdriver.Button=} opt_button The button to use. Defaults to
+ * {@link webdriver.Button.LEFT}. Ignored if a button is provided as the
+ * first argument.
+ * @return {!webdriver.ActionSequence} A self reference.
+ */
+ mouseUp(opt_elementOrButton?: webdriver.WebElement, opt_button?: number): ActionSequence;
+ mouseUp(opt_elementOrButton?: number): ActionSequence;
+
+ /**
+ * Convenience function for performing a "drag and drop" manuever. The target
+ * element may be moved to the location of another element, or by an offset (in
+ * pixels).
+ * @param {!webdriver.WebElement} element The element to drag.
+ * @param {(!webdriver.WebElement|{x: number, y: number})} location The
+ * location to drag to, either as another WebElement or an offset in pixels.
+ * @return {!webdriver.ActionSequence} A self reference.
+ */
+ dragAndDrop(element: webdriver.WebElement, location: webdriver.WebElement): ActionSequence;
+ dragAndDrop(element: webdriver.WebElement, location: ILocation): ActionSequence;
+
+ /**
+ * Clicks a mouse button.
+ *
+ * If an element is provided, the mouse will first be moved to the center
+ * of that element. This is equivalent to:
+ * If an element is provided, the mouse will first be moved to the center of
+ * that element. This is equivalent to:
+ * Warning: this method currently only supports the left mouse button. See
+ * http://code.google.com/p/selenium/issues/detail?id=4047
+ *
+ * @param {(webdriver.WebElement|webdriver.Button)=} opt_elementOrButton Either
+ * the element to interact with or the button to click with.
+ * Defaults to {@link webdriver.Button.LEFT} if neither an element nor
+ * button is specified.
+ * @param {webdriver.Button=} opt_button The button to use. Defaults to
+ * {@link webdriver.Button.LEFT}. Ignored if a button is provided as the
+ * first argument.
+ * @return {!webdriver.ActionSequence} A self reference.
+ */
+ doubleClick(opt_elementOrButton?: webdriver.WebElement, opt_button?: number): ActionSequence;
+ doubleClick(opt_elementOrButton?: number): ActionSequence;
+
+ /**
+ * Performs a modifier key press. The modifier key is not released
+ * until {@link #keyUp} or {@link #sendKeys} is called. The key press will be
+ * targetted at the currently focused element.
+ * @param {!webdriver.Key} key The modifier key to push. Must be one of
+ * {ALT, CONTROL, SHIFT, COMMAND, META}.
+ * @return {!webdriver.ActionSequence} A self reference.
+ * @throws {Error} If the key is not a valid modifier key.
+ */
+ keyDown(key: string): ActionSequence;
+
+ /**
+ * Performs a modifier key release. The release is targetted at the currently
+ * focused element.
+ * @param {!webdriver.Key} key The modifier key to release. Must be one of
+ * {ALT, CONTROL, SHIFT, COMMAND, META}.
+ * @return {!webdriver.ActionSequence} A self reference.
+ * @throws {Error} If the key is not a valid modifier key.
+ */
+ keyUp(key: string): ActionSequence;
+
+ /**
+ * Simulates typing multiple keys. Each modifier key encountered in the
+ * sequence will not be released until it is encountered again. All key events
+ * will be targetted at the currently focused element.
+ * @param {...(string|!webdriver.Key|!Array.<(string|!webdriver.Key)>)} var_args
+ * The keys to type.
+ * @return {!webdriver.ActionSequence} A self reference.
+ * @throws {Error} If the key is not a valid modifier key.
+ */
+ sendKeys(...var_args: any[]): ActionSequence;
+
+ //endregion
+ }
+
+ /**
+ * Represents a modal dialog such as {@code alert}, {@code confirm}, or
+ * {@code prompt}. Provides functions to retrieve the message displayed with
+ * the alert, accept or dismiss the alert, and set the response text (in the
+ * case of {@code prompt}).
+ * @extends {webdriver.promise.Deferred}
+ */
+ class Alert extends webdriver.promise.Deferred {
+
+ //region Constructors
+
+ /**
+ * @param {!webdriver.WebDriver} driver The driver controlling the browser this
+ * alert is attached to.
+ * @param {!(string|webdriver.promise.Promise)} text Either the message text
+ * displayed with this alert, or a promise that will be resolved to said
+ * text.
+ * @constructor
+ */
+ constructor(driver: webdriver.WebDriver, text: string);
+ constructor(driver: webdriver.WebDriver, text: webdriver.promise.Promise);
+
+ //endregion
+
+ //region Methods
+
+ /**
+ * Retrieves the message text displayed with this alert. For instance, if the
+ * alert were opened with alert("hello"), then this would return "hello".
+ * @return {!webdriver.promise.Promise} A promise that will be resolved to the
+ * text displayed with this alert.
+ */
+ getText(): webdriver.promise.Promise;
+
+ /**
+ * Accepts this alert.
+ * @return {!webdriver.promise.Promise} A promise that will be resolved when
+ * this command has completed.
+ */
+ accept(): webdriver.promise.Promise;
+
+ /**
+ * Dismisses this alert.
+ * @return {!webdriver.promise.Promise} A promise that will be resolved when
+ * this command has completed.
+ */
+ dismiss(): webdriver.promise.Promise;
+
+ /**
+ * Sets the response text on this alert. This command will return an error if
+ * the underlying alert does not support response text (e.g. window.alert and
+ * window.confirm).
+ * @param {string} text The text to set.
+ * @return {!webdriver.promise.Promise} A promise that will be resolved when
+ * this command has completed.
+ */
+ sendKeys(text: string): webdriver.promise.Promise;
+
+ //endregion
+
+ }
+
+ /**
+ * An error returned to indicate that there is an unhandled modal dialog on the
+ * current page.
+ * @extends {bot.Error}
+ */
+ class UnhandledAlertError extends webdriver.error.Error {
+ //region Constructors
+
+ /**
+ * @param {string} message The error message.
+ * @param {!webdriver.Alert} alert The alert handle.
+ * @constructor
+ */
+ constructor(message: string, alert: webdriver.Alert);
+
+ //endregion
+
+ //region Methods
+
+ /**
+ * @return {!webdriver.Alert} The open alert.
+ */
+ getAlert(): webdriver.Alert;
+
+ //endregion
+ }
+
+ /**
+ * Recognized browser names.
+ * @enum {string}
+ */
+ class Browser {
+ static ANDROID: string;
+ static CHROME: string;
+ static FIREFOX: string;
+ static INTERNET_EXPLORER: string;
+ static IPAD: string;
+ static IPHONE: string;
+ static OPERA: string;
+ static PHANTOM_JS: string;
+ static SAFARI: string;
+ static HTMLUNIT: string;
+ }
+
+ /**
+ * @extends {webdriver.AbstractBuilder}
+ */
+ class Builder extends AbstractBuilder {
+
+ //region Constructors
+
+ /**
+ * @constructor
+ */
+ constructor();
+
+ //endregion
+
+ //region Static Properties
+
+ /**
+ * Environment variable that defines the session ID of an existing WebDriver
+ * session to use when creating clients. If set, all new Builder instances will
+ * default to creating clients that use this session. To create a new session,
+ * use {@code #useExistingSession(boolean)}. The use of this environment
+ * variable requires that {@link webdriver.AbstractBuilder.SERVER_URL_ENV} also
+ * be set.
+ * @type {string}
+ * @const
+ * @see webdriver.process.getEnv
+ */
+ static SESSION_ID_ENV: string;
+
+ //endregion
+
+ //region Methods
+
+ /**
+ * Configures the builder to create a client that will use an existing WebDriver
+ * session.
+ * @param {string} id The existing session ID to use.
+ * @return {!webdriver.AbstractBuilder} This Builder instance for chain calling.
+ */
+ usingSession(id: string): webdriver.AbstractBuilder;
+
+ /**
+ * @return {string} The ID of the session, if any, this builder is configured
+ * to reuse.
+ */
+ getSession(): string;
+
+ /**
+ * @override
+ */
+ build(): webdriver.WebDriver;
+
+ //endregion
+ }
+
+ /**
+ * Common webdriver capability keys.
+ * @enum {string}
+ */
+ class Capability {
+
+ /**
+ * Indicates whether a driver should accept all SSL certs by default. This
+ * capability only applies when requesting a new session. To query whether
+ * a driver can handle insecure SSL certs, see
+ * {@link webdriver.Capability.SECURE_SSL}.
+ */
+ static ACCEPT_SSL_CERTS: string;
+
+
+ /**
+ * The browser name. Common browser names are defined in the
+ * {@link webdriver.Browser} enum.
+ */
+ static BROWSER_NAME: string;
+
+ /**
+ * Whether the driver is capable of handling modal alerts (e.g. alert,
+ * confirm, prompt). To define how a driver should handle alerts,
+ * use {@link webdriver.Capability.UNEXPECTED_ALERT_BEHAVIOR}.
+ */
+ static HANDLES_ALERTS: string;
+
+ /**
+ * Key for the logging driver logging preferences.
+ */
+ static LOGGING_PREFS: string;
+
+ /**
+ * Describes the platform the browser is running on. Will be one of
+ * ANDROID, IOS, LINUX, MAC, UNIX, or WINDOWS. When requesting a
+ * session, ANY may be used to indicate no platform preference (this is
+ * semantically equivalent to omitting the platform capability).
+ */
+ static PLATFORM: string;
+
+ /**
+ * Describes the proxy configuration to use for a new WebDriver session.
+ */
+ static PROXY: string;
+
+ /** Whether the driver supports changing the brower's orientation. */
+ static ROTATABLE: string;
+
+ /**
+ * Whether a driver is only capable of handling secure SSL certs. To request
+ * that a driver accept insecure SSL certs by default, use
+ * {@link webdriver.Capability.ACCEPT_SSL_CERTS}.
+ */
+ static SECURE_SSL: string;
+
+ /** Whether the driver supports manipulating the app cache. */
+ static SUPPORTS_APPLICATION_CACHE: string;
+
+ /**
+ * Whether the driver supports controlling the browser's internet
+ * connectivity.
+ */
+ static SUPPORTS_BROWSER_CONNECTION: string;
+
+ /** Whether the driver supports locating elements with CSS selectors. */
+ static SUPPORTS_CSS_SELECTORS: string;
+
+ /** Whether the browser supports JavaScript. */
+ static SUPPORTS_JAVASCRIPT: string;
+
+ /** Whether the driver supports controlling the browser's location info. */
+ static SUPPORTS_LOCATION_CONTEXT: string;
+
+ /** Whether the driver supports taking screenshots. */
+ static TAKES_SCREENSHOT: string;
+
+ /**
+ * Defines how the driver should handle unexpected alerts. The value should
+ * be one of "accept", "dismiss", or "ignore.
+ */
+ static UNEXPECTED_ALERT_BEHAVIOR: string;
+
+ /** Defines the browser version. */
+ static VERSION: string;
+ }
+
+ class Capabilities {
+ //region Constructors
+
+ /**
+ * @param {(webdriver.Capabilities|Object)=} opt_other Another set of
+ * capabilities to merge into this instance.
+ * @constructor
+ */
+ constructor(opt_other?: Capabilities);
+ constructor(opt_other?: any);
+
+ //endregion
+
+ //region Methods
+
+ /** @return {!Object} The JSON representation of this instance. */
+ toJSON(): any;
+
+ /**
+ * Merges another set of capabilities into this instance. Any duplicates in
+ * the provided set will override those already set on this instance.
+ * @param {!(webdriver.Capabilities|Object)} other The capabilities to
+ * merge into this instance.
+ * @return {!webdriver.Capabilities} A self reference.
+ */
+ merge(other: Capabilities): Capabilities;
+ merge(other: any): Capabilities;
+
+ /**
+ * @param {string} key The capability to set.
+ * @param {*} value The capability value. Capability values must be JSON
+ * serializable. Pass {@code null} to unset the capability.
+ * @return {!webdriver.Capabilities} A self reference.
+ */
+ set(key: string, value: any): Capabilities;
+
+ /**
+ * @param {string} key The capability to return.
+ * @return {*} The capability with the given key, or {@code null} if it has
+ * not been set.
+ */
+ get(key: string): any;
+
+ /**
+ * @param {string} key The capability to check.
+ * @return {boolean} Whether the specified capability is set.
+ */
+ has(key: string): boolean;
+
+ //endregion
+
+ //region Static Methods
+
+ /**
+ * @return {!webdriver.Capabilities} A basic set of capabilities for Android.
+ */
+ static android(): Capabilities;
+
+ /**
+ * @return {!webdriver.Capabilities} A basic set of capabilities for Chrome.
+ */
+ static chrome(): Capabilities;
+
+ /**
+ * @return {!webdriver.Capabilities} A basic set of capabilities for Firefox.
+ */
+ static firefox(): Capabilities;
+
+ /**
+ * @return {!webdriver.Capabilities} A basic set of capabilities for
+ * Internet Explorer.
+ */
+ static ie(): Capabilities;
+
+ /**
+ * @return {!webdriver.Capabilities} A basic set of capabilities for iPad.
+ */
+ static ipad(): Capabilities;
+
+ /**
+ * @return {!webdriver.Capabilities} A basic set of capabilities for iPhone.
+ */
+ static iphone(): Capabilities;
+
+ /**
+ * @return {!webdriver.Capabilities} A basic set of capabilities for Opera.
+ */
+ static opera(): Capabilities;
+
+ /**
+ * @return {!webdriver.Capabilities} A basic set of capabilities for
+ * PhantomJS.
+ */
+ static phantomjs(): Capabilities;
+
+ /**
+ * @return {!webdriver.Capabilities} A basic set of capabilities for Safari.
+ */
+ static safari(): Capabilities;
+
+ /**
+ * @return {!webdriver.Capabilities} A basic set of capabilities for HTMLUnit.
+ */
+ static htmlunit(): Capabilities;
+
+ /**
+ * @return {!webdriver.Capabilities} A basic set of capabilities for HTMLUnit
+ * with enabled Javascript.
+ */
+ static htmlunitwithjs(): Capabilities;
+
+ //endregion
+ }
+
+ /**
+ * An enumeration of valid command string.
+ * NOTE: A Class was used instead of an Enum so that the class could be extended in Protractor.
+ */
+ class CommandName {
+ static GET_SERVER_STATUS: string;
+
+ static NEW_SESSION: string;
+ static GET_SESSIONS: string;
+ static DESCRIBE_SESSION: string;
+
+ static CLOSE: string;
+ static QUIT: string;
+
+ static GET_CURRENT_URL: string;
+ static GET: string;
+ static GO_BACK: string;
+ static GO_FORWARD: string;
+ static REFRESH: string;
+
+ static ADD_COOKIE: string;
+ static GET_COOKIE: string;
+ static GET_ALL_COOKIES: string;
+ static DELETE_COOKIE: string;
+ static DELETE_ALL_COOKIES: string;
+
+ static GET_ACTIVE_ELEMENT: string;
+ static FIND_ELEMENT: string;
+ static FIND_ELEMENTS: string;
+ static FIND_CHILD_ELEMENT: string;
+ static FIND_CHILD_ELEMENTS: string;
+
+ static CLEAR_ELEMENT: string;
+ static CLICK_ELEMENT: string;
+ static SEND_KEYS_TO_ELEMENT: string;
+ static SUBMIT_ELEMENT: string;
+
+ static GET_CURRENT_WINDOW_HANDLE: string;
+ static GET_WINDOW_HANDLES: string;
+ static GET_WINDOW_POSITION: string;
+ static SET_WINDOW_POSITION: string;
+ static GET_WINDOW_SIZE: string;
+ static SET_WINDOW_SIZE: string;
+ static MAXIMIZE_WINDOW: string;
+
+ static SWITCH_TO_WINDOW: string;
+ static SWITCH_TO_FRAME: string;
+ static GET_PAGE_SOURCE: string;
+ static GET_TITLE: string;
+
+ static EXECUTE_SCRIPT: string;
+ static EXECUTE_ASYNC_SCRIPT: string;
+
+ static GET_ELEMENT_TEXT: string;
+ static GET_ELEMENT_TAG_NAME: string;
+ static IS_ELEMENT_SELECTED: string;
+ static IS_ELEMENT_ENABLED: string;
+ static IS_ELEMENT_DISPLAYED: string;
+ static GET_ELEMENT_LOCATION: string;
+ static GET_ELEMENT_LOCATION_IN_VIEW: string;
+ static GET_ELEMENT_SIZE: string;
+ static GET_ELEMENT_ATTRIBUTE: string;
+ static GET_ELEMENT_VALUE_OF_CSS_PROPERTY: string;
+ static ELEMENT_EQUALS: string;
+
+ static SCREENSHOT: string;
+ static IMPLICITLY_WAIT: string;
+ static SET_SCRIPT_TIMEOUT: string;
+ static SET_TIMEOUT: string;
+
+ static ACCEPT_ALERT: string;
+ static DISMISS_ALERT: string;
+ static GET_ALERT_TEXT: string;
+ static SET_ALERT_TEXT: string;
+
+ static EXECUTE_SQL: string;
+ static GET_LOCATION: string;
+ static SET_LOCATION: string;
+ static GET_APP_CACHE: string;
+ static GET_APP_CACHE_STATUS: string;
+ static CLEAR_APP_CACHE: string;
+ static IS_BROWSER_ONLINE: string;
+ static SET_BROWSER_ONLINE: string;
+
+ static GET_LOCAL_STORAGE_ITEM: string;
+ static GET_LOCAL_STORAGE_KEYS: string;
+ static SET_LOCAL_STORAGE_ITEM: string;
+ static REMOVE_LOCAL_STORAGE_ITEM: string;
+ static CLEAR_LOCAL_STORAGE: string;
+ static GET_LOCAL_STORAGE_SIZE: string;
+
+ static GET_SESSION_STORAGE_ITEM: string;
+ static GET_SESSION_STORAGE_KEYS: string;
+ static SET_SESSION_STORAGE_ITEM: string;
+ static REMOVE_SESSION_STORAGE_ITEM: string;
+ static CLEAR_SESSION_STORAGE: string;
+ static GET_SESSION_STORAGE_SIZE: string;
+
+ static SET_SCREEN_ORIENTATION: string;
+ static GET_SCREEN_ORIENTATION: string;
+
+ // These belong to the Advanced user interactions - an element is
+ // optional for these commands.
+ static CLICK: string;
+ static DOUBLE_CLICK: string;
+ static MOUSE_DOWN: string;
+ static MOUSE_UP: string;
+ static MOVE_TO: string;
+ static SEND_KEYS_TO_ACTIVE_ELEMENT: string;
+
+ // These belong to the Advanced Touch API
+ static TOUCH_SINGLE_TAP: string;
+ static TOUCH_DOWN: string;
+ static TOUCH_UP: string;
+ static TOUCH_MOVE: string;
+ static TOUCH_SCROLL: string;
+ static TOUCH_DOUBLE_TAP: string;
+ static TOUCH_LONG_PRESS: string;
+ static TOUCH_FLICK: string;
+
+ static GET_AVAILABLE_LOG_TYPES: string;
+ static GET_LOG: string;
+ static GET_SESSION_LOGS: string;
+ }
+
+ /**
+ * Describes a command to be executed by the WebDriverJS framework.
+ * @param {!webdriver.CommandName} name The name of this command.
+ * @constructor
+ */
+ class Command {
+ //region Constructors
+
+ /**
+ * @param {!webdriver.CommandName} name The name of this command.
+ * @constructor
+ */
+ constructor(name: string);
+
+ //endregion
+
+ //region Methods
+
+ /**
+ * @return {!webdriver.CommandName} This command's name.
+ */
+ getName(): string;
+
+ /**
+ * Sets a parameter to send with this command.
+ * @param {string} name The parameter name.
+ * @param {*} value The parameter value.
+ * @return {!webdriver.Command} A self reference.
+ */
+ setParameter(name: string, value: any): webdriver.Command;
+
+ /**
+ * Sets the parameters for this command.
+ * @param {!Object.<*>} parameters The command parameters.
+ * @return {!webdriver.Command} A self reference.
+ */
+ setParameters(parameters: any): webdriver.Command;
+
+ /**
+ * Returns a named command parameter.
+ * @param {string} key The parameter key to look up.
+ * @return {*} The parameter value, or undefined if it has not been set.
+ */
+ getParameter(key: string): any;
+
+ /**
+ * @return {!Object.<*>} The parameters to send with this command.
+ */
+ getParameters(): any;
+
+ //endregion
+ }
+
+ /**
+ * Handles the execution of {@code webdriver.Command} objects.
+ */
+ interface CommandExecutor {
+ /**
+ * Executes the given {@code command}. If there is an error executing the
+ * command, the provided callback will be invoked with the offending error.
+ * Otherwise, the callback will be invoked with a null Error and non-null
+ * {@link bot.response.ResponseObject} object.
+ * @param {!webdriver.Command} command The command to execute.
+ * @param {function(Error, !bot.response.ResponseObject=)} callback the function
+ * to invoke when the command response is ready.
+ */
+ execute(command: webdriver.Command, callback: (error: Error, responseObject: any) => any ): void;
+ }
+
+ /**
+ * Object that can emit events for others to listen for. This is used instead
+ * of Closure's event system because it is much more light weight. The API is
+ * based on Node's EventEmitters.
+ */
+ class EventEmitter {
+ //region Constructors
+
+ /**
+ * @constructor
+ */
+ constructor();
+
+ //endregion
+
+ //region Methods
+
+ /**
+ * Fires an event and calls all listeners.
+ * @param {string} type The type of event to emit.
+ * @param {...*} var_args Any arguments to pass to each listener.
+ */
+ emit(type: string, ...var_args: any[]): void;
+
+ /**
+ * Returns a mutable list of listeners for a specific type of event.
+ * @param {string} type The type of event to retrieve the listeners for.
+ * @return {!Array.<{fn: !Function, oneshot: boolean,
+ * scope: (Object|undefined)}>} The registered listeners for
+ * the given event type.
+ */
+ listeners(type: string): Array<{fn: any; oneshot: boolean; scope: any;}>;
+
+ /**
+ * Registers a listener.
+ * @param {string} type The type of event to listen for.
+ * @param {!Function} listenerFn The function to invoke when the event is fired.
+ * @param {Object=} opt_scope The object in whose scope to invoke the listener.
+ * @return {!webdriver.EventEmitter} A self reference.
+ */
+ addListener(type: string, listenerFn: any, opt_scope?:any): EventEmitter;
+
+ /**
+ * Registers a one-time listener which will be called only the first time an
+ * event is emitted, after which it will be removed.
+ * @param {string} type The type of event to listen for.
+ * @param {!Function} listenerFn The function to invoke when the event is fired.
+ * @param {Object=} opt_scope The object in whose scope to invoke the listener.
+ * @return {!webdriver.EventEmitter} A self reference.
+ */
+ once(type: string, listenerFn: any, opt_scope?: any): EventEmitter;
+
+ /**
+ * An alias for {@code #addListener()}.
+ * @param {string} type The type of event to listen for.
+ * @param {!Function} listenerFn The function to invoke when the event is fired.
+ * @param {Object=} opt_scope The object in whose scope to invoke the listener.
+ * @return {!webdriver.EventEmitter} A self reference.
+ */
+ on(type: string, listenerFn: any, opt_scope?:any): EventEmitter;
+
+ /**
+ * Removes a previously registered event listener.
+ * @param {string} type The type of event to unregister.
+ * @param {!Function} listenerFn The handler function to remove.
+ * @return {!webdriver.EventEmitter} A self reference.
+ */
+ removeListener(type: string, listenerFn: any): EventEmitter;
+
+ /**
+ * Removes all listeners for a specific type of event. If no event is
+ * specified, all listeners across all types will be removed.
+ * @param {string=} opt_type The type of event to remove listeners from.
+ * @return {!webdriver.EventEmitter} A self reference.
+ */
+ removeAllListeners(opt_type?: string): EventEmitter;
+
+ //endregion
+ }
+
+ /**
+ * @implements {webdriver.CommandExecutor}
+ */
+ class FirefoxDomExecutor implements webdriver.CommandExecutor {
+ //region Constructors
+
+ /**
+ * @constructor
+ */
+ constructor();
+
+ //endregion
+
+ //region Static Methods
+
+ /**
+ * @return {boolean} Whether the current environment supports the
+ * FirefoxDomExecutor.
+ */
+ static isAvailable(): boolean;
+
+ //endretion
+
+ //region Methods
+
+ /** @override */
+ execute(command: webdriver.Command, callback: (error: Error, responseObject: any) => any ): void;
+
+ //endregion
+ }
+
+ /**
+ * Interface for navigating back and forth in the browser history.
+ */
+ class WebDriverNavigation {
+ //region Constructors
+
+ /**
+ * @param {!webdriver.WebDriver} driver The parent driver.
+ * @constructor
+ */
+ constructor(driver: webdriver.WebDriver);
+
+ //endregion
+
+ //region Methods
+
+ /**
+ * Schedules a command to navigate to a new URL.
+ * @param {string} url The URL to navigate to.
+ * @return {!webdriver.promise.Promise} A promise that will be resolved when the
+ * URL has been loaded.
+ */
+ to(url: string): webdriver.promise.Promise;
+
+ /**
+ * Schedules a command to move backwards in the browser history.
+ * @return {!webdriver.promise.Promise} A promise that will be resolved when the
+ * navigation event has completed.
+ */
+ back(): webdriver.promise.Promise;
+
+ /**
+ * Schedules a command to move forwards in the browser history.
+ * @return {!webdriver.promise.Promise} A promise that will be resolved when the
+ * navigation event has completed.
+ */
+ forward(): webdriver.promise.Promise;
+
+ /**
+ * Schedules a command to refresh the current page.
+ * @return {!webdriver.promise.Promise} A promise that will be resolved when the
+ * navigation event has completed.
+ */
+ refresh(): webdriver.promise.Promise;
+
+ //endregion
+ }
+
+ /**
+ * Provides methods for managing browser and driver state.
+ */
+ class WebDriverOptions {
+ //region Constructors
+
+ /**
+ * @param {!webdriver.WebDriver} driver The parent driver.
+ * @constructor
+ */
+ constructor(driver: webdriver.WebDriver);
+
+ //endregion
+
+ //region Methods
+
+ /**
+ * 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.
+ * @return {!webdriver.promise.Promise} A promise that will be resolved when the
+ * cookie has been added to the page.
+ */
+ addCookie(name: string, value: string, opt_path?: string, opt_domain?: string, opt_isSecure?: boolean, opt_expiry?: number): webdriver.promise.Promise;
+ addCookie(name: string, value: string, opt_path?: string, opt_domain?: string, opt_isSecure?: boolean, opt_expiry?: Date): webdriver.promise.Promise;
+
+ /**
+ * Schedules a command to delete all cookies visible to the current page.
+ * @return {!webdriver.promise.Promise} A promise that will be resolved when all
+ * cookies have been deleted.
+ */
+ deleteAllCookies(): webdriver.promise.Promise;
+
+ /**
+ * Schedules a command to delete the cookie with the given name. This command is
+ * a no-op if there is no cookie with the given name visible to the current
+ * page.
+ * @param {string} name The name of the cookie to delete.
+ * @return {!webdriver.promise.Promise} A promise that will be resolved when the
+ * cookie has been deleted.
+ */
+ deleteCookie(name: string): webdriver.promise.Promise;
+
+ /**
+ * Schedules a command to retrieve all cookies visible to the current page.
+ * Each cookie will be returned as a JSON object as described by the WebDriver
+ * wire protocol.
+ * @return {!webdriver.promise.Promise} A promise that will be resolved with the
+ * cookies visible to the current page.
+ * @see http://code.google.com/p/selenium/wiki/JsonWireProtocol#Cookie_JSON_Object
+ */
+ getCookies(): webdriver.promise.Promise;
+
+ /**
+ * Schedules a command to retrieve the cookie with the given name. Returns null
+ * if there is no such cookie. The cookie will be returned as a JSON object as
+ * described by the WebDriver wire protocol.
+ * @param {string} name The name of the cookie to retrieve.
+ * @return {!webdriver.promise.Promise} A promise that will be resolved with the
+ * named cookie, or {@code null} if there is no such cookie.
+ * @see http://code.google.com/p/selenium/wiki/JsonWireProtocol#Cookie_JSON_Object
+ */
+ getCookie(name: string): webdriver.promise.Promise;
+
+ /**
+ * @return {!webdriver.WebDriver.Logs} The interface for managing driver
+ * logs.
+ */
+ logs(): webdriver.WebDriverLogs;
+
+ /**
+ * @return {!webdriver.WebDriver.Timeouts} The interface for managing driver
+ * timeouts.
+ */
+ timeouts(): webdriver.WebDriverTimeouts;
+
+ /**
+ * @return {!webdriver.WebDriver.Window} The interface for managing the
+ * current window.
+ */
+ window(): webdriver.WebDriverWindow;
+
+ //endregion
+ }
+
+ /**
+ * An interface for managing timeout behavior for WebDriver instances.
+ */
+ class WebDriverTimeouts {
+ //region Constructors
+
+ /**
+ * @param {!webdriver.WebDriver} driver The parent driver.
+ * @constructor
+ */
+ constructor(driver: webdriver.WebDriver);
+
+ //endregion
+
+ //region Methods
+
+ /**
+ * Specifies the amount of time the driver should wait when searching for an
+ * element if it is not immediately present.
+ * The search criteria for find an element may either be a
+ * {@code webdriver.Locator} object, or a simple JSON object whose sole key
+ * is one of the accepted locator strategies, as defined by
+ * {@code webdriver.Locator.Strategy}. For example, the following two statements
+ * are equivalent:
+ * When running in the browser, a WebDriver cannot manipulate DOM elements
+ * directly; it may do so only through a {@link webdriver.WebElement} reference.
+ * This function may be used to generate a WebElement from a DOM element. A
+ * reference to the DOM element will be stored in a known location and this
+ * driver will attempt to retrieve it through {@link #executeScript}. If the
+ * element cannot be found (eg, it belongs to a different document than the
+ * one this instance is currently focused on), a
+ * {@link bot.ErrorCode.NO_SUCH_ELEMENT} error will be returned.
+ *
+ * @param {!(webdriver.Locator|Object. 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 {!(webdriver.Locator|Object. Note that JS locator searches cannot be restricted to a subtree of the
+ * DOM. All such searches are delegated to this instance's parent WebDriver.
+ *
+ * @param {webdriver.Locator|Object. async, autofocus, autoplay, checked, compact, complete, controls, declare,
+ * defaultchecked, defaultselected, defer, disabled, draggable, ended,
+ * formnovalidate, hidden, indeterminate, iscontenteditable, ismap, itemscope,
+ * loop, multiple, muted, nohref, noresize, noshade, novalidate, nowrap, open,
+ * paused, pubdate, readonly, required, reversed, scoped, seamless, seeking,
+ * selected, spellcheck, truespeed, willvalidate
+ *
+ * Finally, the following commonly mis-capitalized attribute/property names
+ * are evaluated as expected:
+ *
+ *
+ * Note that JS locator searches cannot be restricted to a subtree. All such
+ * searches are delegated to this instance's parent WebDriver.
+ *
+ * @param {webdriver.Locator|Object.
+ * var e1 = element.findElement(By.id('foo'));
+ * var e2 = element.findElement({id:'foo'});
+ *
+ *
+ *
+ * var e1 = driver.findElement(By.id('foo'));
+ * var e2 = driver.findElement({id:'foo'});
+ *
+ *
+ */
+ class AbstractBuilder {
+
+ //region Constructors
+
+ /**
+ * @constructor
+ */
+ constructor();
+
+ //endregion
+
+ //region Static Properties
+
+ /**
+ * Environment variable that defines the URL of the WebDriver server that
+ * should be used for all new WebDriver clients. This setting may be overridden
+ * using {@code #usingServer(url)}.
+ * @type {string}
+ * @const
+ * @see webdriver.process.getEnv
+ */
+ static SERVER_URL_ENV: string;
+
+
+ /**
+ * The default URL of the WebDriver server to use if
+ * {@link webdriver.AbstractBuilder.SERVER_URL_ENV} is not set.
+ * @type {string}
+ * @const
+ */
+ static DEFAULT_SERVER_URL: string;
+
+ //endregion
+
+ //region Methods
+
+ /**
+ * Configures which WebDriver server should be used for new sessions. Overrides
+ * the value loaded from the {@link webdriver.AbstractBuilder.SERVER_URL_ENV}
+ * upon creation of this instance.
+ * @param {string} url URL of the server to use.
+ * @return {!webdriver.AbstractBuilder} This Builder instance for chain calling.
+ */
+ usingServer(url: string): AbstractBuilder;
+
+ /**
+ * @return {string} The URL of the WebDriver server this instance is configured
+ * to use.
+ */
+ getServerUrl(): string;
+
+ /**
+ * Sets the desired capabilities when requesting a new session. This will
+ * overwrite any previously set desired capabilities.
+ * @param {!(Object|webdriver.Capabilities)} capabilities The desired
+ * capabilities for a new session.
+ * @return {!webdriver.AbstractBuilder} This Builder instance for chain calling.
+ */
+ withCapabilities(capabilities: webdriver.Capabilities): AbstractBuilder;
+ withCapabilities(capabilities: any): AbstractBuilder;
+
+ /**
+ * @return {!webdriver.Capabilities} The current desired capabilities for this
+ * builder.
+ */
+ getCapabilities(): webdriver.Capabilities;
+
+ /**
+ * Builds a new {@link webdriver.WebDriver} instance using this builder's
+ * current configuration.
+ * @return {!webdriver.WebDriver} A new WebDriver client.
+ */
+ build(): webdriver.WebDriver;
+
+ //endregion
+ }
+
+ interface ILocation {
+ x: number;
+ y: number;
+ }
+
+ /**
+ * Enumeration of the buttons used in the advanced interactions API.
+ * NOTE: A TypeScript enum was not used so that this class could be extended in Protractor.
+ * @enum {number}
+ */
+ class Button {
+ static LEFT: number;
+ static MIDDLE: number;
+ static RIGHT: number;
+ }
+
+ /**
+ * Representations of pressable keys that aren't text. These are stored in
+ * the Unicode PUA (Private Use Area) code points, 0xE000-0xF8FF. Refer to
+ * http://www.google.com.au/search?&q=unicode+pua&btnG=Search
+ * NOTE: A class was used instead of an Enum so that it could be extended in Protractor
+ *
+ * @enum {string}
+ */
+ class Key {
+ static NULL: string;
+ static CANCEL: string; // ^break
+ static HELP: string;
+ static BACK_SPACE: string;
+ static TAB: string;
+ static CLEAR: string;
+ static RETURN: string;
+ static ENTER: string;
+ static SHIFT: string;
+ static CONTROL: string;
+ static ALT: string;
+ static PAUSE: string;
+ static ESCAPE: string;
+ static SPACE: string;
+ static PAGE_UP: string;
+ static PAGE_DOWN: string;
+ static END: string;
+ static HOME: string;
+ static ARROW_LEFT: string;
+ static LEFT: string;
+ static ARROW_UP: string;
+ static UP: string;
+ static ARROW_RIGHT: string;
+ static RIGHT: string;
+ static ARROW_DOWN: string;
+ static DOWN: string;
+ static INSERT: string;
+ static DELETE: string;
+ static SEMICOLON: string;
+ static EQUALS: string;
+
+ static NUMPAD0: string; // number pad keys
+ static NUMPAD1: string;
+ static NUMPAD2: string;
+ static NUMPAD3: string;
+ static NUMPAD4: string;
+ static NUMPAD5: string;
+ static NUMPAD6: string;
+ static NUMPAD7: string;
+ static NUMPAD8: string;
+ static NUMPAD9: string;
+ static MULTIPLY: string;
+ static ADD: string;
+ static SEPARATOR: string;
+ static SUBTRACT: string;
+ static DECIMAL: string;
+ static DIVIDE: string;
+
+ static F1: string; // function keys
+ static F2: string;
+ static F3: string;
+ static F4: string;
+ static F5: string;
+ static F6: string;
+ static F7: string;
+ static F8: string;
+ static F9: string;
+ static F10: string;
+ static F11: string;
+ static F12: string;
+
+ static COMMAND: string; // Apple command key
+ static META: string; // alias for Windows key
+
+ /**
+ * Simulate pressing many keys at once in a "chord". Takes a sequence of
+ * {@link webdriver.Key}s or strings, appends each of the values to a string,
+ * and adds the chord termination key ({@link webdriver.Key.NULL}) and returns
+ * the resultant string.
+ *
+ * Note: when the low-level webdriver key handlers see Keys.NULL, active
+ * modifier keys (CTRL/ALT/SHIFT/etc) release via a keyup event.
+ *
+ * @param {...string} var_args The key sequence to concatenate.
+ * @return {string} The null-terminated key sequence.
+ * @see http://code.google.com/p/webdriver/issues/detail?id=79
+ */
+ static chord(...var_args: string[]): string;
+ }
+
+ /**
+ * Class for defining sequences of complex user interactions. Each sequence
+ * will not be executed until {@link #perform} is called.
+ *
+ *
+ *
+ */
+ class ActionSequence {
+
+ //region Constructors
+
+ /**
+ * @param {!webdriver.WebDriver} driver The driver instance to use.
+ * @constructor
+ */
+ constructor(driver: webdriver.WebDriver);
+
+ //endregion
+
+ //region Methods
+
+ /**
+ * Executes this action sequence.
+ * @return {!webdriver.promise.Promise} A promise that will be resolved once
+ * this sequence has completed.
+ */
+ perform(): webdriver.promise.Promise;
+
+ /**
+ * Moves the mouse. The location to move to may be specified in terms of the
+ * mouse's current location, an offset relative to the top-left corner of an
+ * element, or an element (in which case the middle of the element is used).
+ * @param {(!webdriver.WebElement|{x: number, y: number})} location The
+ * location to drag to, as either another WebElement or an offset in pixels.
+ * @param {{x: number, y: number}=} opt_offset An optional offset, in pixels.
+ * Defaults to (0, 0).
+ * @return {!webdriver.ActionSequence} A self reference.
+ */
+ mouseMove(location: webdriver.WebElement, opt_offset?: ILocation): ActionSequence
+ mouseMove(location: ILocation): ActionSequence
+
+ /**
+ * Presses a mouse button. The mouse button will not be released until
+ * {@link #mouseUp} is called, regardless of whether that call is made in this
+ * sequence or another. The behavior for out-of-order events (e.g. mouseDown,
+ * click) is undefined.
+ *
+ *
+ * new webdriver.ActionSequence(driver).
+ * keyDown(webdriver.Key.SHIFT).
+ * click(element1).
+ * click(element2).
+ * dragAndDrop(element3, element4).
+ * keyUp(webdriver.Key.SHIFT).
+ * perform();
+ *
+ *
+ * sequence.mouseMove(element).mouseDown()
+ *
+ * sequence.mouseMove(element).mouseUp()
+ *
+ * @param {(webdriver.WebElement|webdriver.Button)=} opt_elementOrButton Either
+ * the element to interact with or the button to click with.
+ * Defaults to {@link webdriver.Button.LEFT} if neither an element nor
+ * button is specified.
+ * @param {webdriver.Button=} opt_button The button to use. Defaults to
+ * {@link webdriver.Button.LEFT}. Ignored if a button is provided as the
+ * first argument.
+ * @return {!webdriver.ActionSequence} A self reference.
+ */
+ click(opt_elementOrButton?: webdriver.WebElement, opt_button?: number): ActionSequence;
+ click(opt_elementOrButton?: number): ActionSequence;
+
+ /**
+ * Double-clicks a mouse button.
+ *
+ * sequence.mouseMove(element).click()
+ *
+ * sequence.mouseMove(element).doubleClick()
+ * @return {!webdriver.ActionSequence} A new action sequence for this instance.
+ */
+ actions(): webdriver.ActionSequence;
+
+ /**
+ * Schedules a command to execute JavaScript in the context of the currently
+ * selected frame or window. The script fragment will be executed as the body
+ * of an anonymous function. If the script is provided as a function object,
+ * that function will be converted to a string for injection into the target
+ * window.
+ *
+ * Any arguments provided in addition to the script will be included as script
+ * arguments and may be referenced using the {@code arguments} object.
+ * Arguments may be a boolean, number, string, or {@code webdriver.WebElement}.
+ * Arrays and objects may also be used as script arguments as long as each item
+ * adheres to the types previously mentioned.
+ *
+ * The script may refer to any variables accessible from the current window.
+ * Furthermore, the script will execute in the window's context, thus
+ * {@code document} may be used to refer to the current document. Any local
+ * variables will not be available once the script has finished executing,
+ * though global variables will persist.
+ *
+ * If the script has a return value (i.e. if the script contains a return
+ * statement), then the following steps will be taken for resolving this
+ * functions return value:
+ *
+ * driver.actions().
+ * mouseDown(element1).
+ * mouseMove(element2).
+ * mouseUp().
+ * perform();
+ *
+ *
+ *
+ * @param {!(string|Function)} script The script to execute.
+ * @param {...*} var_args The arguments to pass to the script.
+ * @return {!webdriver.promise.Promise} A promise that will resolve to the
+ * scripts return value.
+ */
+ executeScript(script: string, ...var_args: any[]): webdriver.promise.Promise;
+ executeScript(script: any, ...var_args: any[]): webdriver.promise.Promise;
+
+ /**
+ * Schedules a command to execute asynchronous JavaScript in the context of the
+ * currently selected frame or window. The script fragment will be executed as
+ * the body of an anonymous function. If the script is provided as a function
+ * object, that function will be converted to a string for injection into the
+ * target window.
+ *
+ * Any arguments provided in addition to the script will be included as script
+ * arguments and may be referenced using the {@code arguments} object.
+ * Arguments may be a boolean, number, string, or {@code webdriver.WebElement}.
+ * Arrays and objects may also be used as script arguments as long as each item
+ * adheres to the types previously mentioned.
+ *
+ * Unlike executing synchronous JavaScript with
+ * {@code webdriver.WebDriver.prototype.executeScript}, scripts executed with
+ * this function must explicitly signal they are finished by invoking the
+ * provided callback. This callback will always be injected into the
+ * executed function as the last argument, and thus may be referenced with
+ * {@code arguments[arguments.length - 1]}. The following steps will be taken
+ * for resolving this functions return value against the first argument to the
+ * script's callback function:
+ *
+ *
+ *
+ * Example #1: Performing a sleep that is synchronized with the currently
+ * selected window:
+ *
+ *
+ * Example #2: Synchronizing a test with an AJAX application:
+ *
+ * var start = new Date().getTime();
+ * driver.executeAsyncScript(
+ * 'window.setTimeout(arguments[arguments.length - 1], 500);').
+ * then(function() {
+ * console.log('Elapsed time: ' + (new Date().getTime() - start) + ' ms');
+ * });
+ *
+ *
+ * Example #3: Injecting a XMLHttpRequest and waiting for the result. In this
+ * example, the inject script is specified with a function literal. When using
+ * this format, the function is converted to a string for injection, so it
+ * should not reference any symbols not defined in the scope of the page under
+ * test.
+ *
+ * var button = driver.findElement(By.id('compose-button'));
+ * button.click();
+ * driver.executeAsyncScript(
+ * 'var callback = arguments[arguments.length - 1];' +
+ * 'mailClient.getComposeWindowWidget().onload(callback);');
+ * driver.switchTo().frame('composeWidget');
+ * driver.findElement(By.id('to')).sendKEys('dog@example.com');
+ *
+ *
+ * @param {!(string|Function)} script The script to execute.
+ * @param {...*} var_args The arguments to pass to the script.
+ * @return {!webdriver.promise.Promise} A promise that will resolve to the
+ * scripts return value.
+ */
+ executeAsyncScript(script: string, ...var_args: any[]): webdriver.promise.Promise;
+ executeAsyncScript(script: any, ...var_args: any[]): webdriver.promise.Promise;
+
+ /**
+ * Schedules a command to execute a custom function.
+ * @param {!Function} fn The function to execute.
+ * @param {Object=} opt_scope The object in whose scope to execute the function.
+ * @param {...*} var_args Any arguments to pass to the function.
+ * @return {!webdriver.promise.Promise} A promise that will be resolved with the
+ * function's result.
+ */
+ call(fn: any, opt_scope?: any, ...var_args: any[]): webdriver.promise.Promise;
+
+ /**
+ * Schedules a command to wait for a condition to hold, as defined by some
+ * user supplied function. If any errors occur while evaluating the wait, they
+ * will be allowed to propagate.
+ * @param {function():boolean|!webdriver.promise.Promise} fn The function to
+ * evaluate as a wait condition.
+ * @param {number} timeout How long to wait for the condition to be true.
+ * @param {string=} opt_message An optional message to use if the wait times
+ * out.
+ * @return {!webdriver.promise.Promise} A promise that will be resolved when the
+ * wait condition has been satisfied.
+ */
+ wait(fn: () => any, timeout: number, opt_message?: string): webdriver.promise.Promise;
+
+ /**
+ * Schedules a command to make the driver sleep for the given amount of time.
+ * @param {number} ms The amount of time, in milliseconds, to sleep.
+ * @return {!webdriver.promise.Promise} A promise that will be resolved when the
+ * sleep has finished.
+ */
+ sleep(ms: number): webdriver.promise.Promise;
+
+ /**
+ * Schedules a command to retrieve they current window handle.
+ * @return {!webdriver.promise.Promise} A promise that will be resolved with the
+ * current window handle.
+ */
+ getWindowHandle(): webdriver.promise.Promise;
+
+ /**
+ * Schedules a command to retrieve the current list of available window handles.
+ * @return {!webdriver.promise.Promise} A promise that will be resolved with an
+ * array of window handles.
+ */
+ getAllWindowHandles(): webdriver.promise.Promise;
+
+ /**
+ * Schedules a command to retrieve the current page's source. The page source
+ * returned is a representation of the underlying DOM: do not expect it to be
+ * formatted or escaped in the same way as the response sent from the web
+ * server.
+ * @return {!webdriver.promise.Promise} A promise that will be resolved with the
+ * current page source.
+ */
+ getPageSource(): webdriver.promise.Promise;
+
+ /**
+ * Schedules a command to close the current window.
+ * @return {!webdriver.promise.Promise} A promise that will be resolved when
+ * this command has completed.
+ */
+ close(): webdriver.promise.Promise;
+
+ /**
+ * Schedules a command to navigate to the given URL.
+ * @param {string} url The fully qualified URL to open.
+ * @return {!webdriver.promise.Promise} A promise that will be resolved when the
+ * document has finished loading.
+ */
+ get(url: string): webdriver.promise.Promise;
+
+ /**
+ * Schedules a command to retrieve the URL of the current page.
+ * @return {!webdriver.promise.Promise} A promise that will be resolved with the
+ * current URL.
+ */
+ getCurrentUrl(): webdriver.promise.Promise;
+
+ /**
+ * Schedules a command to retrieve the current page's title.
+ * @return {!webdriver.promise.Promise} A promise that will be resolved with the
+ * current page's title.
+ */
+ getTitle(): webdriver.promise.Promise;
+
+ /**
+ * Schedule a command to find an element on the page. If the element cannot be
+ * found, a {@code 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 {@code #isElementPresent} instead.
+ *
+ *
+ * driver.executeAsyncScript(function() {
+ * var callback = arguments[arguments.length - 1];
+ * var xhr = new XMLHttpRequest();
+ * xhr.open("GET", "/resource/data.json", true);
+ * xhr.onreadystatechange = function() {
+ * if (xhr.readyState == 4) {
+ * callback(xhr.resposneText);
+ * }
+ * }
+ * xhr.send('');
+ * }).then(function(str) {
+ * console.log(JSON.parse(str)['food']);
+ * });
+ *
+ *
+ *
+ * var e1 = driver.findElement(By.id('foo'));
+ * var e2 = driver.findElement({id:'foo'});
+ *
+ *
+ *
+ * @return {!webdriver.promise.Promise} A promise that will be resolved to the
+ * screenshot as a base-64 encoded PNG.
+ */
+ takeScreenshot(): webdriver.promise.Promise;
+
+ /**
+ * @return {!webdriver.WebDriver.Options} The options interface for this
+ * instance.
+ */
+ manage(): webdriver.WebDriverOptions;
+
+ /**
+ * @return {!webdriver.WebDriver.Navigation} The navigation interface for this
+ * instance.
+ */
+ navigate(): webdriver.WebDriverNavigation;
+
+ /**
+ * @return {!webdriver.WebDriver.TargetLocator} The target locator interface for
+ * this instance.
+ */
+ switchTo(): webdriver.WebDriverTargetLocator
+
+ //endregion
+ }
+
+ /**
+ * Represents a DOM element. WebElements can be found by searching from the
+ * document root using a {@code webdriver.WebDriver} instance, or by searching
+ * under another {@code webdriver.WebElement}:
+ *
+ * driver.get('http://www.google.com');
+ * var searchForm = driver.findElement(By.tagName('form'));
+ * var searchBox = searchForm.findElement(By.name('q'));
+ * searchBox.sendKeys('webdriver');
+ *
+ * The WebElement is implemented as a promise for compatibility with the promise
+ * API. It will always resolve itself when its internal state has been fully
+ * resolved and commands may be issued against the element. This can be used to
+ * catch errors when an element cannot be located on the page:
+ *
+ * driver.findElement(By.id('not-there')).then(function(element) {
+ * alert('Found an element that was not expected to be there!');
+ * }, function(error) {
+ * alert('The element was not found, as expected');
+ * });
+ *
+ * @extends {webdriver.promise.Deferred}
+ */
+ class WebElement extends webdriver.promise.Deferred {
+ //region Constructors
+
+ /**
+ * @param {!webdriver.WebDriver} driver The parent WebDriver instance for this
+ * element.
+ * @param {!(string|webdriver.promise.Promise)} id Either the opaque ID for the
+ * underlying DOM element assigned by the server, or a promise that will
+ * resolve to that ID or another WebElement.
+ * @constructor
+ */
+ constructor(driver: webdriver.WebDriver, id: webdriver.promise.Promise);
+ constructor(driver: webdriver.WebDriver, id: string);
+
+ //endregion
+
+ //region Static Properties
+
+ /**
+ * The property key used in the wire protocol to indicate that a JSON object
+ * contains the ID of a WebElement.
+ * @type {string}
+ * @const
+ */
+ static ELEMENT_KEY: string;
+
+ //endregion
+
+ //region Methods
+
+ /**
+ * @return {!webdriver.WebDriver} The parent driver for this instance.
+ */
+ getDriver(): webdriver.WebDriver;
+
+ /**
+ * @return {!webdriver.promise.Promise} A promise that resolves to this
+ * element's JSON representation as defined by the WebDriver wire protocol.
+ * @see http://code.google.com/p/selenium/wiki/JsonWireProtocol
+ */
+ toWireValue(): webdriver.promise.Promise;
+
+ /**
+ * Schedule a command to find a descendant of this element. If the element
+ * cannot be found, a {@code 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 {@code #isElementPresent} instead.
+ *
+ * The search criteria for find an element may either be a
+ * {@code webdriver.Locator} object, or a simple JSON object whose sole key
+ * is one of the accepted locator strategies, as defined by
+ * {@code webdriver.Locator.Strategy}. For example, the following two
+ * statements are equivalent:
+ *
+ *
+ * Note that JS locator searches cannot be restricted to a subtree. All such
+ * searches are delegated to this instance's parent WebDriver.
+ *
+ * @param {webdriver.Locator|Object.
+ * var e1 = element.findElement(By.id('foo'));
+ * var e2 = element.findElement({id:'foo'});
+ *
+ *
+ * Note: On browsers where native keyboard events are not yet
+ * supported (e.g. Firefox on OS X), key events will be synthesized. Special
+ * punctionation keys will be synthesized according to a standard QWERTY en-us
+ * keyboard layout.
+ *
+ * @param {...string} var_args The sequence of keys to
+ * type. All arguments will be joined into a single sequence (var_args is
+ * permitted for convenience).
+ * @return {!webdriver.promise.Promise} A promise that will be resolved when all
+ * keys have been typed.
+ */
+ sendKeys(...var_args: string[]): webdriver.promise.Promise;
+
+ /**
+ * Schedules a command to query for the tag/node name of this element.
+ * @return {!webdriver.promise.Promise} A promise that will be resolved with the
+ * element's tag name.
+ */
+ getTagName(): webdriver.promise.Promise;
+
+ /**
+ * Schedules a command to query for the computed style of the element
+ * represented by this instance. If the element inherits the named style from
+ * its parent, the parent will be queried for its value. Where possible, color
+ * values will be converted to their hex representation (e.g. #00ff00 instead of
+ * rgb(0, 255, 0)).
+ *
+ * Warning: the value returned will be as the browser interprets it, so
+ * it may be tricky to form a proper assertion.
+ *
+ * @param {string} cssStyleProperty The name of the CSS style property to look
+ * up.
+ * @return {!webdriver.promise.Promise} A promise that will be resolved with the
+ * requested CSS value.
+ */
+ getCssValue(cssStyleProperty: string): webdriver.promise.Promise;
+
+ /**
+ * Schedules a command to query for the value of the given attribute of the
+ * element. Will return the current value even if it has been modified after the
+ * page has been loaded. More exactly, this method will return the value of the
+ * given attribute, unless that attribute is not present, in which case the
+ * value of the property with the same name is returned. If neither value is
+ * set, null is returned. The "style" attribute is converted as best can be to a
+ * text representation with a trailing semi-colon. The following are deemed to
+ * be "boolean" attributes and will be returned as thus:
+ *
+ *
+ * element.sendKeys("text was",
+ * webdriver.Key.CONTROL, "a", webdriver.Key.NULL,
+ * "now text is");
+ * // Alternatively:
+ * element.sendKeys("text was",
+ * webdriver.Key.chord(webdriver.Key.CONTROL, "a"),
+ * "now text is");
+ *
+ *
+ * @param {string} attributeName The name of the attribute to query.
+ * @return {!webdriver.promise.Promise} A promise that will be resolved with the
+ * attribute's value.
+ */
+ getAttribute(attributeName: string): webdriver.promise.Promise;
+
+ /**
+ * Get the visible (i.e. not hidden by CSS) innerText of this element, including
+ * sub-elements, without any leading or trailing whitespace.
+ * @return {!webdriver.promise.Promise} A promise that will be resolved with the
+ * element's visible text.
+ */
+ getText(): webdriver.promise.Promise;
+
+ /**
+ * Schedules a command to compute the size of this element's bounding box, in
+ * pixels.
+ * @return {!webdriver.promise.Promise} A promise that will be resolved with the
+ * element's size as a {@code {width:number, height:number}} object.
+ */
+ getSize(): webdriver.promise.Promise;
+
+ /**
+ * Schedules a command to compute the location of this element in page space.
+ * @return {!webdriver.promise.Promise} A promise that will be resolved to the
+ * element's location as a {@code {x:number, y:number}} object.
+ */
+ getLocation(): webdriver.promise.Promise;
+
+ /**
+ * Schedules a command to query whether the DOM element represented by this
+ * instance is enabled, as dicted by the {@code disabled} attribute.
+ * @return {!webdriver.promise.Promise} A promise that will be resolved with
+ * whether this element is currently enabled.
+ */
+ isEnabled(): webdriver.promise.Promise;
+
+ /**
+ * Schedules a command to query whether this element is selected.
+ * @return {!webdriver.promise.Promise} A promise that will be resolved with
+ * whether this element is currently selected.
+ */
+ isSelected(): webdriver.promise.Promise;
+
+ /**
+ * Schedules a command to submit the form containing this element (or this
+ * element if it is a FORM element). This command is a no-op if the element is
+ * not contained in a form.
+ * @return {!webdriver.promise.Promise} A promise that will be resolved when
+ * the form has been submitted.
+ */
+ submit(): webdriver.promise.Promise;
+
+ /**
+ * Schedules a command to clear the {@code value} of this element. This command
+ * has no effect if the underlying DOM element is neither a text INPUT element
+ * nor a TEXTAREA element.
+ * @return {!webdriver.promise.Promise} A promise that will be resolved when
+ * the element has been cleared.
+ */
+ clear(): webdriver.promise.Promise;
+
+ /**
+ * Schedules a command to test whether this element is currently displayed.
+ * @return {!webdriver.promise.Promise} A promise that will be resolved with
+ * whether this element is currently visible on the page.
+ */
+ isDisplayed(): webdriver.promise.Promise;
+
+ /**
+ * Schedules a command to retrieve the outer HTML of this element.
+ * @return {!webdriver.promise.Promise} A promise that will be resolved with
+ * the element's outer HTML.
+ */
+ getOuterHtml(): webdriver.promise.Promise;
+
+ /**
+ * Schedules a command to retrieve the inner HTML of this element.
+ * @return {!webdriver.promise.Promise} A promise that will be resolved with the
+ * element's inner HTML.
+ */
+ getInnerHtml(): webdriver.promise.Promise;
+
+ //endregion
+
+ //region Static Methods
+
+ /**
+ * Compares to WebElements for equality.
+ * @param {!webdriver.WebElement} a A WebElement.
+ * @param {!webdriver.WebElement} b A WebElement.
+ * @return {!webdriver.promise.Promise} A promise that will be resolved to
+ * whether the two WebElements are equal.
+ */
+ static equals(a: WebElement, b: WebElement): webdriver.promise.Promise;
+
+ //endregion
+ }
+
+ interface ILocatorStrategy {
+ className(value: string): Locator;
+ 'class name'(value: string): Locator;
+ css(value: string): Locator;
+ id(value: string): Locator;
+ js(value: string): Locator;
+ linkText(value: string): Locator;
+ 'link text'(value: string): Locator;
+ name(value: string): Locator;
+ partialLinkText(value: string): Locator;
+ 'partial link text'(value: string): Locator;
+ tagName(value: string): Locator;
+ 'tag name'(value: string): Locator;
+ xpath(value: string): Locator;
+ }
+
+ var By: ILocatorStrategy;
+
+ /**
+ * An element locator.
+ */
+ class Locator {
+
+ //region Constructors
+
+ /**
+ * An element locator.
+ * @param {string} using The type of strategy to use for this locator.
+ * @param {string} value The search target of this locator.
+ * @constructor
+ */
+ constructor(using: string, value: string);
+
+ //endregion
+
+ //region Properties
+
+ /**
+ * The search strategy to use when searching for an element.
+ * @type {string}
+ */
+ using: string;
+
+ /**
+ * The search target for this locator.
+ * @type {string}
+ */
+ value: string;
+
+ //endregion
+
+ //region Static Properties
+
+ /**
+ * Factory methods for the supported locator strategies.
+ * @type {Object.