python code for asking microphone permission in Chrome and other Browser?



  • I am developing an application where I need microphone access. So, anyone can tell me the python code for asking microphone permission in Chrome or any other Browser.enter image description here



  • Try the below code

    from selenium import webdriver
    from selenium.webdriver.chrome.options import Options
    chrome_options = Options()
    options.add_argument('use-fake-device-for-media-stream')
    
    
    driver = webdriver.Chrome(chrome_options=options)
    

    Or else you can pass the chrome profile that has microphone enabled for your application

    options.add_argument("user-data-dir=<profilepath>")
    

    eg

    options.add_argument("user-data-dir=c:\profile\user-data")
    

    if the profile is not in user-data\default then you have to also add

    options.add_argument('--profile-directory=<folder_name>')
    

Log in to reply
 

Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2