From 8a28db5bd2f7b7fbb9ac85b6aae85dded222859e Mon Sep 17 00:00:00 2001 From: Savka Oleg Date: Wed, 17 Mar 2021 13:54:53 +0200 Subject: [PATCH] Add mob.getWindowSize --- .../module-mob/commands/getWindowSize.js | 21 +++++++++++++++++++ src/ox_modules/module-mob/commands/index.js | 1 + 2 files changed, 22 insertions(+) create mode 100644 src/ox_modules/module-mob/commands/getWindowSize.js diff --git a/src/ox_modules/module-mob/commands/getWindowSize.js b/src/ox_modules/module-mob/commands/getWindowSize.js new file mode 100644 index 00000000..eca5270c --- /dev/null +++ b/src/ox_modules/module-mob/commands/getWindowSize.js @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2015-present CloudBeat Limited + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + */ + +/** + * @summary Sets the size of the outer browser window. + * @function getWindowSize + * @return {Object} Size object. Example: { height: 1056, width: 1936, x: -8, y: -8 } + * @example [javascript] Usage example + * mob.init();//Opens browser session. + * mob.open("www.yourwebsite.com");// Opens a website. + * const sizeObject = mob.getWindowSize(); + */ +module.exports = async function() { + return await this.driver.getWindowSize(); +}; \ No newline at end of file diff --git a/src/ox_modules/module-mob/commands/index.js b/src/ox_modules/module-mob/commands/index.js index 93040223..b111f3b0 100644 --- a/src/ox_modules/module-mob/commands/index.js +++ b/src/ox_modules/module-mob/commands/index.js @@ -29,6 +29,7 @@ export {default as getText} from './getText'; export {default as getTitle} from './getTitle'; export {default as getUrl} from './getUrl'; export {default as getValue} from './getValue'; +export {default as getWindowSize} from './getWindowSize'; export {default as hideKeyboard} from './hideKeyboard'; export {default as index} from './index'; export {default as installApp} from './installApp';