Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/playwright-core/src/server/chromium/chromium.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,8 @@ async function urlToWSEndpoint(progress: Progress, endpointURL: string, headers:
return endpointURL;
progress.log(`<ws preparing> retrieving websocket url from ${endpointURL}`);
const url = new URL(endpointURL);
if (!url.pathname.endsWith('/'))
url.pathname = url.pathname + '/';
url.pathname += 'json/version/';
const httpURL = url.toString();

Expand Down
17 changes: 17 additions & 0 deletions tests/library/chromium/connect-over-cdp.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,23 @@ test('should connect to an existing cdp session', async ({ browserType, mode },
}
});

test('should connect to an existing cdp session with verbose path', async ({ browserType, mode }, testInfo) => {
const port = 9339 + testInfo.workerIndex;
const browserServer = await browserType.launch({
args: ['--remote-debugging-port=' + port]
});
try {
const cdpBrowser = await browserType.connectOverCDP({
endpointURL: `http://127.0.0.1:${port}/json/version/abcdefg`,
});
const contexts = cdpBrowser.contexts();
expect(contexts.length).toBe(1);
await cdpBrowser.close();
} finally {
await browserServer.close();
}
});

test('should use logger in default context', async ({ browserType }, testInfo) => {
test.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/28813' });
const port = 9339 + testInfo.workerIndex;
Expand Down
Loading