简体   繁体   English

使用 selenium 在 Chrome 中接受对麦克风的请求

[英]Accept request to microphone in Chrome using selenium

I'm writing selenium tests python using webdriver and my test cases require access to user media (microphone).我正在使用 webdriver 编写 selenium 测试 python,我的测试用例需要访问用户媒体(麦克风)。 I tried different variations of --disable-user-media-security flag but couldn't achieve what I want.我尝试了--disable-user-media-security标志的不同变体,但无法实现我想要的。 I'm doing something this:我正在做这样的事情:

chrome_options = Options()
chrome_options.add_argument("--disable-user-media-security")
self.driver = webdriver.Chrome('/Users/xxx/Develop/WebME/chromedriver', chrome_options=chrome_options)
driver = self.driver

Any ideas on how to handle this?关于如何处理这个的任何想法? There must be some way to do get access to mic :/必须有某种方法可以访问麦克风:/

对于麦克风,将此选项添加到 chrome:

chrome_options.add_argument("--use-fake-ui-for-media-stream")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 selenium 在 chrome 中接受剪贴板权限请求 - Accept Clipboard permission request in chrome using selenium 如何接受 Chrome 通知 Selenium - How To Accept Chrome Notifications Selenium Selenium 关闭/接受 Chrome 确认弹出窗口 - Selenium dismiss/accept Chrome confirmation popup window 在 Selenium Chrome 驱动程序中自动接受所有 cookies - Accept all cookies automatically in Selenium Chrome driver 如何在不使用 alert.accept() 的情况下使用 Selenium 在 Brave/Chrome 中禁用弹出窗口/警报? - How to disable popups/alerts in Brave/Chrome using Selenium without using alert.accept()? 使用 Selenium-webdriver 为 python 自动阻止 Chrome 请求? - Automate Chrome request blocking using Selenium-webdriver for python? 使用 Python fetch.fail_request 的 Selenium 4 chrome devtools 不会使请求失败,而是将其保持为待处理 - Selenium 4 chrome devtools using Python fetch.fail_request not failing the request but keeping it as pending 单击接受 cookies 按钮使用 Selenium - Clicking Accept cookies button using Selenium 如何使用硒在弹出窗口中接受警报? - How to accept alert in the popup window using selenium? 我如何使用 selenium 接受这些 cookie? - How can I accept this cookies using selenium?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM