@applitools/spec-driver-webdriver 1.2.6 → 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
@@ -1,5 +1,40 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.3.1](https://github.com/Applitools-Dev/sdk/compare/js/spec-driver-webdriver@1.3.0...js/spec-driver-webdriver@1.3.1) (2025-07-15)
4
+
5
+
6
+ ### Dependencies
7
+
8
+ * @applitools/driver bumped to 1.22.1
9
+ #### Performance Improvements
10
+
11
+ * yarn dedup packages ([#3061](https://github.com/Applitools-Dev/sdk/issues/3061)) ([2fd8951](https://github.com/Applitools-Dev/sdk/commit/2fd8951d6ce9c18a5dbdb648adaa2c454eae9b4e))
12
+
13
+ ## [1.3.0](https://github.com/Applitools-Dev/sdk/compare/js/spec-driver-webdriver@1.2.6...js/spec-driver-webdriver@1.3.0) (2025-07-07)
14
+
15
+
16
+ ### Features
17
+
18
+ * canvas webgl without preserveDrawingBuffer=1 | FLD-3144 ([#3040](https://github.com/Applitools-Dev/sdk/issues/3040)) ([f82d8f1](https://github.com/Applitools-Dev/sdk/commit/f82d8f148f913098752ec7bef8635a46b453d6fa))
19
+ * support https_proxy and http_proxy env variables | FLD-2702 ([#3046](https://github.com/Applitools-Dev/sdk/issues/3046)) ([0633809](https://github.com/Applitools-Dev/sdk/commit/06338099f44bfb149a5829f62c2f9b19e2392850))
20
+
21
+
22
+ ### Dependencies
23
+
24
+ * @applitools/utils bumped to 1.9.0
25
+ #### Features
26
+
27
+ * support https_proxy and http_proxy env variables | FLD-2702 ([#3046](https://github.com/Applitools-Dev/sdk/issues/3046)) ([0633809](https://github.com/Applitools-Dev/sdk/commit/06338099f44bfb149a5829f62c2f9b19e2392850))
28
+ * @applitools/logger bumped to 2.1.5
29
+
30
+ * @applitools/driver bumped to 1.22.0
31
+ #### Features
32
+
33
+ * canvas webgl without preserveDrawingBuffer=1 | FLD-3144 ([#3040](https://github.com/Applitools-Dev/sdk/issues/3040)) ([f82d8f1](https://github.com/Applitools-Dev/sdk/commit/f82d8f148f913098752ec7bef8635a46b453d6fa))
34
+
35
+
36
+
37
+
3
38
  ## [1.2.6](https://github.com/Applitools-Dev/sdk/compare/js/spec-driver-webdriver@1.2.5...js/spec-driver-webdriver@1.2.6) (2025-06-15)
4
39
 
5
40
 
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.build = exports.switchWorld = exports.getWorlds = exports.getCurrentWorld = exports.takeScreenshot = exports.performAction = exports.visit = exports.getUrl = exports.getTitle = exports.getCookies = exports.getSystemBars = exports.setOrientation = exports.getOrientation = exports.setViewportSize = exports.setWindowSize = exports.getWindowSize = exports.getCapabilities = exports.getDriverInfo = exports.childContext = exports.parentContext = exports.mainContext = exports.click = exports.hover = exports.getElementText = exports.setElementText = exports.getElementAttribute = exports.getElementRegion = exports.findElements = exports.findElement = exports.executeScript = exports.toSimpleCommonSelector = exports.toSelector = exports.toElement = exports.toDriver = exports.isStaleElementError = exports.isEqualElements = exports.isSelector = exports.isShadowRoot = exports.isSecondaryElement = exports.isElement = exports.isSecondaryDriver = exports.isDriver = void 0;
29
+ exports.build = exports.switchWorld = exports.getWorlds = exports.getCurrentWorld = exports.takeScreenshot = exports.performAction = exports.visit = exports.getUrl = exports.getTitle = exports.getCookies = exports.getSystemBars = exports.setOrientation = exports.getOrientation = exports.setViewportSize = exports.setWindowSize = exports.getWindowSize = exports.getCapabilities = exports.getDriverInfo = exports.childContext = exports.parentContext = exports.mainContext = exports.click = exports.hover = exports.getElementText = exports.setElementText = exports.getElementAttribute = exports.getElementRegion = exports.findElements = exports.findElement = exports.executeBrowserCommands = exports.executeScript = exports.toSimpleCommonSelector = exports.toSelector = exports.toElement = exports.toDriver = exports.isStaleElementError = exports.isEqualElements = exports.isSelector = exports.isShadowRoot = exports.isSecondaryElement = exports.isElement = exports.isSecondaryDriver = exports.isDriver = void 0;
30
30
  const url_1 = require("url");
31
31
  const http_proxy_agent_1 = __importDefault(require("http-proxy-agent"));
32
32
  const https_proxy_agent_1 = __importDefault(require("https-proxy-agent"));
@@ -94,6 +94,18 @@ function getFrameworkMajorVersion() {
94
94
  function getWebDriver() {
95
95
  return getFrameworkMajorVersion() < 8 ? require('webdriver').default : require('webdriver');
96
96
  }
97
+ function getProxyConfiguration() {
98
+ const httpProxy = utils.general.getEnvCaseInsensitive('HTTP_PROXY');
99
+ const httpsProxy = utils.general.getEnvCaseInsensitive('HTTPS_PROXY');
100
+ if (!httpProxy && !httpsProxy) {
101
+ return { hasProxy: false, httpUrl: null, httpsUrl: null };
102
+ }
103
+ return {
104
+ hasProxy: true,
105
+ httpUrl: new URL(httpProxy !== null && httpProxy !== void 0 ? httpProxy : httpsProxy),
106
+ httpsUrl: new URL(httpsProxy !== null && httpsProxy !== void 0 ? httpsProxy : httpProxy),
107
+ };
108
+ }
97
109
  function getAgents(httpUrl, httpsUrl) {
98
110
  const httpProxyOptions = { ...(0, url_1.parse)(httpUrl.href), rejectUnauthorized: false };
99
111
  const httpAgent = (0, http_proxy_agent_1.default)(httpProxyOptions);
@@ -156,7 +168,7 @@ function isStaleElementError(error) {
156
168
  }
157
169
  exports.isStaleElementError = isStaleElementError;
158
170
  function toDriver(driver) {
159
- var _a, _b, _c, _d, _e;
171
+ var _a, _b, _c;
160
172
  let transformedDriver;
161
173
  if (utils.types.has(driver, ['sessionId', 'serverUrl'])) {
162
174
  const url = new URL(driver.serverUrl);
@@ -184,17 +196,17 @@ function toDriver(driver) {
184
196
  const { httpAgent, httpsAgent } = getAgents(proxyUrl, proxyUrl);
185
197
  options.agent = { http: httpAgent, https: httpsAgent };
186
198
  }
187
- else if (process.env.HTTP_PROXY || process.env.HTTPS_PROXY) {
188
- // these could be different but if not set as same
189
- const httpUrl = new URL(((_d = process.env.HTTP_PROXY) !== null && _d !== void 0 ? _d : process.env.HTTPS_PROXY));
190
- const httpsUrl = new URL(((_e = process.env.HTTPS_PROXY) !== null && _e !== void 0 ? _e : process.env.HTTP_PROXY));
191
- const { httpAgent, httpsAgent } = getAgents(httpUrl, httpsUrl);
192
- options.agent = { http: httpAgent, https: httpsAgent };
193
- }
194
199
  else {
195
- const httpAgent = http_1.default.globalAgent;
196
- const httpsAgent = new https_1.default.Agent({ rejectUnauthorized: false });
197
- options.agent = { http: httpAgent, https: httpsAgent };
200
+ const proxyConfig = getProxyConfiguration();
201
+ if (proxyConfig.hasProxy) {
202
+ const { httpAgent, httpsAgent } = getAgents(proxyConfig.httpUrl, proxyConfig.httpsUrl);
203
+ options.agent = { http: httpAgent, https: httpsAgent };
204
+ }
205
+ else {
206
+ const httpAgent = http_1.default.globalAgent;
207
+ const httpsAgent = new https_1.default.Agent({ rejectUnauthorized: false });
208
+ options.agent = { http: httpAgent, https: httpsAgent };
209
+ }
198
210
  }
199
211
  const WebDriver = getWebDriver();
200
212
  transformedDriver = WebDriver.attachToSession(options);
@@ -286,6 +298,16 @@ async function executeScript(driver, script, arg) {
286
298
  return result;
287
299
  }
288
300
  exports.executeScript = executeScript;
301
+ async function executeBrowserCommands(driver, commands, logger) {
302
+ var _a;
303
+ let lastResponse;
304
+ for (const currentCommand of commands) {
305
+ lastResponse = await driver.sendCommandAndGetResult(currentCommand.command.toString(), (_a = currentCommand.params) !== null && _a !== void 0 ? _a : {});
306
+ logger === null || logger === void 0 ? void 0 : logger.debug(`executeBrowserCommands ${currentCommand.command}, params: ${currentCommand.params}, response: ${JSON.stringify(lastResponse)}`);
307
+ }
308
+ return lastResponse;
309
+ }
310
+ exports.executeBrowserCommands = executeBrowserCommands;
289
311
  async function findElement(driver, selector, parent) {
290
312
  const parentId = parent ? (isShadowRoot(parent) ? extractShadowRootId(parent) : extractElementId(parent)) : null;
291
313
  try {
@@ -495,7 +517,6 @@ const browserOptionsNames = {
495
517
  * installed in the SDK, then this function will error.
496
518
  */
497
519
  async function build(env) {
498
- var _a, _b;
499
520
  const WebDriver = getWebDriver();
500
521
  const parseEnv = require('@applitools/test-utils/src/parse-env');
501
522
  const { browser = '', capabilities, url, proxy, configurable = true, args = [], headless, logLevel = 'silent', } = parseEnv(env);
@@ -531,10 +552,9 @@ async function build(env) {
531
552
  noProxy: proxy.bypass.join(','),
532
553
  };
533
554
  }
534
- if (process.env.HTTP_PROXY || process.env.HTTPS_PROXY) {
535
- const httpUrl = new URL(((_a = process.env.HTTP_PROXY) !== null && _a !== void 0 ? _a : process.env.HTTPS_PROXY));
536
- const httpsUrl = new URL(((_b = process.env.HTTPS_PROXY) !== null && _b !== void 0 ? _b : process.env.HTTP_PROXY));
537
- const { httpAgent, httpsAgent } = getAgents(httpUrl, httpsUrl);
555
+ const proxyConfig = getProxyConfiguration();
556
+ if (proxyConfig.hasProxy) {
557
+ const { httpAgent, httpsAgent } = getAgents(proxyConfig.httpUrl, proxyConfig.httpsUrl);
538
558
  options.agent = { http: httpAgent, https: httpsAgent };
539
559
  }
540
560
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/spec-driver-webdriver",
3
- "version": "1.2.6",
3
+ "version": "1.3.1",
4
4
  "keywords": [
5
5
  "webdriver",
6
6
  "chrome devtools protocol",
@@ -49,8 +49,8 @@
49
49
  "up:framework": "echo \"$(jq '.devDependencies.webdriver = $ENV.APPLITOOLS_FRAMEWORK_VERSION' ./package.json)\" > ./package.json"
50
50
  },
51
51
  "dependencies": {
52
- "@applitools/driver": "1.21.4",
53
- "@applitools/utils": "1.8.2",
52
+ "@applitools/driver": "1.22.1",
53
+ "@applitools/utils": "1.9.0",
54
54
  "http-proxy-agent": "5.0.0",
55
55
  "https-proxy-agent": "5.0.1"
56
56
  },
package/types/index.d.ts CHANGED
@@ -13,6 +13,7 @@ export function toElement(element: StaticElement): Element;
13
13
  export function toSelector(selector: import('@applitools/driver').CommonSelector<Selector>): Selector;
14
14
  export function toSimpleCommonSelector(selector: Selector): import('@applitools/driver').CommonSelector;
15
15
  export function executeScript(driver: Driver<unknown>, script: string | ((arg: any) => any), arg: any): Promise<any>;
16
+ export function executeBrowserCommands(driver: Driver<unknown>, commands: Array<import('@applitools/driver').BrowserCommand>, logger?: any): Promise<any>;
16
17
  export function findElement(driver: Driver<unknown>, selector: Selector, parent?: undefined | Element | ShadowRoot): Promise<null | Element>;
17
18
  export function findElements(driver: Driver<unknown>, selector: Selector, parent?: undefined | Element | ShadowRoot): Promise<Array<Element>>;
18
19
  export function getElementRegion(driver: Driver<unknown>, element: Element): Promise<{