How do I allow Chrome to use my microphone programmatically?

后端 未结 5 550
耶瑟儿~
耶瑟儿~ 2020-12-28 09:12

I am currently trying to run some tests made with webdriverjs and chromedriver but they need microphone permissions.

This is the popup that shows up:

<
5条回答
  •  醉梦人生
    2020-12-28 09:45

    You can whitelist a url for audio-capture by providing chromedriver with the hardware.audio_capture_allowed_urls preference.

    ...
    chrome_options = Options()
    prefs = {"hardware.audio_capture_allowed_urls" : ["example.org"]}
    chrome_options.add_experimental_option("prefs",prefs)
    driver = webdriver.Chrome(chrome_options=chrome_options)
    

提交回复
热议问题