microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
65.45k stars 3.56k forks source link

[BUG] Cannot use switch `--enable-webrtc=0` with WebKit #15958

Closed SuperSonicHub1 closed 2 years ago

SuperSonicHub1 commented 2 years ago

Context:

Code Snippet

Help us help you! Put down a short code snippet that illustrates your bug and that we can run and debug locally. For example:

const { webkit } = require('playwright')

;(async () => {
  const browser = await webkit.launch({ args: ['--enable-webrtc=0'] })
    const page = await browser.newPage()
})()

Describe the bug Running ~/.cache/ms-playwright/webkit-1683/pw_run.sh --enable-webrtc=0 runs MiniBrowser just fine and no command line parsing issues come up. However, when I replicate the same command with Node or Python, I get this error:

node:internal/process/promises:246
          triggerUncaughtException(err, true /* fromPromise */);
          ^

browserType.launch: Browser closed.
==================== Browser output: ====================
<launching> /home/kwilliams/.cache/ms-playwright/webkit-1683/pw_run.sh --inspector-pipe --headless --no-startup-window --enable-webrtc=0
<launched> pid=411610
[pid=411610][err] Cannot parse arguments: Unknown option --enable-webrtc=0
=========================== logs ===========================
<launching> /home/kwilliams/.cache/ms-playwright/webkit-1683/pw_run.sh --inspector-pipe --headless --no-startup-window --enable-webrtc=0
<launched> pid=411610
[pid=411610][err] Cannot parse arguments: Unknown option --enable-webrtc=0
============================================================
    at /home/kwilliams/Software/streamforge/tiktok/captcha-solver/webkit-options.js:5:32
    at Object.<anonymous> (/home/kwilliams/Software/streamforge/tiktok/captcha-solver/webkit-options.js:15:3) {
  name: 'Error'
}

--enable-webrtc 0 also works on the command line, but then Playwright thinks you're trying to specify a webpage URL:

node:internal/process/promises:246
          triggerUncaughtException(err, true /* fromPromise */);
          ^

browserType.launch: Arguments can not specify page to be opened
    at /home/kwilliams/Software/streamforge/tiktok/captcha-solver/webkit-options.js:4:32
    at Object.<anonymous> (/home/kwilliams/Software/streamforge/tiktok/captcha-solver/webkit-options.js:6:3) {
  name: 'Error'
}
SuperSonicHub1 commented 2 years ago

After doing further investigation it seems that specifying --headless causes a different binary to be opened which indeed doesn't have --enable-webrtc as a command line flag. I guess I now need to open up a WebKit bug?

SuperSonicHub1 commented 2 years ago

I'm going to be closing this issue as it's likely out of scope for you all. I think it would be good to clarify here that there is significantly different behavior for how WebKit works depending on if headless is set to false or true.