Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(playwright-test): support connectOverCDP option in connectOptions #18052

Closed

Conversation

tjenkinson
Copy link
Contributor

@tjenkinson tjenkinson commented Oct 13, 2022

Open to suggestions for a better way to do this. We just need to be able to use the CDP protocol to connect to chrome using the test library.

Don't suppose there's a way of achieving this on the current version? I couldn't find any

@tjenkinson tjenkinson force-pushed the connect-over-cdp-option branch from aebc82b to 46f081a Compare October 13, 2022 09:56
@tjenkinson tjenkinson changed the title feat(api): support connectOverCDP option to connect() feat(playwright-test): support connectOverCDP option in connectOptions Oct 13, 2022
@tjenkinson tjenkinson marked this pull request as ready for review October 13, 2022 09:57
@tjenkinson tjenkinson force-pushed the connect-over-cdp-option branch from 46f081a to 868a1d8 Compare October 13, 2022 10:06
@tjenkinson tjenkinson marked this pull request as draft October 13, 2022 10:07
@tjenkinson tjenkinson force-pushed the connect-over-cdp-option branch from 868a1d8 to 46f081a Compare October 13, 2022 10:08
@tjenkinson tjenkinson force-pushed the connect-over-cdp-option branch from 46f081a to 3cede1f Compare October 13, 2022 10:09
@tjenkinson tjenkinson marked this pull request as ready for review October 13, 2022 10:09
@unlikelyzero
Copy link
Contributor

#8379 was originally filed for this usecase. This is something we need to be compatible with browserless

@tjenkinson
Copy link
Contributor Author

Do you know what the difference is between the protocol for connectOverCDP() vs connect(). What's the protocol that's used for wsEndpoint in connect()?

@dgozman
Copy link
Contributor

dgozman commented Oct 18, 2022

@tjenkinson Could you please file an issue or reference an existing one? We prefer to have conversations in the issue so that it's available to everyone searching.

That said, if you'd like to use connectOverCDP with @playwright/test today, the easiest way would be to override the browser fixture.

import { test as base } from '@playwright/test';

export const test = base.extend({
  browser: async ({ playwright }, use) => {
    const browser = await playwright.chromium.connectOverCDP('ws://myhost:port');
    await use(browser);
    await browser.close()l
  },
});

@tjenkinson
Copy link
Contributor Author

Ah perfect thanks I didn’t realise that was available to override. That solves it for me so fine if you want to close this

@dgozman dgozman closed this Oct 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants