如何授予对 Chrome 中内容的权限
How to allow permissions to content in Chrome
我卡住了,无法在 WebDriver 中使用摄像头和麦克风:
WebDriver 如何处理这个问题?我在互联网上没有找到任何与此相关的有用信息。
提前致谢。
PS: How can I close the microphone/camera popup in Python / Selenium? -- 没有解决我的问题(我不需要 "fake")。
您可以allow/block通过偏好设置不同的内容:
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument("--disable-infobars")
options.add_argument("--window-size=800,600")
options.add_experimental_option("prefs", { \
"profile.default_content_setting_values.media_stream_mic": 1, # 1:allow, 2:block
"profile.default_content_setting_values.media_stream_camera": 1, # 1:allow, 2:block
"profile.default_content_setting_values.geolocation": 1, # 1:allow, 2:block
"profile.default_content_setting_values.notifications": 1 # 1:allow, 2:block
})
driver = webdriver.Chrome(chrome_options=options)
我卡住了,无法在 WebDriver 中使用摄像头和麦克风:
WebDriver 如何处理这个问题?我在互联网上没有找到任何与此相关的有用信息。
提前致谢。
PS: How can I close the microphone/camera popup in Python / Selenium? -- 没有解决我的问题(我不需要 "fake")。
您可以allow/block通过偏好设置不同的内容:
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument("--disable-infobars")
options.add_argument("--window-size=800,600")
options.add_experimental_option("prefs", { \
"profile.default_content_setting_values.media_stream_mic": 1, # 1:allow, 2:block
"profile.default_content_setting_values.media_stream_camera": 1, # 1:allow, 2:block
"profile.default_content_setting_values.geolocation": 1, # 1:allow, 2:block
"profile.default_content_setting_values.notifications": 1 # 1:allow, 2:block
})
driver = webdriver.Chrome(chrome_options=options)