Skip to content

[Feature] Add an option for mute that is similar to headless. #19534

Open
@matecsaj

Description

The Playwright documentation has a link to args for Chromium but not WebKit. I looked on the WebKit site but could not find a list. I googled for a similar code but found none that dealt with WebKit and sound. No matter what args I try, the sound keeps playing. How can the sound be muted? Help, please.

from playwright.sync_api import sync_playwright

with sync_playwright() as playwright:
    # TODO mute the browser; I can't find a list of WebKit args, and none of my guesses stop the sound
    # args=['--nosound'] ignore_default_args=['--nosound']) args=["--mute-audio"]) ignore_default_args=["--mute-audio"]
    with playwright.webkit.launch(headless=False, ignore_default_args=["--mute-audio"]) as browser:
        with browser.new_context() as context:
            with context.new_page() as page:
                page.goto("https://www.youtube.com/watch?v=J2O_xa8cems&list=RDJ2O_xa8cems&start_radio=1")
                page.wait_for_timeout(40000)        # 30 seconds of ads then 10 seconds of the music video

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions