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

[BUG] WebSocketRoute not working properly #31

Open
1 task done
josegrobles opened this issue Dec 29, 2024 · 0 comments
Open
1 task done

[BUG] WebSocketRoute not working properly #31

josegrobles opened this issue Dec 29, 2024 · 0 comments
Assignees

Comments

@josegrobles
Copy link

josegrobles commented Dec 29, 2024

System info

  • Playwright Version: 1.49.1
  • Operating System: All
  • Browser: Chrome

Source code

const { chromium } = require('patchright');

(async () => {
  const browser = await chromium.launch({
    headless: false,
    viewport: null,
    channel: 'chrome',
  });
  const context = await browser.newContext();
  const page = await context.newPage();
  await page.routeWebSocket(() => true, ws => {
    const server = ws.connectToServer();
    ws.onMessage(message => {
      console.log('sent',message);
      server.send(message);
    });
    server.onMessage(message => {
      console.log('received',message);
      ws.send(message);
    });
  });

  await page.goto('https://www.olybet.ee/sports/live');
})();
  • I provided exact source code that allows reproducing the issue locally.

Steps

  • Run the provided Script

Expected

Logs all the messages from WebSocket connections on the current page.

Actual

Nothing is logged. If you try with the regular Playwright it works properly.

@josegrobles josegrobles changed the title [BUG] [BUG] WebSocketRoute not working properly Dec 29, 2024
@Vinyzu Vinyzu self-assigned this Dec 29, 2024
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

2 participants