0

enter image description here

I want to Allow camara and mic on click of Allow button on the popup. How can I handle this using selenium webdriver with python? Refer image below. I have tried following solution but it is not working for me

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

option = Options()

option.add_argument("--disable-infobars")
option.add_argument("start-maximized")
option.add_argument("--disable-extensions")
option.add_experimental_option("prefs", { 
    "profile.default_content_setting_values.notifications": 1 
})

driver = webdriver.Chrome(chrome_options=option, executable_path='path-of- 
driver\chromedriver.exe')

Chrome version is : 78 selenium : 3.14 Python 3.7

Dharman
  • 30,962
  • 25
  • 85
  • 135
tanvi joshi
  • 19
  • 2
  • 8

1 Answers1

0

You need to specify media_stream_mic and media_stream_camera in the experimental options

options.add_experimental_option("prefs", {
    "profile.default_content_setting_values.notifications": 1,
    "profile.default_content_setting_values.media_stream_mic": 1,
    "profile.default_content_setting_values.media_stream_camera": 1
})
Guy
  • 46,488
  • 10
  • 44
  • 88