Skip to content

Commit

Permalink
avoid hardcode
Browse files Browse the repository at this point in the history
  • Loading branch information
mykola-mokhnach committed Jan 24, 2025
1 parent 66344d8 commit ed26800
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/chromedriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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};
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/protocol-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ed26800

Please sign in to comment.