Skip to content

Commit

Permalink
chore: leave log message if no browser info was found (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
KazuCocoa committed Apr 26, 2024
1 parent 61e8131 commit 3123820
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions lib/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,21 @@ export class WebOSDriver extends BaseDriver {
}


/**
* @typedef BrowserVersionInfo
* @property {string} Browser
* @property {string} Protocol-Version
* @property {string} User-Agent
* @property {string} V8-Version
* @property {string} WebKit-Version
* @property {string} webSocketDebuggerUrl
*/

/**
* Use UserAgent info for "Browser" if the chrome response did not include
* browser name properly.
* @param {object} browserVersionInfo
* @param {BrowserVersionInfo} browserVersionInfo
* @return {BrowserVersionInfo}
*/
useUAForBrowserIfNotPresent(browserVersionInfo) {
if (!_.isEmpty(browserVersionInfo.Browser)) {
Expand All @@ -222,6 +233,7 @@ export class WebOSDriver extends BaseDriver {
}

log.info(`The response did not have Browser, thus set the Browser value from UA as ${JSON.stringify(browserVersionInfo)}`);
// @ts-ignore isEmpty already checked as null.
browserVersionInfo.Browser = chromeVersion[0];
return browserVersionInfo;
}
Expand Down Expand Up @@ -258,9 +270,13 @@ export class WebOSDriver extends BaseDriver {

// To respect the executableDir.
executable = undefined;

if (_.isEmpty(result.Browser)) {
this.log.info(`No browser version info was available. If no proper chromedrivers exist in ${executableDir}, the session creation will fail.`);
}
} catch (err) {
throw new errors.SessionNotCreatedError(
`Could not get the chrome browser information to detect proper chromedriver version. Is it a debiggable build? Error: ${err.message}`
`Could not get the chrome browser information to detect proper chromedriver version. Is it a debuggable build? Error: ${err.message}`
);
}
}
Expand Down

0 comments on commit 3123820

Please sign in to comment.