UNPKG

appium-chromium-driver

Version:

Appium driver for Chromium-based browsers that work with Chromedriver

44 lines 1.49 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Version = void 0; /** * A version parser for Microsoft Edge browser and MSEdgeDriver. */ class Version { rawVersion; major; // The version format is expected to be like "147.0.3179.73" or "147.0.3179.98". static VERSION_PATTERN = /^(\d+)\.\d+\.\d+\.\d+$/; constructor(rawVersion, /** * The major version number extracted from the raw version string. * Most of cases the major version is sufficient to determine * the compatible MSEdgeDriver version, so we extract it for convenience. */ major) { this.rawVersion = rawVersion; this.major = major; } /** * Parse a version string into a Version instance. * @param version The version string (e.g., "147.0.3179.73" or "147.0.3179.98"). * @returns A Version instance. * @throws Error if the version string is invalid. */ static from(version) { const match = this.VERSION_PATTERN.exec(version); if (!match) { throw new Error(`Invalid version format: '${version}'. Please report it to the Appium team as it might be a new version format.`); } return new Version(version, match[1]); } /** * Return the original version string. * @returns The original version string. */ toString() { return this.rawVersion; } } exports.Version = Version; //# sourceMappingURL=version.js.map