Reputation: 2101
Is there a way to mute a tab? Meaning shutting its audio. I was trying to come out from
ArrayList<String> tabs = new ArrayList<String> (m_chromeWebdriver.getWindowHandles());
m_chromeWebdriver.switchTo().window(tabs.get(1));
and to work on the tab, but I couldn't find a way.
Upvotes: 2
Views: 987
Reputation: 815
You can mute all tabs using
from selenium import webdriver
# in Chrome:
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--mute-audio")
driver = webdriver.Chrome(chrome_options=chrome_options)
# in FireFox
profile = webdriver.FirefoxProfile()
profile.set_preference("media.volume_scale", "0.0")
driver = webdriver.Firefox(firefox_profile=profile)
Upvotes: 1
Reputation: 25611
Selenium doesn't interact with the browser UI. The only way you might be able to do it indirectly is if there were a keyboard shortcut but I haven't seen one.
Upvotes: 0