appium-geckodriver 2.3.0 → 3.0.0
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 +16 -0
- package/build/lib/commands/find.d.ts +1 -1
- package/build/lib/commands/find.d.ts.map +1 -1
- package/build/lib/commands/find.js +3 -6
- package/build/lib/commands/find.js.map +1 -1
- package/build/lib/constants.js +2 -5
- package/build/lib/constants.js.map +1 -1
- package/build/lib/desired-caps.js +3 -6
- package/build/lib/desired-caps.js.map +1 -1
- package/build/lib/doctor/optional-checks.js +18 -22
- package/build/lib/doctor/optional-checks.js.map +1 -1
- package/build/lib/doctor/required-checks.js +8 -12
- package/build/lib/doctor/required-checks.js.map +1 -1
- package/build/lib/doctor/utils.js +4 -7
- package/build/lib/doctor/utils.js.map +1 -1
- package/build/lib/driver.d.ts +4 -4
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +18 -55
- package/build/lib/driver.js.map +1 -1
- package/build/lib/gecko.d.ts +1 -1
- package/build/lib/gecko.d.ts.map +1 -1
- package/build/lib/gecko.js +26 -34
- package/build/lib/gecko.js.map +1 -1
- package/build/lib/index.d.ts +1 -1
- package/build/lib/index.d.ts.map +1 -1
- package/build/lib/index.js +3 -6
- package/build/lib/index.js.map +1 -1
- package/build/lib/logger.js +3 -6
- package/build/lib/logger.js.map +1 -1
- package/build/lib/method-map.js +1 -4
- package/build/lib/method-map.js.map +1 -1
- package/build/lib/utils.js +20 -30
- package/build/lib/utils.js.map +1 -1
- package/lib/commands/find.ts +2 -2
- package/lib/desired-caps.ts +1 -1
- package/lib/doctor/required-checks.ts +1 -1
- package/lib/driver.ts +7 -7
- package/lib/gecko.ts +3 -3
- package/lib/index.ts +1 -1
- package/lib/logger.ts +1 -1
- package/lib/method-map.ts +1 -1
- package/lib/utils.ts +2 -2
- package/npm-shrinkwrap.json +12 -9
- package/package.json +12 -10
- package/scripts/install-geckodriver.mjs +382 -216
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
## [3.0.0](https://github.com/appium/appium-geckodriver/compare/v2.4.0...v3.0.0) (2026-06-10)
|
|
2
|
+
|
|
3
|
+
### ⚠ BREAKING CHANGES
|
|
4
|
+
|
|
5
|
+
* Migrate the package to native ESM ("type": "module", exports map, NodeNext TypeScript output, .js import extensions, appium/driver.js / appium/support.js subpath imports). Consumers using require() against deep/internal paths will need to switch to ESM import or use the published exports entry point.
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* Migrate package to ESM ([#165](https://github.com/appium/appium-geckodriver/issues/165)) ([47e77ed](https://github.com/appium/appium-geckodriver/commit/47e77ed964b07863d9eb0ccf24b16ed32c7a7d37))
|
|
10
|
+
|
|
11
|
+
## [2.4.0](https://github.com/appium/appium-geckodriver/compare/v2.3.0...v2.4.0) (2026-06-10)
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* improve geckodriver install script CLI and destination resolution ([#166](https://github.com/appium/appium-geckodriver/issues/166)) ([52c4c3c](https://github.com/appium/appium-geckodriver/commit/52c4c3ce048993b20d07935fca5030eeec6e3cb5))
|
|
16
|
+
|
|
1
17
|
## [2.3.0](https://github.com/appium/appium-geckodriver/compare/v2.2.6...v2.3.0) (2026-06-10)
|
|
2
18
|
|
|
3
19
|
### Features
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GeckoDriver } from '../driver';
|
|
1
|
+
import type { GeckoDriver } from '../driver.js';
|
|
2
2
|
/**
|
|
3
3
|
* Find element(s) by given strategy and selector. If context is provided, search will be performed within the context element.
|
|
4
4
|
* This is needed to make lookup by image working.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../lib/commands/find.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../lib/commands/find.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,cAAc,CAAC;AAE9C;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,OAAO,EACb,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,GAAG,CAAC,CAMd"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.findElOrEls = findElOrEls;
|
|
4
|
-
const support_1 = require("appium/support");
|
|
1
|
+
import { util } from 'appium/support.js';
|
|
5
2
|
/**
|
|
6
3
|
* Find element(s) by given strategy and selector. If context is provided, search will be performed within the context element.
|
|
7
4
|
* This is needed to make lookup by image working.
|
|
@@ -12,8 +9,8 @@ const support_1 = require("appium/support");
|
|
|
12
9
|
* @param context - Optional context element ID to search within
|
|
13
10
|
* @returns A promise that resolves to the found element(s)
|
|
14
11
|
*/
|
|
15
|
-
async function findElOrEls(strategy, selector, mult, context) {
|
|
16
|
-
const endpoint = `/element${context ? `/${
|
|
12
|
+
export async function findElOrEls(strategy, selector, mult, context) {
|
|
13
|
+
const endpoint = `/element${context ? `/${util.unwrapElement(context)}/element` : ''}${mult ? 's' : ''}`;
|
|
17
14
|
return await this.gecko.proxy.command(endpoint, 'POST', {
|
|
18
15
|
using: strategy,
|
|
19
16
|
value: selector,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find.js","sourceRoot":"","sources":["../../../lib/commands/find.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"find.js","sourceRoot":"","sources":["../../../lib/commands/find.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,mBAAmB,CAAC;AAGvC;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAE/B,QAAgB,EAChB,QAAgB,EAChB,IAAa,EACb,OAAgB;IAEhB,MAAM,QAAQ,GAAG,WAAW,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IACzG,OAAO,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE;QACtD,KAAK,EAAE,QAAQ;QACf,KAAK,EAAE,QAAQ;KAChB,CAAC,CAAC;AACL,CAAC"}
|
package/build/lib/constants.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.INSECURE_FEAT_CUSTOM_GECKODRIVER_EXECUTABLE = exports.VERBOSITY = void 0;
|
|
4
|
-
exports.VERBOSITY = {
|
|
1
|
+
export const VERBOSITY = {
|
|
5
2
|
DEBUG: 'debug',
|
|
6
3
|
TRACE: 'trace',
|
|
7
4
|
};
|
|
@@ -13,5 +10,5 @@ exports.VERBOSITY = {
|
|
|
13
10
|
* with the automation name prefix (for example
|
|
14
11
|
* `--allow-insecure gecko:custom_geckodriver_executable`).
|
|
15
12
|
*/
|
|
16
|
-
|
|
13
|
+
export const INSECURE_FEAT_CUSTOM_GECKODRIVER_EXECUTABLE = 'custom_geckodriver_executable';
|
|
17
14
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../lib/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../lib/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;CACN,CAAC;AAEX;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,2CAA2C,GAAG,+BAAwC,CAAC"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.desiredCapConstraints = void 0;
|
|
4
|
-
const constants_1 = require("./constants");
|
|
1
|
+
import { VERBOSITY } from './constants.js';
|
|
5
2
|
const DESIRED_CAP_CONSTRAINTS = {
|
|
6
3
|
browserName: {
|
|
7
4
|
isString: true,
|
|
@@ -38,7 +35,7 @@ const DESIRED_CAP_CONSTRAINTS = {
|
|
|
38
35
|
},
|
|
39
36
|
verbosity: {
|
|
40
37
|
isString: true,
|
|
41
|
-
inclusionCaseInsensitive: Object.values(
|
|
38
|
+
inclusionCaseInsensitive: Object.values(VERBOSITY),
|
|
42
39
|
},
|
|
43
40
|
androidStorage: {
|
|
44
41
|
isString: true,
|
|
@@ -48,5 +45,5 @@ const DESIRED_CAP_CONSTRAINTS = {
|
|
|
48
45
|
isObject: true,
|
|
49
46
|
},
|
|
50
47
|
};
|
|
51
|
-
|
|
48
|
+
export const desiredCapConstraints = DESIRED_CAP_CONSTRAINTS;
|
|
52
49
|
//# sourceMappingURL=desired-caps.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"desired-caps.js","sourceRoot":"","sources":["../../lib/desired-caps.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"desired-caps.js","sourceRoot":"","sources":["../../lib/desired-caps.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAEzC,MAAM,uBAAuB,GAAG;IAC9B,WAAW,EAAE;QACX,QAAQ,EAAE,IAAI;KACf;IACD,cAAc,EAAE;QACd,QAAQ,EAAE,IAAI;KACf;IACD,mBAAmB,EAAE;QACnB,SAAS,EAAE,IAAI;KAChB;IACD,gBAAgB,EAAE;QAChB,QAAQ,EAAE,IAAI;KACf;IACD,KAAK,EAAE;QACL,QAAQ,EAAE,IAAI;KACf;IACD,aAAa,EAAE;QACb,SAAS,EAAE,IAAI;KAChB;IACD,QAAQ,EAAE;QACR,QAAQ,EAAE,IAAI;KACf;IACD,uBAAuB,EAAE;QACvB,QAAQ,EAAE,IAAI;KACf;IACD,UAAU,EAAE;QACV,QAAQ,EAAE,IAAI;KACf;IACD,cAAc,EAAE;QACd,QAAQ,EAAE,IAAI;KACf;IACD,qBAAqB,EAAE;QACrB,QAAQ,EAAE,IAAI;KACf;IACD,SAAS,EAAE;QACT,QAAQ,EAAE,IAAI;QACd,wBAAwB,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,CAA0B;KAC5E;IACD,cAAc,EAAE;QACd,QAAQ,EAAE,IAAI;QACd,wBAAwB,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,CAAC;KAChE;IACD,oBAAoB,EAAE;QACpB,QAAQ,EAAE,IAAI;KACf;CAC6B,CAAC;AAEjC,MAAM,CAAC,MAAM,qBAAqB,GAAG,uBAAuB,CAAC"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.androidSdkCheck = exports.AndroidSdkCheck = exports.androidHomeCheck = void 0;
|
|
4
|
-
const support_1 = require("@appium/support");
|
|
5
|
-
const appium_adb_1 = require("appium-adb");
|
|
1
|
+
import { system, fs, doctor } from '@appium/support';
|
|
2
|
+
import { getAndroidBinaryPath, getSdkRootFromEnv } from 'appium-adb';
|
|
6
3
|
const ENVIRONMENT_VARS_TUTORIAL_URL = 'https://github.com/appium/java-client/blob/master/docs/environment.md';
|
|
7
4
|
const ANDROID_SDK_LINK1 = 'https://developer.android.com/studio#cmdline-tools';
|
|
8
5
|
const ANDROID_SDK_LINK2 = 'https://developer.android.com/studio/intro/update#sdk-manager';
|
|
@@ -17,23 +14,23 @@ class EnvVarAndPathCheck {
|
|
|
17
14
|
async diagnose() {
|
|
18
15
|
const varValue = process.env[this.varName];
|
|
19
16
|
if (!varValue) {
|
|
20
|
-
return
|
|
17
|
+
return doctor.nokOptional(`${this.varName} environment variable is NOT set!`);
|
|
21
18
|
}
|
|
22
|
-
if (!(await
|
|
19
|
+
if (!(await fs.exists(varValue))) {
|
|
23
20
|
let errMsg = `${this.varName} is set to '${varValue}' but this path does not exist!`;
|
|
24
|
-
if (
|
|
21
|
+
if (system.isWindows() && varValue.includes('%')) {
|
|
25
22
|
errMsg += ` Consider replacing all references to other environment variables with absolute paths.`;
|
|
26
23
|
}
|
|
27
|
-
return
|
|
24
|
+
return doctor.nokOptional(errMsg);
|
|
28
25
|
}
|
|
29
|
-
const stat = await
|
|
26
|
+
const stat = await fs.stat(varValue);
|
|
30
27
|
if (this.opts.expectDir && !stat.isDirectory()) {
|
|
31
|
-
return
|
|
28
|
+
return doctor.nokOptional(`${this.varName} is expected to be a valid folder, got a file path instead`);
|
|
32
29
|
}
|
|
33
30
|
if (this.opts.expectFile && stat.isDirectory()) {
|
|
34
|
-
return
|
|
31
|
+
return doctor.nokOptional(`${this.varName} is expected to be a valid file, got a folder path instead`);
|
|
35
32
|
}
|
|
36
|
-
return
|
|
33
|
+
return doctor.okOptional(`${this.varName} is set to: ${varValue}`);
|
|
37
34
|
}
|
|
38
35
|
async fix() {
|
|
39
36
|
return (`Make sure the environment variable ${this.varName} is properly configured for the Appium process. ` +
|
|
@@ -47,30 +44,30 @@ class EnvVarAndPathCheck {
|
|
|
47
44
|
return true;
|
|
48
45
|
}
|
|
49
46
|
}
|
|
50
|
-
|
|
51
|
-
class AndroidSdkCheck {
|
|
47
|
+
export const androidHomeCheck = new EnvVarAndPathCheck('ANDROID_HOME', { expectDir: true });
|
|
48
|
+
export class AndroidSdkCheck {
|
|
52
49
|
log;
|
|
53
50
|
TOOL_NAMES = ['adb', 'emulator'];
|
|
54
51
|
async diagnose() {
|
|
55
52
|
const listOfTools = this.TOOL_NAMES.join(', ');
|
|
56
|
-
const sdkRoot =
|
|
53
|
+
const sdkRoot = getSdkRootFromEnv();
|
|
57
54
|
if (!sdkRoot) {
|
|
58
|
-
return
|
|
55
|
+
return doctor.nokOptional(`${listOfTools} could not be found because ANDROID_HOME is NOT set!`);
|
|
59
56
|
}
|
|
60
57
|
this.log.info(` Checking ${listOfTools}`);
|
|
61
58
|
const missingBinaries = [];
|
|
62
59
|
for (const binary of this.TOOL_NAMES) {
|
|
63
60
|
try {
|
|
64
|
-
this.log.info(` '${binary}' exists in ${await
|
|
61
|
+
this.log.info(` '${binary}' exists in ${await getAndroidBinaryPath(binary)}`);
|
|
65
62
|
}
|
|
66
63
|
catch {
|
|
67
64
|
missingBinaries.push(binary);
|
|
68
65
|
}
|
|
69
66
|
}
|
|
70
67
|
if (missingBinaries.length > 0) {
|
|
71
|
-
return
|
|
68
|
+
return doctor.nokOptional(`${missingBinaries.join(', ')} could NOT be found in '${sdkRoot}'!`);
|
|
72
69
|
}
|
|
73
|
-
return
|
|
70
|
+
return doctor.okOptional(`${listOfTools} exist in '${sdkRoot}'`);
|
|
74
71
|
}
|
|
75
72
|
async fix() {
|
|
76
73
|
return (`Manually install Android SDK and set ANDROID_HOME enviornment variable. ` +
|
|
@@ -84,6 +81,5 @@ class AndroidSdkCheck {
|
|
|
84
81
|
return true;
|
|
85
82
|
}
|
|
86
83
|
}
|
|
87
|
-
|
|
88
|
-
exports.androidSdkCheck = new AndroidSdkCheck();
|
|
84
|
+
export const androidSdkCheck = new AndroidSdkCheck();
|
|
89
85
|
//# sourceMappingURL=optional-checks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"optional-checks.js","sourceRoot":"","sources":["../../../lib/doctor/optional-checks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"optional-checks.js","sourceRoot":"","sources":["../../../lib/doctor/optional-checks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,EAAE,EAAE,MAAM,EAAC,MAAM,iBAAiB,CAAC;AACnD,O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AAI,CAAC,SAAS,MAAM,eAAe,MAAM,oBAAoB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YACpF,CAAC;YAAC,MAAM,CAAC;gBACP,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC;QAED,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC/B,OAAO,MAAM,CAAC,WAAW,CACvB,GAAG,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,2BAA2B,OAAO,IAAI,CACpE,CAAC;QACJ,CAAC;QAED,OAAO,MAAM,CAAC,UAAU,CAAC,GAAG,WAAW,cAAc,OAAO,GAAG,CAAC,CAAC;IACnE,CAAC;IAED,KAAK,CAAC,GAAG;QACP,OAAO,CACL,0EAA0E;YAC1E,8EAA8E;YAC9E,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAChE,CAAC;IACJ,CAAC;IAED,UAAU;QACR,OAAO,KAAK,CAAC;IACf,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AACD,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC"}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.geckodriverCheck = exports.GeckodriverCheck = void 0;
|
|
4
|
-
const utils_1 = require("./utils");
|
|
5
|
-
const support_1 = require("@appium/support");
|
|
1
|
+
import { resolveExecutablePath } from './utils.js';
|
|
2
|
+
import { system, doctor } from '@appium/support';
|
|
6
3
|
const GD_DOWNLOAD_LINK = 'https://github.com/mozilla/geckodriver/releases';
|
|
7
|
-
const GD_BINARY = `geckodriver${
|
|
8
|
-
class GeckodriverCheck {
|
|
4
|
+
const GD_BINARY = `geckodriver${system.isWindows() ? '.exe' : ''}`;
|
|
5
|
+
export class GeckodriverCheck {
|
|
9
6
|
log;
|
|
10
7
|
async diagnose() {
|
|
11
|
-
const gdPath = await
|
|
8
|
+
const gdPath = await resolveExecutablePath(GD_BINARY);
|
|
12
9
|
return gdPath
|
|
13
|
-
?
|
|
14
|
-
:
|
|
10
|
+
? doctor.ok(`${GD_BINARY} is installed at: ${gdPath}`)
|
|
11
|
+
: doctor.nok(`${GD_BINARY} cannot be found`);
|
|
15
12
|
}
|
|
16
13
|
async fix() {
|
|
17
14
|
return (`${GD_BINARY} is required to pass W3C commands to the remote browser. ` +
|
|
@@ -26,6 +23,5 @@ class GeckodriverCheck {
|
|
|
26
23
|
return false;
|
|
27
24
|
}
|
|
28
25
|
}
|
|
29
|
-
|
|
30
|
-
exports.geckodriverCheck = new GeckodriverCheck();
|
|
26
|
+
export const geckodriverCheck = new GeckodriverCheck();
|
|
31
27
|
//# sourceMappingURL=required-checks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"required-checks.js","sourceRoot":"","sources":["../../../lib/doctor/required-checks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"required-checks.js","sourceRoot":"","sources":["../../../lib/doctor/required-checks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,qBAAqB,EAAC,MAAM,YAAY,CAAC;AACjD,OAAO,EAAC,MAAM,EAAE,MAAM,EAAC,MAAM,iBAAiB,CAAC;AAG/C,MAAM,gBAAgB,GAAG,iDAAiD,CAAC;AAC3E,MAAM,SAAS,GAAG,cAAc,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AAEnE,MAAM,OAAO,gBAAgB;IAC3B,GAAG,CAAgB;IAEnB,KAAK,CAAC,QAAQ;QACZ,MAAM,MAAM,GAAG,MAAM,qBAAqB,CAAC,SAAS,CAAC,CAAC;QACtD,OAAO,MAAM;YACX,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,SAAS,qBAAqB,MAAM,EAAE,CAAC;YACtD,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,kBAAkB,CAAC,CAAC;IACjD,CAAC;IAED,KAAK,CAAC,GAAG;QACP,OAAO,CACL,GAAG,SAAS,2DAA2D;YACvE,mCAAmC,gBAAgB,gBAAgB;YACnE,sEAAsE;YACtE,kCAAkC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,CACrD,CAAC;IACJ,CAAC;IAED,UAAU;QACR,OAAO,KAAK,CAAC;IACf,CAAC;IAED,UAAU;QACR,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AACD,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,gBAAgB,EAAE,CAAC"}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveExecutablePath = resolveExecutablePath;
|
|
4
|
-
const support_1 = require("@appium/support");
|
|
1
|
+
import { fs } from '@appium/support';
|
|
5
2
|
/**
|
|
6
3
|
* Return an executable path of cmd. Returns `null` if the cmd is not found.
|
|
7
4
|
*/
|
|
8
|
-
async function resolveExecutablePath(cmd) {
|
|
5
|
+
export async function resolveExecutablePath(cmd) {
|
|
9
6
|
try {
|
|
10
|
-
const executablePath = await
|
|
11
|
-
if (executablePath && (await
|
|
7
|
+
const executablePath = await fs.which(cmd);
|
|
8
|
+
if (executablePath && (await fs.exists(executablePath))) {
|
|
12
9
|
return executablePath;
|
|
13
10
|
}
|
|
14
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../lib/doctor/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../lib/doctor/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,EAAE,EAAC,MAAM,iBAAiB,CAAC;AAEnC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,GAAW;IACrD,IAAI,CAAC;QACH,MAAM,cAAc,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC3C,IAAI,cAAc,IAAI,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC;YACxD,OAAO,cAAc,CAAC;QACxB,CAAC;IACH,CAAC;IAAC,MAAM,CAAC,CAAA,CAAC;IACV,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/build/lib/driver.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { RouteMatcher, DefaultCreateSessionResult, InitialOpts, StringRecord, ExternalDriver, W3CDriverCaps } from '@appium/types';
|
|
2
|
-
import { BaseDriver } from 'appium/driver';
|
|
3
|
-
import { GeckoDriverServer } from './gecko';
|
|
4
|
-
import { desiredCapConstraints } from './desired-caps';
|
|
5
|
-
import * as findCommands from './commands/find';
|
|
2
|
+
import { BaseDriver } from 'appium/driver.js';
|
|
3
|
+
import { GeckoDriverServer } from './gecko.js';
|
|
4
|
+
import { desiredCapConstraints } from './desired-caps.js';
|
|
5
|
+
import * as findCommands from './commands/find.js';
|
|
6
6
|
export type GeckoConstraints = typeof desiredCapConstraints;
|
|
7
7
|
export declare class GeckoDriver extends BaseDriver<GeckoConstraints, StringRecord> implements ExternalDriver<GeckoConstraints, string, StringRecord> {
|
|
8
8
|
static newMethodMap: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../../lib/driver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,0BAA0B,EAC1B,WAAW,EACX,YAAY,EACZ,cAAc,EACd,aAAa,EACd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,UAAU,EAAS,MAAM,
|
|
1
|
+
{"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../../lib/driver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,0BAA0B,EAC1B,W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C;IAQ7C,OAAO,CAAC,UAAU;IAOlB,OAAO,CAAC,oBAAoB;CAgB7B;AAED,eAAe,WAAW,CAAC"}
|
package/build/lib/driver.js
CHANGED
|
@@ -1,54 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.GeckoDriver = void 0;
|
|
37
|
-
const driver_1 = require("appium/driver");
|
|
38
|
-
const gecko_1 = require("./gecko");
|
|
39
|
-
const desired_caps_1 = require("./desired-caps");
|
|
40
|
-
const method_map_1 = require("./method-map");
|
|
41
|
-
const constants_1 = require("./constants");
|
|
42
|
-
const findCommands = __importStar(require("./commands/find"));
|
|
43
|
-
const utils_1 = require("./utils");
|
|
1
|
+
import { BaseDriver, errors } from 'appium/driver.js';
|
|
2
|
+
import { GECKO_SERVER_HOST, GeckoDriverServer } from './gecko.js';
|
|
3
|
+
import { desiredCapConstraints } from './desired-caps.js';
|
|
4
|
+
import { newMethodMap } from './method-map.js';
|
|
5
|
+
import { INSECURE_FEAT_CUSTOM_GECKODRIVER_EXECUTABLE } from './constants.js';
|
|
6
|
+
import * as findCommands from './commands/find.js';
|
|
7
|
+
import { formatCapsForServer } from './utils.js';
|
|
44
8
|
const NO_PROXY = [
|
|
45
9
|
['GET', new RegExp('^/session/[^/]+/appium')],
|
|
46
10
|
['POST', new RegExp('^/session/[^/]+/appium')],
|
|
47
11
|
['POST', new RegExp('^/session/[^/]+/element/[^/]+/elements?$')],
|
|
48
12
|
['POST', new RegExp('^/session/[^/]+/elements?$')],
|
|
49
13
|
];
|
|
50
|
-
class GeckoDriver extends
|
|
51
|
-
static newMethodMap =
|
|
14
|
+
export class GeckoDriver extends BaseDriver {
|
|
15
|
+
static newMethodMap = newMethodMap;
|
|
52
16
|
proxyReqRes = null;
|
|
53
17
|
findElOrEls = findCommands.findElOrEls;
|
|
54
18
|
isProxyActive = false;
|
|
@@ -56,7 +20,7 @@ class GeckoDriver extends driver_1.BaseDriver {
|
|
|
56
20
|
_bidiProxyUrl = null;
|
|
57
21
|
constructor(opts = {}) {
|
|
58
22
|
super(opts);
|
|
59
|
-
this.desiredCapConstraints = structuredClone(
|
|
23
|
+
this.desiredCapConstraints = structuredClone(desiredCapConstraints);
|
|
60
24
|
this.locatorStrategies = [
|
|
61
25
|
'xpath',
|
|
62
26
|
'tag name',
|
|
@@ -94,19 +58,19 @@ class GeckoDriver extends driver_1.BaseDriver {
|
|
|
94
58
|
return false;
|
|
95
59
|
}
|
|
96
60
|
if (caps.geckodriverExecutable &&
|
|
97
|
-
!this.isFeatureEnabled(
|
|
98
|
-
throw new
|
|
99
|
-
`'${
|
|
61
|
+
!this.isFeatureEnabled(INSECURE_FEAT_CUSTOM_GECKODRIVER_EXECUTABLE)) {
|
|
62
|
+
throw new errors.SessionNotCreatedError(`The 'geckodriverExecutable' capability requires the ` +
|
|
63
|
+
`'${INSECURE_FEAT_CUSTOM_GECKODRIVER_EXECUTABLE}' insecure feature to be enabled ` +
|
|
100
64
|
`on the Appium server.`);
|
|
101
65
|
}
|
|
102
66
|
return true;
|
|
103
67
|
}
|
|
104
68
|
async createSession(w3cCaps1, w3cCaps2, ...args) {
|
|
105
69
|
const [sessionId, processedCaps] = await super.createSession(w3cCaps1, w3cCaps2, ...args);
|
|
106
|
-
this._gecko = new
|
|
70
|
+
this._gecko = new GeckoDriverServer(this.log, processedCaps);
|
|
107
71
|
let response;
|
|
108
72
|
try {
|
|
109
|
-
response = await this._gecko.start(
|
|
73
|
+
response = await this._gecko.start(formatCapsForServer(processedCaps), {
|
|
110
74
|
reqBasePath: this.basePath,
|
|
111
75
|
});
|
|
112
76
|
}
|
|
@@ -141,8 +105,8 @@ class GeckoDriver extends driver_1.BaseDriver {
|
|
|
141
105
|
}
|
|
142
106
|
try {
|
|
143
107
|
const asUrl = new URL(webSocketUrl);
|
|
144
|
-
return asUrl.hostname !==
|
|
145
|
-
? webSocketUrl.replace(asUrl.host,
|
|
108
|
+
return asUrl.hostname !== GECKO_SERVER_HOST
|
|
109
|
+
? webSocketUrl.replace(asUrl.host, GECKO_SERVER_HOST)
|
|
146
110
|
: webSocketUrl;
|
|
147
111
|
}
|
|
148
112
|
catch (e) {
|
|
@@ -152,6 +116,5 @@ class GeckoDriver extends driver_1.BaseDriver {
|
|
|
152
116
|
}
|
|
153
117
|
}
|
|
154
118
|
}
|
|
155
|
-
|
|
156
|
-
exports.default = GeckoDriver;
|
|
119
|
+
export default GeckoDriver;
|
|
157
120
|
//# sourceMappingURL=driver.js.map
|
package/build/lib/driver.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"driver.js","sourceRoot":"","sources":["../../lib/driver.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"driver.js","sourceRoot":"","sources":["../../lib/driver.ts"],"names":[],"mappings":"AAQA,OAAO,EAAC,UAAU,EAAE,MAAM,EAAC,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAC,iBAAiB,EAAE,iBAAiB,EAAC,MAAM,YAAY,CAAC;AAChE,OAAO,EAAC,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAC,2CAA2C,EAAC,MAAM,gBAAgB,CAAC;AAC3E,OAAO,KAAK,YAAY,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAC,mBAAmB,EAAC,MAAM,YAAY,CAAC;AAE/C,MAAM,QAAQ,GAAmB;IAC/B,CAAC,KAAK,EAAE,IAAI,MAAM,CAAC,wBAAwB,CAAC,CAAC;IAC7C,CAAC,MAAM,EAAE,IAAI,MAAM,CAAC,wBAAwB,CAAC,CAAC;IAC9C,CAAC,MAAM,EAAE,IAAI,MAAM,CAAC,0CAA0C,CAAC,CAAC;IAChE,CAAC,MAAM,EAAE,IAAI,MAAM,CAAC,4BAA4B,CAAC,CAAC;CACnD,CAAC;AAIF,MAAM,OAAO,WACX,SAAQ,UAA0C;IAGlD,MAAM,CAAC,YAAY,GAAG,YAAY,CAAC;IAE5B,WAAW,GAA0B,IAAW,CAAC;IAExD,WAAW,GAAG,YAAY,CAAC,WAAW,CAAC;IAE/B,aAAa,GAAY,KAAK,CAAC;IAC/B,MAAM,GAA6B,IAAI,CAAC;IACxC,aAAa,GAAkB,IAAI,CAAC;IAE5C,YAAY,OAAoB,EAAiB;QAC/C,KAAK,CAAC,IAAI,CAAC,CAAC;QACZ,IAAI,CAAC,qBAAqB,GAAG,eAAe,CAAC,qBAAqB,CAAC,CAAC;QACpE,IAAI,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B,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;IAC5B,CAAC;IAEO,oBAAoB,CAAC,QAAsB;QACjD,MAAM,YAAY,GAAI,QAAQ,EAAE,YAAoB,EAAE,YAAY,CAAC;QACnE,IAAI,OAAO,YAAY,KAAK,QAAQ,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAClE,OAAO,IAAI,CAAC;QACd,CAAC;QACD,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,YAAY,CAAC,CAAC;YACpC,OAAO,KAAK,CAAC,QAAQ,KAAK,iBAAiB;gBACzC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,iBAAiB,CAAC;gBACrD,CAAC,CAAC,YAAY,CAAC;QACnB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,GAAG,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YACvD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,uCAAuC,YAAY,MAAM,GAAG,EAAE,CAAC,CAAC;YAC9E,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;;AAGH,eAAe,WAAW,CAAC"}
|
package/build/lib/gecko.d.ts
CHANGED
package/build/lib/gecko.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gecko.d.ts","sourceRoot":"","sources":["../../lib/gecko.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,OAAO,EAAS,MAAM,
|
|
1
|
+
{"version":3,"file":"gecko.d.ts","sourceRoot":"","sources":["../../lib/gecko.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,OAAO,EAAS,MAAM,kBAAkB,CAAC;AAMjD,OAAO,KAAK,EAAC,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAC,MAAM,eAAe,CAAC;AAWpF,eAAO,MAAM,iBAAiB,cAAc,CAAC;AAE7C,MAAM,WAAW,cAAc;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAwID,qBAAa,UAAW,SAAQ,OAAO;IACrC,cAAc,CAAC,EAAE,OAAO,CAAC;IAEV,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,GAAE,QAAe;CASnF;AA2BD,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAA2B;IACzC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqB;IAC9C,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;gBAEvB,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,YAAY;IAMjD,IAAI,KAAK,IAAI,UAAU,CAKtB;IAED,IAAI,SAAS,IAAI,OAAO,CAEvB;IAEK,KAAK,CAAC,SAAS,EAAE,YAAY,EAAE,IAAI,GAAE,cAAmB,GAAG,OAAO,CAAC,YAAY,CAAC;IAmEhF,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAqB5B;AAED,eAAe,iBAAiB,CAAC"}
|
package/build/lib/gecko.js
CHANGED
|
@@ -1,24 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
const teen_process_1 = require("teen_process");
|
|
12
|
-
const asyncbox_1 = require("asyncbox");
|
|
13
|
-
const portscanner_1 = require("portscanner");
|
|
14
|
-
const node_child_process_1 = require("node:child_process");
|
|
15
|
-
const constants_1 = require("./constants");
|
|
16
|
-
const GD_BINARY = `geckodriver${support_1.system.isWindows() ? '.exe' : ''}`;
|
|
1
|
+
import os from 'node:os';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { JWProxy, errors } from 'appium/driver.js';
|
|
4
|
+
import { fs, util, system } from 'appium/support.js';
|
|
5
|
+
import { SubProcess } from 'teen_process';
|
|
6
|
+
import { waitForCondition } from 'asyncbox';
|
|
7
|
+
import { findAPortNotInUse } from 'portscanner';
|
|
8
|
+
import { execSync } from 'node:child_process';
|
|
9
|
+
import { VERBOSITY } from './constants.js';
|
|
10
|
+
const GD_BINARY = `geckodriver${system.isWindows() ? '.exe' : ''}`;
|
|
17
11
|
const STARTUP_TIMEOUT_MS = 10000; // 10 seconds
|
|
18
12
|
const GECKO_PORT_RANGE = [5200, 5300];
|
|
19
|
-
const GECKO_SERVER_GUARD =
|
|
13
|
+
const GECKO_SERVER_GUARD = util.getLockFileGuard(path.resolve(os.tmpdir(), 'gecko_server_guard.lock'), { timeout: 5, tryRecovery: true });
|
|
20
14
|
const DEFAULT_MARIONETTE_PORT = 2828;
|
|
21
|
-
|
|
15
|
+
export const GECKO_SERVER_HOST = '127.0.0.1';
|
|
22
16
|
class GeckoDriverProcess {
|
|
23
17
|
noReset;
|
|
24
18
|
verbosity;
|
|
@@ -54,7 +48,7 @@ class GeckoDriverProcess {
|
|
|
54
48
|
await GECKO_SERVER_GUARD(async () => {
|
|
55
49
|
const [startPort, endPort] = GECKO_PORT_RANGE;
|
|
56
50
|
try {
|
|
57
|
-
this._port = await
|
|
51
|
+
this._port = await findAPortNotInUse(startPort, endPort);
|
|
58
52
|
}
|
|
59
53
|
catch {
|
|
60
54
|
throw new Error(`Cannot find any free port in range ${startPort}..${endPort}. ` +
|
|
@@ -67,10 +61,10 @@ class GeckoDriverProcess {
|
|
|
67
61
|
const args = [];
|
|
68
62
|
/* #region Options */
|
|
69
63
|
switch (this.verbosity?.toLowerCase()) {
|
|
70
|
-
case
|
|
64
|
+
case VERBOSITY.DEBUG:
|
|
71
65
|
args.push('-v');
|
|
72
66
|
break;
|
|
73
|
-
case
|
|
67
|
+
case VERBOSITY.TRACE:
|
|
74
68
|
args.push('-vv');
|
|
75
69
|
break;
|
|
76
70
|
}
|
|
@@ -91,7 +85,7 @@ class GeckoDriverProcess {
|
|
|
91
85
|
if (this.androidStorage) {
|
|
92
86
|
args.push('--android-storage', this.androidStorage);
|
|
93
87
|
}
|
|
94
|
-
this._proc = new
|
|
88
|
+
this._proc = new SubProcess(driverBin, args);
|
|
95
89
|
this._proc.on('output', (stdout, stderr) => {
|
|
96
90
|
const line = (stdout || stderr).trim();
|
|
97
91
|
if (line) {
|
|
@@ -119,14 +113,14 @@ class GeckoDriverProcess {
|
|
|
119
113
|
}
|
|
120
114
|
async resolveGeckodriverBinary() {
|
|
121
115
|
if (this.geckodriverExecutable) {
|
|
122
|
-
if (!(await
|
|
116
|
+
if (!(await fs.exists(this.geckodriverExecutable))) {
|
|
123
117
|
throw new Error(`The custom geckodriver binary at '${this.geckodriverExecutable}' cannot be found. ` +
|
|
124
118
|
`Make sure the path is correct and accessible to the Appium server process`);
|
|
125
119
|
}
|
|
126
120
|
return this.geckodriverExecutable;
|
|
127
121
|
}
|
|
128
122
|
try {
|
|
129
|
-
return await
|
|
123
|
+
return await fs.which(GD_BINARY);
|
|
130
124
|
}
|
|
131
125
|
catch {
|
|
132
126
|
throw new Error(`${GD_BINARY} binary cannot be found in PATH. ` +
|
|
@@ -134,17 +128,16 @@ class GeckoDriverProcess {
|
|
|
134
128
|
}
|
|
135
129
|
}
|
|
136
130
|
}
|
|
137
|
-
class GeckoProxy extends
|
|
131
|
+
export class GeckoProxy extends JWProxy {
|
|
138
132
|
didProcessExit;
|
|
139
133
|
async proxyCommand(url, method, body = null) {
|
|
140
134
|
if (this.didProcessExit) {
|
|
141
|
-
throw new
|
|
135
|
+
throw new errors.InvalidContextError(`'${method} ${url}' cannot be proxied to Gecko Driver server because ` +
|
|
142
136
|
'its process is not running (probably crashed). Check the Appium log for more details');
|
|
143
137
|
}
|
|
144
138
|
return await super.proxyCommand(url, method, body);
|
|
145
139
|
}
|
|
146
140
|
}
|
|
147
|
-
exports.GeckoProxy = GeckoProxy;
|
|
148
141
|
const RUNNING_PROCESS_IDS = [];
|
|
149
142
|
const removeRunningProcessId = (pid) => {
|
|
150
143
|
let idx = RUNNING_PROCESS_IDS.indexOf(pid);
|
|
@@ -157,18 +150,18 @@ process.once('exit', () => {
|
|
|
157
150
|
if (RUNNING_PROCESS_IDS.length === 0) {
|
|
158
151
|
return;
|
|
159
152
|
}
|
|
160
|
-
const command =
|
|
153
|
+
const command = system.isWindows()
|
|
161
154
|
? 'taskkill.exe ' +
|
|
162
155
|
RUNNING_PROCESS_IDS.filter((pid) => pid !== undefined)
|
|
163
156
|
.map((pid) => `/PID ${pid}`)
|
|
164
157
|
.join(' ')
|
|
165
158
|
: `kill ${RUNNING_PROCESS_IDS.filter((pid) => pid !== undefined).join(' ')}`;
|
|
166
159
|
try {
|
|
167
|
-
|
|
160
|
+
execSync(command);
|
|
168
161
|
}
|
|
169
162
|
catch { }
|
|
170
163
|
});
|
|
171
|
-
class GeckoDriverServer {
|
|
164
|
+
export class GeckoDriverServer {
|
|
172
165
|
_proxy = null;
|
|
173
166
|
_process;
|
|
174
167
|
log;
|
|
@@ -189,7 +182,7 @@ class GeckoDriverServer {
|
|
|
189
182
|
async start(geckoCaps, opts = {}) {
|
|
190
183
|
await this._process.init();
|
|
191
184
|
const proxyOpts = {
|
|
192
|
-
server:
|
|
185
|
+
server: GECKO_SERVER_HOST,
|
|
193
186
|
port: this._process.port,
|
|
194
187
|
log: this.log,
|
|
195
188
|
base: '',
|
|
@@ -206,7 +199,7 @@ class GeckoDriverServer {
|
|
|
206
199
|
}
|
|
207
200
|
});
|
|
208
201
|
try {
|
|
209
|
-
await
|
|
202
|
+
await waitForCondition(async () => {
|
|
210
203
|
try {
|
|
211
204
|
await this._proxy?.command('/status', 'GET');
|
|
212
205
|
return true;
|
|
@@ -267,6 +260,5 @@ class GeckoDriverServer {
|
|
|
267
260
|
}
|
|
268
261
|
}
|
|
269
262
|
}
|
|
270
|
-
|
|
271
|
-
exports.default = GeckoDriverServer;
|
|
263
|
+
export default GeckoDriverServer;
|
|
272
264
|
//# sourceMappingURL=gecko.js.map
|