From ed2680095eb1dcc5f9e624194193892182126976 Mon Sep 17 00:00:00 2001 From: Mykola Mokhnach Date: Fri, 24 Jan 2025 09:10:04 +0100 Subject: [PATCH] avoid hardcode --- lib/chromedriver.js | 4 ++-- lib/protocol-helpers.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/chromedriver.js b/lib/chromedriver.js index 198e623..4e7de5c 100644 --- a/lib/chromedriver.js +++ b/lib/chromedriver.js @@ -17,7 +17,7 @@ import _ from 'lodash'; import path from 'path'; import {compareVersions} from 'compare-versions'; import { ChromedriverStorageClient } from './storage-client/storage-client'; -import {toW3cCapNames, getCapValue} from './protocol-helpers'; +import {toW3cCapNames, getCapValue, toW3cCapName} from './protocol-helpers'; const NEW_CD_VERSION_FORMAT_MAJOR_VERSION = 73; const DEFAULT_HOST = '127.0.0.1'; @@ -554,7 +554,7 @@ export class Chromedriver extends events.EventEmitter { if (_.isPlainObject(chromeOptions)) { chromeOptions.w3c = true; } else { - this.capabilities['goog:chromeOptions'] = {w3c: true}; + this.capabilities[toW3cCapName('chromeOptions')] = {w3c: true}; } } diff --git a/lib/protocol-helpers.js b/lib/protocol-helpers.js index 22b6225..4cc0346 100644 --- a/lib/protocol-helpers.js +++ b/lib/protocol-helpers.js @@ -7,7 +7,7 @@ const W3C_PREFIX = 'goog:'; * * @param {string} capName */ -function toW3cCapName (capName) { +export function toW3cCapName (capName) { return (_.isString(capName) && !capName.includes(':') && !isStandardCap(capName)) ? `${W3C_PREFIX}${capName}` : capName;