diff --git a/packages/flutter_driver/lib/src/driver/driver.dart b/packages/flutter_driver/lib/src/driver/driver.dart index da078547491..dd06986b601 100644 --- a/packages/flutter_driver/lib/src/driver/driver.dart +++ b/packages/flutter_driver/lib/src/driver/driver.dart @@ -937,8 +937,14 @@ void restoreVmServiceConnectFunction() { /// the [VMServiceClient]. Future _waitAndConnect(String url) async { Uri uri = Uri.parse(url); + final List pathSegments = []; + // If there's an authentication code (default), we need to add it to our path. + if (uri.pathSegments.isNotEmpty) { + pathSegments.add(uri.pathSegments.first); + } + pathSegments.add('ws'); if (uri.scheme == 'http') - uri = uri.replace(scheme: 'ws', path: '/ws'); + uri = uri.replace(scheme: 'ws', pathSegments: pathSegments); int attempts = 0; while (true) { WebSocket ws1;