Skip to content

Commit

Permalink
feat: Log the contents of the driver cache on failure to run the driver
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyparrish committed Feb 3, 2022
1 parent 97e8f2e commit 0c2f1e3
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,23 @@ const LocalWebDriverBase = function(
originalStart.call(this, url);
};

const originalOnProcessExit = this._onProcessExit;
this._onProcessExit = (code, signal, errorOutput) => {
originalOnProcessExit.call(this, code, signal, errorOutput);

if (code == -1 && errorOutput.includes('Can not find')) {
// Failed to find the driver. Is it in the cache? Debug to help the
// user find out what's wrong.
try {
const contents = fs.readdirSync(DRIVER_CACHE);
log.error(
`Failed to find driver for ${this.browserName}`);
log.error(
`${DRIVER_CACHE} contains:`, JSON.stringify(contents, null, ' '));
} catch (error) {}
}
};

this.restart = async () => {
if (this.state == 'BEING_FORCE_KILLED') {
return;
Expand Down

0 comments on commit 0c2f1e3

Please sign in to comment.