Skip to content

Commit

Permalink
launch webdriver server in a separate process to try to gather more
Browse files Browse the repository at this point in the history
traces and be closer to example on Electron wiki
  • Loading branch information
apupier committed Feb 22, 2024
1 parent 1deccdb commit 154eee1
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import * as path from 'path';
import * as fs from 'fs-extra';
import { compareVersions } from 'compare-versions';
import { WebDriver, Builder, until, initPageObjects, logging, By, Browser } from 'monaco-page-objects';
import { Options, ServiceBuilder } from 'selenium-webdriver/chrome';
import { Options } from 'selenium-webdriver/chrome';
import { getLocatorsPath } from 'vscode-extension-tester-locators';
import { CodeUtil, ReleaseQuality } from './util/codeUtil';
import { DEFAULT_STORAGE_FOLDER } from './extester';
import { DriverUtil } from './util/driverUtil';
import { spawn } from 'child_process';

export class VSBrowser {
static readonly baseVersion = '1.37.0';
Expand Down Expand Up @@ -92,9 +93,24 @@ export class VSBrowser {
chromeDriverBinaryPath = path.join(this.storagePath, `chromedriver-${DriverUtil.getChromeDriverPlatform()}`, driverBinary);
}

const driverProcess = spawn(chromeDriverBinaryPath, ['--verbose']);

driverProcess.stdout.on('data', (data) => {
console.log(`stdout: ${data}`);
});

driverProcess.stderr.on('data', (data) => {
console.error(`stderr: ${data}`);
});

driverProcess.on('close', (code) => {
console.log(`child process exited with code ${code}`);
});

console.log('Launching browser...');
this._driver = await new Builder()
.setChromeService(new ServiceBuilder(chromeDriverBinaryPath))
//.setChromeService(new ServiceBuilder(chromeDriverBinaryPath))
.usingServer('http://localhost:9515')
.forBrowser(Browser.CHROME)
.setChromeOptions(options)
.build();
Expand Down

0 comments on commit 154eee1

Please sign in to comment.