# Pass the argument 1 to allow and 2 to block option.add_experimental_option( "prefs", {"profile.default_content_setting_values.media_stream_mic": 1}) # In order to use Chrome as a browser for the selenium we have to use chromedriver. Put the path where this chrome driver is located. driver = webdriver.Chrome( options=option, executable_path=r"C:\chromedriver\chromedriver.exe") # Give the address of the web page you want to operate on. driver.get( 'https://www.google.com/intl/en/chrome/demos/speech.html?authuser=2') # To select any kind of dropdowns. dropdown = driver.find_element_by_id("select_dialect") for option in dropdown.find_elements_by_tag_name('option'): if option.text == 'India': option.click() # select() in earlier versions of webdriver break # Finding buttons and then clicking it to start recording. button = driver.find_element_by_id("start_button") button.click() # Next code is for opening the audio file and thereby giving the input to the recorder. filename = r'C:\Users\dell\video summariser\songJava\song.wav' # Set chunk size of 1024 samples per data frame chunk = 1024 # Open the sound file wf = wave.open(filename, 'rb')