Skip to content

Commit 5065769

Browse files
committed
find unused port for chromedriver
1 parent af6b643 commit 5065769

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

dwds/chromedriver.exe

8.3 MB
Binary file not shown.

dwds/test/fixtures/context.dart

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,11 @@ class TestContext {
7474
enableDebugExtension ??= false;
7575
autoRun ??= true;
7676
enableDebugging ??= true;
77-
port = await findUnusedPort();
77+
var chromeDriverPort = await findUnusedPort();
78+
var chromeDriverUrlBase = 'wd/hub';
7879
try {
79-
chromeDriver = await Process.start(
80-
'chromedriver$_exeExt', ['--port=4444', '--url-base=wd/hub']);
80+
chromeDriver = await Process.start('chromedriver$_exeExt',
81+
['--port=$chromeDriverPort', '--url-base=$chromeDriverUrlBase']);
8182
// On windows this takes a while to boot up, wait for the first line
8283
// of stdout as a signal that it is ready.
8384
await chromeDriver.stdout
@@ -120,10 +121,14 @@ class TestContext {
120121
]
121122
}
122123
});
123-
webDriver =
124-
await createDriver(spec: WebDriverSpec.JsonWire, desired: capabilities);
124+
webDriver = await createDriver(
125+
spec: WebDriverSpec.JsonWire,
126+
desired: capabilities,
127+
uri: Uri.parse(
128+
'http://127.0.0.1:$chromeDriverPort/$chromeDriverUrlBase/'));
125129
var connection = ChromeConnection('localhost', debugPort);
126130

131+
port = await findUnusedPort();
127132
testServer = await TestServer.start(
128133
port,
129134
daemonPort(workingDirectory),

0 commit comments

Comments
 (0)