cabbie-sync
Version:
A synchronous webdriver client
55 lines (48 loc) • 1.17 kB
Flow
/**
* @flow
* This file is generated automatically, run npm run build to re-generate.
**/
import type Driver from './driver';
import type ActiveWindow from './active-window';
import addDebugging from './add-debugging';
import BaseClass from './base-class';
/*
* Window object
*/
class BaseWindow extends BaseClass {
constructor(driver: Driver, id: string) {
super(driver, '/window/' + id);
}
/*
* Get the size of a window
*/
getSize(): { width: number; height: number; } {
return this.requestJSON('GET', '/size');
}
/*
* Get the size of a window
*/
resize(width: number, height: number): void {
this.requestJSON('POST', '/size', { width: width, height: height });
}
/*
* Maximize a window
*/
maximize(): void {
this.requestJSON('POST', '/maximize');
}
/*
* Get the position of a window
*/
getPosition(): { x: number; y: number; } {
return this.requestJSON('GET', '/position');
}
/*
* Position a window
*/
position(x: number, y: number): void {
this.requestJSON('POST', '/position', { x: x, y: y });
}
}
addDebugging(BaseWindow, { baseClass: true });
export default BaseWindow;