Skip to content

Commit

Permalink
Look for actual stdout message indicating ChromeDriver started
Browse files Browse the repository at this point in the history
  • Loading branch information
todbachman-wf committed Oct 30, 2023
1 parent 2e54440 commit d422eec
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/chromedriver_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Future<void> startChromeDriver() async {
}
});

// On windows this takes a while to boot up, wait for the first line
// of stdout as a signal that it is ready.
// On windows this takes a while to boot up, wait for a message on stdout
// indicating ChromeDriver started successfully.
final stdOutLines = chromeDriver.stdout
.transform(utf8.decoder)
.transform(LineSplitter())
Expand All @@ -33,7 +33,8 @@ Future<void> startChromeDriver() async {
stdOutLines.listen((line) => print('ChromeDriver stdout: $line'));
stdErrLines.listen((line) => print('ChromeDriver stderr: $line'));

await stdOutLines.first;
await stdOutLines.firstWhere(
(line) => line.contains('ChromeDriver was started successfully'));
} catch (e) {
throw StateError(
'Could not start ChromeDriver. Is it installed?\nError: $e');
Expand Down

0 comments on commit d422eec

Please sign in to comment.