@applitools/spec-driver-selenium 1.1.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,28 @@
3
3
  ## Unreleased
4
4
 
5
5
 
6
+ ## 1.3.1 - 2022/1/12
7
+
8
+ - use chromedriver instead of selenium docker container for testing
9
+ - fix tests for selenium 3
10
+ - fix `getCapabilities` for selenium 3
11
+ - updated to @applitools/types@1.0.23 (from 1.0.20)
12
+ - updated to @applitools/utils@1.2.11 (from 1.2.4)
13
+
14
+ ## 1.3.0 - 2021/11/17
15
+
16
+ - implement `getCapabilities` and `getBarsHeight` instead of `getDriverInfo`
17
+ - updated to @applitools/types@1.0.20 (from 1.0.19)
18
+
19
+ ## 1.2.0 - 2021/11/10
20
+
21
+ - updated to @applitools/types@1.0.19 (from 1.0.15)
22
+ - updated to @applitools/utils@1.2.4 (from 1.2.3)
23
+
24
+ ## 1.1.1 - 2021/10/20
25
+
26
+ - install prettier
27
+
6
28
  ## 1.1.0 - 2021/10/12
7
29
 
8
30
  - change default selenium version
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/spec-driver-selenium",
3
- "version": "1.1.0",
3
+ "version": "1.3.1",
4
4
  "keywords": [
5
5
  "selenium",
6
6
  "selenium-webdriver",
@@ -17,7 +17,8 @@
17
17
  },
18
18
  "repository": {
19
19
  "type": "git",
20
- "url": "git://github.com/applitools/eyes.sdk.javascript1.git"
20
+ "url": "git://github.com/applitools/eyes.sdk.javascript1.git",
21
+ "directory": "packages/spec-driver-selenium"
21
22
  },
22
23
  "license": "SEE LICENSE IN LICENSE",
23
24
  "author": {
@@ -26,20 +27,27 @@
26
27
  },
27
28
  "main": "./dist/index.js",
28
29
  "types": "./types/index.d.ts",
30
+ "exports": {
31
+ ".": {
32
+ "default": "./dist/index.js",
33
+ "types": "./types/index.d.ts"
34
+ }
35
+ },
29
36
  "files": [
30
37
  "dist",
31
38
  "types"
32
39
  ],
33
40
  "scripts": {
34
41
  "lint": "eslint '**/*.ts'",
35
- "build": "yarn build:dist",
36
- "build:dist": "tsc",
42
+ "build": "ttsc",
37
43
  "test": "mocha ./test/**/*.spec.ts --no-timeouts -r ts-node/register -r @applitools/test-utils/mocha-hooks/docker",
38
- "setup": "yarn docker:setup",
44
+ "setup": "yarn chromedriver:setup",
45
+ "chromedriver:setup": "chromedriver --port=4444 --url-base=/wd/hub &",
39
46
  "docker:setup": "node ../scripts/scripts/generate-docker-compose-config.js && docker-compose up -d",
40
47
  "docker:teardown": "docker-compose down",
48
+ "upgrade:framework": "if [ ! -z $APPLITOOLS_SELENIUM_MAJOR_VERSION ]; then packagejson=`cat package.json`; yarn upgrade --no-lockfile selenium-webdriver@$APPLITOOLS_SELENIUM_MAJOR_VERSION; echo \"$packagejson\" > package.json; fi",
41
49
  "deps": "bongo deps",
42
- "gh:test": "gh workflow run test.yml --ref $(git rev-parse --abbrev-ref HEAD) -f packages='spec-selenium spec-selenium@3' -f links='test-utils utils'",
50
+ "gh:test": "gh workflow run test.yml --ref $(git rev-parse --abbrev-ref HEAD) -f packages='spec-selenium spec-selenium@3' -f links='types utils test-utils'",
43
51
  "gh:publish": "gh workflow run publish.yml --ref $(git rev-parse --abbrev-ref HEAD) -f packages='spec-selenium'",
44
52
  "preversion": "bongo preversion",
45
53
  "version": "bongo version",
@@ -51,18 +59,20 @@
51
59
  }
52
60
  },
53
61
  "dependencies": {
54
- "@applitools/utils": "1.2.3"
62
+ "@applitools/types": "1.0.23",
63
+ "@applitools/utils": "1.2.11"
55
64
  },
56
65
  "devDependencies": {
57
- "@applitools/api-extractor": "1.1.3",
58
- "@applitools/scripts": "1.0.1",
59
- "@applitools/sdk-release-kit": "0.13.3",
60
- "@applitools/test-utils": "1.0.9",
66
+ "@applitools/api-extractor": "^1.2.6",
67
+ "@applitools/scripts": "1.1.0",
68
+ "@applitools/sdk-release-kit": "0.13.10",
69
+ "@applitools/test-utils": "1.0.10",
61
70
  "@types/mocha": "^9.0.0",
62
71
  "@types/node": "^16.10.2",
63
72
  "@types/selenium-webdriver": "^4.0.15",
64
73
  "@typescript-eslint/eslint-plugin": "^4.15.1",
65
74
  "@typescript-eslint/parser": "^4.15.1",
75
+ "chromedriver": "^96",
66
76
  "eslint": "^7.9.0",
67
77
  "eslint-config-prettier": "^7.2.0",
68
78
  "eslint-plugin-mocha-no-only": "^1.1.1",
@@ -70,9 +80,11 @@
70
80
  "eslint-plugin-prettier": "^3.3.1",
71
81
  "husky": "^4.3.7",
72
82
  "mocha": "^9.1.2",
73
- "selenium-webdriver": "^4.0.0-rc-2",
83
+ "prettier": "^2.4.1",
84
+ "selenium-webdriver": "^4.1.1",
74
85
  "ts-node": "^10.2.1",
75
- "typescript": "^4.4.3"
86
+ "ttypescript": "^1.5.12",
87
+ "typescript": "^4.5.4"
76
88
  },
77
89
  "peerDependencies": {
78
90
  "selenium-webdriver": ">=3.6.0"
package/dist/index.js DELETED
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- if (!process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION) {
14
- const { version } = require('selenium-webdriver/package.json');
15
- const [major] = version.split('.', 1);
16
- process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION = major;
17
- }
18
- __exportStar(require("./spec-driver"), exports);
@@ -1,368 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
- var __rest = (this && this.__rest) || function (s, e) {
22
- var t = {};
23
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
24
- t[p] = s[p];
25
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
26
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
27
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
28
- t[p[i]] = s[p[i]];
29
- }
30
- return t;
31
- };
32
- Object.defineProperty(exports, "__esModule", { value: true });
33
- exports.build = exports.performAction = exports.getElementText = exports.getElementAttribute = exports.getElementRegion = exports.getOrientation = exports.waitUntilDisplayed = exports.scrollIntoView = exports.type = exports.hover = exports.click = exports.takeScreenshot = exports.visit = exports.getUrl = exports.getTitle = exports.getDriverInfo = exports.setWindowSize = exports.getWindowSize = exports.findElements = exports.findElement = exports.childContext = exports.parentContext = exports.mainContext = exports.executeScript = exports.isEqualElements = exports.isStaleElementError = exports.transformSelector = exports.transformDriver = exports.isSelector = exports.isElement = exports.isDriver = void 0;
34
- const utils = __importStar(require("@applitools/utils"));
35
- // #region HELPERS
36
- const byHash = ['className', 'css', 'id', 'js', 'linkText', 'name', 'partialLinkText', 'tagName', 'xpath'];
37
- function extractElementId(element) {
38
- return element.getId();
39
- }
40
- // #endregion
41
- // #region UTILITY
42
- function isDriver(driver) {
43
- return utils.types.instanceOf(driver, 'WebDriver');
44
- }
45
- exports.isDriver = isDriver;
46
- function isElement(element) {
47
- return utils.types.instanceOf(element, 'WebElement');
48
- }
49
- exports.isElement = isElement;
50
- function isSelector(selector) {
51
- if (!selector)
52
- return false;
53
- return utils.types.has(selector, ['using', 'value']) || byHash.includes(Object.keys(selector)[0]);
54
- }
55
- exports.isSelector = isSelector;
56
- function transformDriver(driver) {
57
- driver.getExecutor().defineCommand('getSessionDetails', 'GET', '/session/:sessionId');
58
- driver.getExecutor().defineCommand('getOrientation', 'GET', '/session/:sessionId/orientation');
59
- driver.getExecutor().defineCommand('getSystemBars', 'GET', '/session/:sessionId/appium/device/system_bars');
60
- driver.getExecutor().defineCommand('performTouch', 'POST', '/session/:sessionId/touch/perform');
61
- if (process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION === '3') {
62
- driver.getExecutor().defineCommand('switchToParentFrame', 'POST', '/session/:sessionId/frame/parent');
63
- }
64
- return driver;
65
- }
66
- exports.transformDriver = transformDriver;
67
- function transformSelector(selector) {
68
- if (utils.types.isString(selector)) {
69
- return { css: selector };
70
- }
71
- else if (utils.types.has(selector, 'selector')) {
72
- if (!utils.types.isString(selector.selector))
73
- return selector.selector;
74
- if (!utils.types.has(selector, 'type'))
75
- return { css: selector.selector };
76
- if (selector.type === 'css')
77
- return { css: selector.selector };
78
- else
79
- return { using: selector.type, value: selector.selector };
80
- }
81
- return selector;
82
- }
83
- exports.transformSelector = transformSelector;
84
- function isStaleElementError(error) {
85
- if (!error)
86
- return false;
87
- error = error.originalError || error;
88
- return error instanceof Error && error.name === 'StaleElementReferenceError';
89
- }
90
- exports.isStaleElementError = isStaleElementError;
91
- async function isEqualElements(_driver, element1, element2) {
92
- if (!element1 || !element2)
93
- return false;
94
- const elementId1 = await extractElementId(element1);
95
- const elementId2 = await extractElementId(element2);
96
- return elementId1 === elementId2;
97
- }
98
- exports.isEqualElements = isEqualElements;
99
- // #endregion
100
- // #region COMMANDS
101
- async function executeScript(driver, script, arg) {
102
- return driver.executeScript(script, arg);
103
- }
104
- exports.executeScript = executeScript;
105
- async function mainContext(driver) {
106
- await driver.switchTo().defaultContent();
107
- return driver;
108
- }
109
- exports.mainContext = mainContext;
110
- async function parentContext(driver) {
111
- if (process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION === '3') {
112
- const { Command } = require('selenium-webdriver/lib/command');
113
- await driver.schedule(new Command('switchToParentFrame'));
114
- return driver;
115
- }
116
- await driver.switchTo().parentFrame();
117
- return driver;
118
- }
119
- exports.parentContext = parentContext;
120
- async function childContext(driver, element) {
121
- await driver.switchTo().frame(element);
122
- return driver;
123
- }
124
- exports.childContext = childContext;
125
- async function findElement(driver, selector, parent) {
126
- try {
127
- const root = parent !== null && parent !== void 0 ? parent : driver;
128
- return await root.findElement(selector);
129
- }
130
- catch (err) {
131
- if (err.name === 'NoSuchElementError')
132
- return null;
133
- else
134
- throw err;
135
- }
136
- }
137
- exports.findElement = findElement;
138
- async function findElements(driver, selector, parent) {
139
- const root = parent !== null && parent !== void 0 ? parent : driver;
140
- return root.findElements(selector);
141
- }
142
- exports.findElements = findElements;
143
- async function getWindowSize(driver) {
144
- try {
145
- const window = driver.manage().window();
146
- if (utils.types.isFunction(window.getSize)) {
147
- return await window.getSize();
148
- }
149
- else {
150
- const rect = await window.getRect();
151
- return { width: rect.width, height: rect.height };
152
- }
153
- }
154
- catch (err) {
155
- // workaround for Appium
156
- const cmd = require('selenium-webdriver/lib/command');
157
- return driver.execute(new cmd.Command(cmd.Name.GET_WINDOW_SIZE).setParameter('windowHandle', 'current'));
158
- }
159
- }
160
- exports.getWindowSize = getWindowSize;
161
- async function setWindowSize(driver, size) {
162
- const window = driver.manage().window();
163
- if (utils.types.isFunction(window.setRect)) {
164
- await window.setRect({ x: 0, y: 0, width: size.width, height: size.height });
165
- }
166
- else {
167
- await window.setPosition(0, 0);
168
- await window.setSize(size.width, size.height);
169
- }
170
- }
171
- exports.setWindowSize = setWindowSize;
172
- async function getDriverInfo(driver) {
173
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
174
- const session = await driver.getSession();
175
- const capabilities = await driver.getCapabilities();
176
- const desiredCapabilities = (_a = capabilities.get('desired')) !== null && _a !== void 0 ? _a : {};
177
- const platformName = (_c = (_b = capabilities.get('platformName')) !== null && _b !== void 0 ? _b : capabilities.get('platform')) !== null && _c !== void 0 ? _c : desiredCapabilities.platformName;
178
- const isMobile = ['android', 'ios'].includes(platformName === null || platformName === void 0 ? void 0 : platformName.toLowerCase());
179
- const info = {
180
- sessionId: session.getId(),
181
- isMobile,
182
- isNative: isMobile && !capabilities.get('browserName'),
183
- deviceName: (_d = desiredCapabilities.deviceName) !== null && _d !== void 0 ? _d : capabilities.get('deviceName'),
184
- platformName,
185
- platformVersion: capabilities.get('platformVersion'),
186
- browserName: (_e = capabilities.get('browserName')) !== null && _e !== void 0 ? _e : desiredCapabilities === null || desiredCapabilities === void 0 ? void 0 : desiredCapabilities.browserName,
187
- browserVersion: (_f = capabilities.get('browserVersion')) !== null && _f !== void 0 ? _f : capabilities.get('version'),
188
- };
189
- if (info.isNative) {
190
- const { Command } = require('selenium-webdriver/lib/command');
191
- let details;
192
- if (capabilities.has('viewportRect') && capabilities.has('pixelRatio') && capabilities.has('statBarHeight')) {
193
- details = {
194
- viewportRect: capabilities.get('viewportRect'),
195
- pixelRatio: capabilities.get('pixelRatio'),
196
- statBarHeight: capabilities.get('statBarHeight'),
197
- };
198
- }
199
- else {
200
- const getSessionDetailsCommand = new Command('getSessionDetails');
201
- details =
202
- process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION === '3'
203
- ? await driver.schedule(getSessionDetailsCommand)
204
- : await driver.execute(getSessionDetailsCommand);
205
- }
206
- info.pixelRatio = details.pixelRatio;
207
- try {
208
- const getSystemBars = new Command('getSystemBars');
209
- const { statusBar, navigationBar } = process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION === '3'
210
- ? await driver.schedule(getSystemBars)
211
- : await driver.execute(getSystemBars);
212
- info.statusBarHeight = statusBar.visible ? statusBar.height : 0;
213
- info.navigationBarHeight = navigationBar.visible ? navigationBar.height : 0;
214
- }
215
- catch (err) {
216
- info.statusBarHeight = (_j = (_g = details.statBarHeight) !== null && _g !== void 0 ? _g : (_h = details.viewportRect) === null || _h === void 0 ? void 0 : _h.top) !== null && _j !== void 0 ? _j : 0;
217
- info.navigationBarHeight = 0;
218
- }
219
- }
220
- return info;
221
- }
222
- exports.getDriverInfo = getDriverInfo;
223
- async function getTitle(driver) {
224
- return driver.getTitle();
225
- }
226
- exports.getTitle = getTitle;
227
- async function getUrl(driver) {
228
- return driver.getCurrentUrl();
229
- }
230
- exports.getUrl = getUrl;
231
- async function visit(driver, url) {
232
- await driver.get(url);
233
- }
234
- exports.visit = visit;
235
- async function takeScreenshot(driver) {
236
- return driver.takeScreenshot();
237
- }
238
- exports.takeScreenshot = takeScreenshot;
239
- async function click(driver, element) {
240
- if (isSelector(element))
241
- element = await findElement(driver, element);
242
- await element.click();
243
- }
244
- exports.click = click;
245
- async function hover(driver, element) {
246
- if (isSelector(element))
247
- element = await findElement(driver, element);
248
- if (process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION === '3') {
249
- const { ActionSequence } = require('selenium-webdriver');
250
- const action = new ActionSequence(driver);
251
- await action.mouseMove(element).perform();
252
- }
253
- else {
254
- await driver.actions().move({ origin: element }).perform();
255
- }
256
- }
257
- exports.hover = hover;
258
- async function type(driver, element, keys) {
259
- if (isSelector(element))
260
- element = await findElement(driver, element);
261
- await element.sendKeys(keys);
262
- }
263
- exports.type = type;
264
- async function scrollIntoView(driver, element, align = false) {
265
- if (isSelector(element))
266
- element = await findElement(driver, element);
267
- await driver.executeScript('arguments[0].scrollIntoView(arguments[1])', element, align);
268
- }
269
- exports.scrollIntoView = scrollIntoView;
270
- async function waitUntilDisplayed(driver, selector, timeout) {
271
- const { until } = require('selenium-webdriver');
272
- const element = await findElement(driver, selector);
273
- await driver.wait(until.elementIsVisible(element), timeout);
274
- }
275
- exports.waitUntilDisplayed = waitUntilDisplayed;
276
- // #endregion
277
- // #region MOBILE COMMANDS
278
- async function getOrientation(driver) {
279
- const { Command } = require('selenium-webdriver/lib/command');
280
- const getOrientationCommand = new Command('getOrientation');
281
- const orientation = process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION === '3'
282
- ? await driver.schedule(getOrientationCommand)
283
- : await driver.execute(getOrientationCommand);
284
- return orientation.toLowerCase();
285
- }
286
- exports.getOrientation = getOrientation;
287
- async function getElementRegion(_driver, element) {
288
- if (utils.types.isFunction(element.getRect)) {
289
- return element.getRect();
290
- }
291
- else {
292
- const { x, y } = await element.getLocation();
293
- const { width, height } = await element.getSize();
294
- return { x, y, width, height };
295
- }
296
- }
297
- exports.getElementRegion = getElementRegion;
298
- async function getElementAttribute(_driver, element, attr) {
299
- return element.getAttribute(attr);
300
- }
301
- exports.getElementAttribute = getElementAttribute;
302
- async function getElementText(_driver, element) {
303
- return element.getText();
304
- }
305
- exports.getElementText = getElementText;
306
- async function performAction(driver, steps) {
307
- const { Command } = require('selenium-webdriver/lib/command');
308
- const performTouchCommand = new Command('performTouch').setParameters({
309
- actions: steps.map((_a) => {
310
- var { action } = _a, options = __rest(_a, ["action"]);
311
- return ({ action, options });
312
- }),
313
- });
314
- if (process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION === '3') {
315
- await driver.schedule(performTouchCommand);
316
- }
317
- else {
318
- await driver.execute(performTouchCommand);
319
- }
320
- }
321
- exports.performAction = performAction;
322
- // #endregion
323
- // #region TESTING
324
- const browserOptionsNames = {
325
- chrome: 'goog:chromeOptions',
326
- firefox: 'moz:firefoxOptions',
327
- };
328
- async function build(env) {
329
- var _a;
330
- const { Builder } = require('selenium-webdriver');
331
- const parseEnv = require('@applitools/test-utils/src/parse-env');
332
- const { browser, capabilities, url, attach, proxy, configurable = true, appium = false, args = [], headless, } = parseEnv(Object.assign(Object.assign({}, env), { legacy: (_a = env.legacy) !== null && _a !== void 0 ? _a : process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION === '3' }));
333
- const desiredCapabilities = Object.assign({}, capabilities);
334
- if (configurable) {
335
- const browserOptionsName = browserOptionsNames[browser || desiredCapabilities.browserName];
336
- if (browserOptionsName) {
337
- const browserOptions = desiredCapabilities[browserOptionsName] || {};
338
- browserOptions.args = [...(browserOptions.args || []), ...args];
339
- if (headless)
340
- browserOptions.args.push('headless');
341
- if (attach) {
342
- browserOptions.debuggerAddress = attach === true ? 'localhost:9222' : attach;
343
- if (browser !== 'firefox')
344
- browserOptions.w3c = false;
345
- }
346
- desiredCapabilities[browserOptionsName] = browserOptions;
347
- }
348
- }
349
- if (appium && browser === 'chrome') {
350
- desiredCapabilities['appium:chromeOptions'] = { w3c: false };
351
- }
352
- const builder = new Builder().withCapabilities(desiredCapabilities);
353
- if (url && !attach)
354
- builder.usingServer(url.href);
355
- if (proxy) {
356
- builder.setProxy({
357
- proxyType: 'manual',
358
- httpProxy: proxy.http || proxy.server,
359
- sslProxy: proxy.https || proxy.server,
360
- ftpProxy: proxy.ftp,
361
- noProxy: proxy.bypass,
362
- });
363
- }
364
- const driver = await builder.build();
365
- return [driver, () => driver.quit()];
366
- }
367
- exports.build = build;
368
- // #endregion
package/types/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './spec-driver';
@@ -1,54 +0,0 @@
1
- import type * as Selenium from 'selenium-webdriver';
2
- export declare type Driver = Selenium.WebDriver;
3
- export declare type Element = Selenium.WebElement;
4
- export declare type Selector = Selenium.Locator | {
5
- using: string;
6
- value: string;
7
- };
8
- declare type CommonSelector = string | {
9
- selector: Selector | string;
10
- type?: string;
11
- };
12
- export declare function isDriver(driver: any): driver is Driver;
13
- export declare function isElement(element: any): element is Element;
14
- export declare function isSelector(selector: any): selector is Selector;
15
- export declare function transformDriver(driver: Driver): Driver;
16
- export declare function transformSelector(selector: Selector | CommonSelector): Selector;
17
- export declare function isStaleElementError(error: any): boolean;
18
- export declare function isEqualElements(_driver: Driver, element1: Element, element2: Element): Promise<boolean>;
19
- export declare function executeScript(driver: Driver, script: ((arg: any) => any) | string, arg: any): Promise<any>;
20
- export declare function mainContext(driver: Driver): Promise<Driver>;
21
- export declare function parentContext(driver: Driver): Promise<Driver>;
22
- export declare function childContext(driver: Driver, element: Element): Promise<Driver>;
23
- export declare function findElement(driver: Driver, selector: Selector, parent?: Element): Promise<Element>;
24
- export declare function findElements(driver: Driver, selector: Selector, parent?: Element): Promise<Element[]>;
25
- export declare function getWindowSize(driver: Driver): Promise<{
26
- width: number;
27
- height: number;
28
- }>;
29
- export declare function setWindowSize(driver: Driver, size: {
30
- width: number;
31
- height: number;
32
- }): Promise<void>;
33
- export declare function getDriverInfo(driver: Driver): Promise<any>;
34
- export declare function getTitle(driver: Driver): Promise<string>;
35
- export declare function getUrl(driver: Driver): Promise<string>;
36
- export declare function visit(driver: Driver, url: string): Promise<void>;
37
- export declare function takeScreenshot(driver: Driver): Promise<string>;
38
- export declare function click(driver: Driver, element: Element | Selector): Promise<void>;
39
- export declare function hover(driver: Driver, element: Element | Selector): Promise<void>;
40
- export declare function type(driver: Driver, element: Element | Selector, keys: string): Promise<void>;
41
- export declare function scrollIntoView(driver: Driver, element: Element | Selector, align?: boolean): Promise<void>;
42
- export declare function waitUntilDisplayed(driver: Driver, selector: Selector, timeout: number): Promise<void>;
43
- export declare function getOrientation(driver: Driver): Promise<'portrait' | 'landscape'>;
44
- export declare function getElementRegion(_driver: Driver, element: Element): Promise<{
45
- x: number;
46
- y: number;
47
- width: number;
48
- height: number;
49
- }>;
50
- export declare function getElementAttribute(_driver: Driver, element: Element, attr: string): Promise<string>;
51
- export declare function getElementText(_driver: Driver, element: Element): Promise<string>;
52
- export declare function performAction(driver: Driver, steps: any[]): Promise<void>;
53
- export declare function build(env: any): Promise<[Driver, () => Promise<void>]>;
54
- export {};