Skip to content

Commit 2502fbc

Browse files
author
GitLab CI
committed
fix: don't navigate to CDP debug port URL on connect
Skip Page.navigate when URL points to localhost:<debug_port> regardless of launchChrome flag. Prevents browser showing the CDP JSON endpoint page.
1 parent 1f9065d commit 2502fbc

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/src/bridge/cdp_driver.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,12 @@ class CdpDriver implements AppDriver {
115115
// When connecting to an existing instance (launchChrome=false),
116116
// skip navigation if URL is about:blank or matches the CDP port
117117
// (the target already has content loaded).
118-
final skipNav = !_launchChrome &&
119-
(_url.isEmpty ||
120-
_url == 'about:blank' ||
121-
_url.contains('localhost:$_port'));
118+
// Skip navigation if: no URL, about:blank, or URL points to the CDP
119+
// debug port itself (user likely just wants to connect to existing tabs).
120+
final skipNav = _url.isEmpty ||
121+
_url == 'about:blank' ||
122+
_url.contains('localhost:$_port') ||
123+
_url.contains('127.0.0.1:$_port');
122124
if (!skipNav) {
123125
await _call('Page.navigate', {'url': _url});
124126
// Wait for DOMContentLoaded or timeout (much faster than fixed 2s delay)

0 commit comments

Comments
 (0)