我正在使用 webdriver 编写 selenium 测试 python,我的测试用例需要访问用户媒体(麦克风)。我尝试了 --disable-user-media-security 的不同变体标志但无法实现我想要的。我正在做这样的事情:
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
关于如何处理这个的任何想法?必须有某种方法可以访问麦克风:/
最佳答案
对于麦克风,将此选项添加到 chrome:chrome_options.add_argument("--use-fake-ui-for-media-stream")
关于python - 使用 selenium 在 Chrome 中接受对麦克风的请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33260887/