google / google/webdriver.dart

HttpException: Connection closed before full header was received

Open
#298 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
142
Forks
49
Avg merge
4h 22m
Merged PRs (30d)
4

Description

firefox: 117.0
geckodriver: 0.34.0
OS: fedora 38

```dart
final proc = await Process.start(
'geckodriver',
['--port=4445'],
);
final lines = proc.stdout.transform(utf8.decoder).transform(LineSplitter());
await for (final line in lines) {
if (line.contains('127.0.0.1:4445')) {
break;
}
}
final opts = Map.of(drv.Capabilities.firefox);
final driver = await drv.createDriver(
uri: Uri.parse('http://localhost:4445/'),
desired: opts,
spec: drv.WebDriverSpec.W3c,
);
```
error happened:
```
Unhandled exception:
HttpException: Connection closed before full header was received, uri = http://localhost:4445/session
```
but when I changed `await for` as follow, everything is OK, have no idea why:
```dart
final c = Completer();
lines.listen((line) {
if (line.contains('127.0.0.1:4445')) {
c.complete();
}
});

if (!c.isCompleted) {
await c.future;
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.