How do I allow Chrome to use my microphone programmatically?

后端 未结 5 613
耶瑟儿~
耶瑟儿~ 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:50

    A little late but pasting how to do this here for others looking for the same.

    const webdriver = require('selenium-webdriver'), By = webdriver.By, until = webdriver.until,Builder= webdriver.Builder;
    
    var chrome = require('selenium-webdriver/chrome');
    
    var chromeOptions = new chrome.Options()
    .addArguments('allow-file-access-from-files')
    .addArguments('use-fake-device-for-media-stream')
    .addArguments('use-fake-ui-for-media-stream');
    
    var driver = new webdriver.Builder()
    .forBrowser('chrome')
    .setChromeOptions(chromeOptions);
    
    driver = driver.build();
    

提交回复
热议问题