From ed2d7f5dd467b440ebf78d1aad62a33a42d29b3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Pupier?= Date: Thu, 22 Feb 2024 08:54:52 +0100 Subject: [PATCH] launch webdriver server in a separate process to try to gather more traces and be closer to example on Electron wiki --- src/browser.ts | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/browser.ts b/src/browser.ts index 85e580d1e..544d71793 100644 --- a/src/browser.ts +++ b/src/browser.ts @@ -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'; @@ -92,9 +93,24 @@ export class VSBrowser { chromeDriverBinaryPath = path.join(this.storagePath, `chromedriver-${DriverUtil.getChromeDriverPlatform()}`, driverBinary); } + const driverProcess = spawn(chromeDriverBinaryPath); + + 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();