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

Playwright support broken as of v1.4.0 #1016

Closed
Niek opened this issue Oct 5, 2020 · 7 comments
Closed

Playwright support broken as of v1.4.0 #1016

Niek opened this issue Oct 5, 2020 · 7 comments

Comments

@Niek
Copy link

Niek commented Oct 5, 2020

Describe the bug
Playwright support worked fine until version v1.4.0. That version introduced a new wire protocol, see https://github.com/microsoft/playwright/releases/tag/v1.4.0

To Reproduce
Install latest playwright (v1.4.2 as of writing). Connecting won't work, however when downgrading to v1.3.0 things work fine.

@berstend
Copy link

berstend commented Oct 5, 2020

The following will hang at .connect since v1.4.0:

const pw = require('playwright');

(async () => {
  const browser = await pw.chromium.connect({
   wsEndpoint: 'wss://chrome.browserless.io?token=YOUR-API-TOKEN',
  });
  const context = await browser.newContext();
  const page = await context.newPage();

  await page.goto('https://www.example.com/');
  await page.screenshot({ path: 'example.png' });

  await browser.close();
})();

Note that the official browserless example uses browserWSEndpoint, which should be wsEndpoint with playwright. :)

@joelgriffith
Copy link
Collaborator

Thanks for this, will take a look and see what's going on behind the scenes. We're working on migrating to playwright internally, but it might take some time :)

@joelgriffith
Copy link
Collaborator

This is fairly unfortunate, as playwright has gone away from chromes embedded protocol over to their own proprietary one. This forces browserless to do one of two potential things to fix this:

  • Start it’s own websocket server to sniff out whether or not the initiating message is CDP-based or not, and either start just chromium or playwrights server-side component. Possible chance of regressions because of this.

  • Add some arbitrary flag to the connect call to specify its playwright initiating the connection. This would be a quicker fix, but not as robust as the above solution.

In either case both would require a bit of work to do so. I’m not sure why the breaking change on their library, as it doesn’t seem to buy much in my opinion. The transport layer is the same, and CDP already allows for cross-language/runtime compatibility.

@berstend
Copy link

berstend commented Oct 6, 2020

I agree, this is a massive breaking change that's not even documented (the API docs for connect don't mention it).

@Niek
Copy link
Author

Niek commented Oct 6, 2020

Related Playwright issue: microsoft/playwright#4054

@joelgriffith
Copy link
Collaborator

joelgriffith commented Oct 6, 2020

Should be fixed in #1018. Docs are needing to be updated, but you'll need to do a connection on /playwright. Should be updated in our cloud early next week.

@joelgriffith
Copy link
Collaborator

Fix is now everywhere in our platform. Closing

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

No branches or pull requests

3 participants