(onFulfilled?: (value: T) => P | Client
, onRejected?: (err: any) => P | Client
): Client
; catch
(onRejected?: (err: any) => P | Client
): Client
;
inspect(): Q.PromiseState (
selector: string,
value: string | number,
callback: (err: any) => P
): Client ;
clearElement(selector: string): Client (
selector: string,
callback: (err: any) => P
): Client ;
click(selector: string): Client (
selector: string,
callback: (err: any) => P
): Client ;
doubleClick(selector: string): Client (
selector: string,
callback: (err: any) => P
): Client ;
dragAndDrop(sourceElem: string, destinationElem: string): Client (
sourceElem: string,
destinationElem: string, callback: (err: any) => P
): Client ;
leftClick(selector: string): Client (
selector: string,
callback: (err: any) => P
): Client ;
middleClick(selector: string): Client (
selector: string,
callback: (err: any) => P
): Client ;
moveToObject(selector: string): Client (
selector: string,
callback: (err: any) => P
): Client ;
moveToObject (
selector: string,
xoffset: number,
yoffset: number,
callback: (err: any) => P
): Client ;
rightClick(selector: string): Client (
selector: string,
callback: (err: any) => P
): Client ;
selectByIndex(selectElem: string, index: number): Client (
selectElem: string,
index: number,
callback: (err: any) => P
): Client ;
selectByValue(selectElem: string, value: string): Client (
selectElem: string,
value: string,
callback: (err: any) => P
): Client ;
selectByVisibleText(selectElem: string, text: string): Client (
selectElem: string,
text: string,
callback: (err: any) => P
): Client ;
selectorExecute (
selectors: string | string[],
script: (elements: HTMLElement | HTMLElement[], ...args: any[]) => P,
...args: any[]
): Client ;
selectorExecuteAsync (
selectors: string | string[],
script: (elements: HTMLElement | HTMLElement[], ...args: any[]) => P,
...args: any[]
): Client ;
setValue(selector: string, values: number | string | Array (
selector: string,
values: number | string | Array (
selector: string,
callback: (err: any) => P
): Client (
callback: (err: any) => P
): Client ;
deleteCookie (
name: string,
callback: (err: any) => P
): Client ;
getCookie(): Client (
callback: (err: any, cookies: Cookie[]) => P
): Client ;
getCookie (
name: string,
callback: (err: any, cookie: Cookie) => P
): Client ;
setCookie(cookie: Cookie): Client (
cookie: Cookie,
callback: (err: any) => P
): Client ;
}
// Mobile
export interface Client (
selector: string,
attributeName: string,
callback: (err: any, attribute: string | string[]) => P
): Client ;
getCssProperty(selector: string, cssProperty: string): Client (
selector: string,
cssProperty: string,
callback: (err: any, cssProperty: CssProperty | CssProperty[]) => P
): Client ;
getElementSize(selector: string): Client (
selector: string,
callback: (err: any, size: Size | Size[]) => P
): Client ;
getElementSize (
selector: string,
dimension: string,
callback: (err: any, elementSize: number | number[]) => P
): Client ;
getHTML(selector: string, includeSelectorTag?: boolean): Client (
selector: string,
callback: (err: any, html: string | string[]) => P
): Client ;
getHTML (
selector: string,
includeSelectorTag: boolean,
callback: (err: any, html: string | string[]) => P
): Client ;
getLocation(selector: string): Client (
selector: string,
callback: (err: any, size: Size) => P
): Client ;
getLocation (
selector: string,
axis: string,
callback: (err: any, location: number) => P
): Client ;
getLocationInView(selector: string): Client (
selector: string,
callback: (err: any, size: Size | Size[]) => P
): Client ;
getLocationInView (
selector: string,
axis: string,
callback: (err: any, location: number | number[]) => P
): Client ;
getSource(): Client (callback: (err: any, source: string) => P): Client ;
getTagName(selector: string): Client (
selector: string,
callback: (err: any, tagName: string | string[]) => P
): Client ;
getText(selector: string): Client (
selector: string,
callback: (err: any, text: string | string[]) => P
): Client ;
getTitle(): Client (
callback: (err: any, title: string) => P
): Client ;
getUrl(): Client (
callback: (err: any, title: string) => P
): Client ;
getValue(selector: string): Client (
selector: string,
callback: (err: any, value: string | string[]) => P
): Client ;
}
export interface LogEntry {
timestamp: number;
level: string;
message: string;
}
export enum ApplicationCacheStatus {
UNCACHED = 0,
IDLE = 1,
CHECKING = 2,
DOWNLOADING = 3,
UPDATE_READY = 4,
OBSOLETE = 5
}
export enum Button {
left = 0,
middle = 1,
right = 2
}
export interface StorageItem {
key: string;
value: any;
}
export interface Location {
latitude: number;
longitude: number;
altitude: number;
}
export interface Session {
id: string;
capabilities: any;
}
export interface RawResult (
callback: (err: any) => P
): Client ;
forward(): Client (
callback: (err: any) => P
): Client ;
refresh(): Client (
callback: (err: any) => P
): Client ;
url(): Client (
callback: (err: any, result: RawResult ;
url (
url: string,
callback: (err: any) => P
): Client ;
}
// Advanced input
export interface Client (
callback: (err: any) => P
): Client ;
buttonDown (
button: string | Button,
callback: (err: any) => P
): Client ;
// you probably want to use the click and drag and drop commands instead
buttonPress(button?: string | Button): Client (
callback: (err: any) => P
): Client ;
buttonPress (
button: string | Button,
callback: (err: any) => P
): Client ;
// you probably want to use the click and drag and drop commands instead
buttonUp(button?: string | Button): Client (
callback: (err: any) => P
): Client ;
buttonUp(button?: string | Button): Client (
button: string | Button,
callback: (err: any) => P
): Client ;
// you probably want to use the click and drag and drop commands instead
doDoubleClick(): Client (
callback: (err: any) => P
): Client ;
// you probably want to use addValue and setValue instead
keys(value: string | string[]): Client (
value: string | string[],
callback: (err: any) => P
): Client ;
// you probably want to use the moveToObject command instead
moveTo(id: ElementId, xoffset?: number, yoffset?: number): Client (
id: ElementId,
callback: (err: any) => P
): Client ;
moveTo (
id: ElementId,
xoffset: number,
callback: (err: any) => P
): Client ;
moveTo (
id: ElementId,
xoffset: number,
yoffset: number,
callback: (err: any) => P
): Client ;
// touchClick
// touchDoubleClick
// touchDown
// touchFlick
// touchLongClick
// touchMove
// touchScroll
// touchUp
}
// Useful Protocol
export interface Client (
callback: (err: any) => P
): Client ;
alertDismiss(): Client (
callback: (err: any) => P
): Client ;
alertText(text?: string): Client (
callback: (err: any, text: string) => P
): Client ;
alertText (
text: string,
callback: (err: any, text: string) => P
): Client ;
frame(id: any): Client (
id: any,
callback: (err: any) => P
): Client ;
frameParent(): Client (
callback: (err: any) => P
): Client ;
init(capabilities?: DesiredCapabilities): Client (
callback: (err: any) => P
): Client ;
init (
capabilities: DesiredCapabilities,
callback: (err: any) => P
): Client ;
log(type: string): Client (
type: string,
callback: (err: any, result: RawResult ;
logTypes(): Client (
callback: (err: any, result: RawResult ;
session(action?: string, sessionId?: string): Client (
callback: (err: any, result: RawResult ;
session (
action: string,
callback: (err: any, result: RawResult ;
session (
action: string,
sessionId: string,
callback: (err: any, result: RawResult ;
sessions(): Client (
callback: (err: any, sessions: RawResult ;
// timeouts
// timeoutsAsyncScript
// timeoutsImplicitWait
// window
// windowHandle
// windowHandleMaximize
// windowHandlePosition
// windowHandleSize
// windowHandles
}
export type ElementId = string;
export interface Element {
ELEMENT: ElementId;
}
// Element
export interface Client (
selector: string,
callback: (err: any, result: RawResult ;
elementActive(): Client (
callback: (err: any, element: Element) => P
): Client ;
elementIdAttribute(id: ElementId, attributeName: string): Client (
id: ElementId,
attributeName: string,
callback: (err: any, result: RawResult ;
elementIdClear(id: ElementId): Client (
id: ElementId,
callback: (err: any) => P
): Client ;
elementIdClick(id: ElementId): Client (
id: ElementId,
callback: (err: any) => P
): Client ;
elementIdCssProperty(id: ElementId, propertyName: string): Client (
id: ElementId,
propertyName: string,
callback: (err: any, result: RawResult ;
elementIdDisplayed(id: ElementId): Client (
id: ElementId,
callback: (err: any, result: RawResult ;
elementIdElement(id: ElementId, selector: string): Client (
id: ElementId,
selector: string,
callback: (err: any, result: RawResult ;
elementIdElements(id: ElementId, selector: string): Client (
id: ElementId,
selector: string,
callback: (err: any, result: RawResult ;
elementIdEnabled(id: ElementId): Client (
id: ElementId,
callback: (err: any, result: RawResult ;
elementIdLocation(id: ElementId): Client (
id: ElementId,
callback: (err: any, result: RawResult ;
elementIdLocationInView(id: ElementId): Client (
id: ElementId,
callback: (err: any, result: RawResult ;
elementIdName(id: ElementId): Client (
id: ElementId,
callback: (err: any, result: RawResult ;
elementIdSelected(id: ElementId): Client (
id: ElementId,
callback: (err: any, result: RawResult ;
elementIdSize(id: ElementId): Client (
id: ElementId,
callback: (err: any, result: RawResult ;
elementIdText(id: ElementId): Client (
id: ElementId,
callback: (err: any, result: RawResult ;
elementIdValue(id: ElementId, values: string | string[]): Client (
id: ElementId,
values: string | string[],
callback: (err: any, result: RawResult ;
elements(selector: string): Client (
selector: string,
callback: (err: any, result: RawResult ;
}
// Unuseful Protocol
export interface Client (
id: ElementId,
callback: (err: any) => P
): Client ;
// title
}
// State
export interface Client (
selector: string,
callback: (err: any, isEnabled: boolean) => P
): Client ;
isExisting(selector: string): Client (
selector: string,
callback: (err: any, isExisting: boolean) => P
): Client ;
isSelected(selector: string): Client (
selector: string,
callback: (err: any, isSelected: boolean) => P
): Client ;
isVisible(selector: string): Client (
selector: string,
callback: (err: any, isVisible: boolean) => P
): Client ;
isVisibleWithinViewport(selector: string): Client (
selector: string,
callback: (err: any, isVisible: boolean) => P
): Client ;
}
export interface CommandHistoryEntry {
command: string;
args: any[];
}
// Utility
export interface Client (
commandName: string,
customMethod: Function,
callback: (err: any) => P
): Client ;
addCommand (
commandName: string,
customMethod: Function,
overwrite: boolean,
callback: (err: any) => P
): Client ;
chooseFile(selector: string, localPath: string): Client (
selector: string,
localPath: string,
callback: (err: any) => P
): Client ;
debug(): Client (
callback: (err: any) => P
): Client ;
end(): Client (
callback: (err: any) => P
): Client ;
endAll(): Client (
callback: (err: any) => P
): Client ;
getCommandHistory(): Client (
callback: (err: any, history: CommandHistoryEntry[]) => P
): Client ;
pause(milliseconds: number): Client (milliseconds: number, callback: (err: any) => P): Client ;
saveScreenshot(filename?: string): Client (
callback: (err: any, screenshot: Buffer) => P
): Client ;
saveScreenshot (
filename: string,
callback: (err: any, screenshot: Buffer) => P
): Client ;
scroll(selector: string): Client (
selector: string,
callback: (err: any) => P
): Client ;
scroll (
selector: string,
xoffset: number,
yoffset: number,
callback: (err: any) => P
): Client ;
scroll (
xoffset: number,
yoffset: number,
callback: (err: any) => P
): Client ;
uploadFile(localPath: string): Client (
localPath: string,
callback: (err: any) => P
): Client ;
waitForEnabled(selector: string, milliseconds?: number, reverse?: boolean): Client