Skip to content

Commit

Permalink
[JS] Print debug message once for each browser when selenium manager …
Browse files Browse the repository at this point in the history
…used
  • Loading branch information
harsha509 committed Jun 20, 2023
1 parent b9f0938 commit da9a4fb
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions javascript/node/selenium-webdriver/common/seleniumManager.js
Expand Up @@ -32,6 +32,8 @@ const spawnSync = require('child_process').spawnSync
*/
const Browser = ['chrome', 'firefox', 'edge', 'MicrosoftEdge', 'iexplorer']

let debugMessagePrinted = {};

/**
* Determines the path of the correct Selenium Manager binary
* @returns {string}
Expand Down Expand Up @@ -71,9 +73,14 @@ function driverLocation(options) {
)
}

console.debug(
'Applicable driver not found; attempting to install with Selenium Manager (Beta)'
)
const browserName = options.getBrowserName().toLocaleLowerCase();

if (!debugMessagePrinted[browserName]) {
console.debug(
`Applicable driver not found for ${browserName}; attempting to install with Selenium Manager (Beta)`
)
debugMessagePrinted[browserName] = true; // Set the flag to true after printing the debug message
}

let args = ['--browser', options.getBrowserName(), '--output', 'json']

Expand Down

0 comments on commit da9a4fb

Please sign in to comment.