Headless browser / Python & Selenium mute function

43 views Asked by At

Can this line of selenium code: firefox_options.add_argument("--mute-audio") work when being used with a headless browser? Here is the function I am working with:

def start_driver(self):
    firefox_options = web.FirefoxOptions()
    firefox_options.add_argument('--headless') 
    firefox_options.add_argument("--mute-audio")
    os.environ["webdriver.gecko.driver"] = gecko_driver_path
    self.driver = web.Firefox(options=firefox_options)
1

There are 1 answers

0
yusuf On

Since you are running the program in headless mode, the audio will not be played. So you do not have to explicitly add the "--mute-audio" argument.