i trying run tests made webdriverjs , chromedriver need microphone permissions.
this popup shows up:
i have tried:
chromedriver.start(['--disable-popup-blocking']); driver = new webdriver.builder() .withcapabilities(webdriver.capabilities.chrome()) .build(); but didn't work.
i tried
driver.wait(until.alertispresent(), config.timeout, 'alert did not show up'); driver.switchto().alert().accept(); it did not work either! guess not ordinary alert.
useful links:
how give them permissions programatically?
is there flag or other way around this?
a fresh profile loaded each time run selenium, hence changes make preferences , website permissions not preserved between sessions. amend need tell selenium profile load.
step 1. find chrome preferences file: www.forensicswiki.org/wiki/google_chrome#configuration
step 2. copy folder default somewhere. assume copied /some/path/allow-mic/default.
alternative step 3 (this easier): before copying default visit localhost:1337 chrome , set mic allow.
step 3. edit allow-mic/default/preferences, find tags "profile", "content_settings" , "exceptions" within each other , add
"media_stream_mic":{"http://localhost:1337,*": {"last_used":1470931206, "setting":1} }, to "exceptions". should end like:
... "profile":{ ... "content_settings": { ... "exceptions": { ... "media_stream_mic":{"http://localhost:1337,*": {"last_used":1470931206, "setting":1} }, ... }, }, }, ... step 4: configure selenium use edited preferences:
var chromedriver = require('chromedriver'); var webdriver = require('selenium-webdriver'); var chrome = require('selenium-webdriver/chrome'); var opts = new chrome.options(); opts.addarguments("user-data-dir=/some/path/allow-camera"); var driver = new chrome.driver(opts); you can check correct set of preferences (profile path) in use opening chrome://version/.

Comments
Post a Comment