I was trying to download an audio file using selenium, python and Chrome browser from url: audio file. (Note: Please use headphones as the audio plays automatically and open the file using chrome browser).
But when I used Inspect element on the three dots that show the download option I couldn't find any way to reference that element in the code. So, is there any other way I can press that 'three dots' button and then press on 'download button'??
Below is the code I wrote for the performing the action.
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.by import By
from selenium.webdriver import ActionChains
from selenium.webdriver.common.keys import Keys
s=Service(ChromeDriverManager().install())
options = webdriver.ChromeOptions()
preferences = {'download.default_directory': 'some_path'}
options.add_experimental_option('prefs', preferences)
driver = webdriver.Chrome(service=s, options=options)
driver.maximize_window()
driver.get('https://www.valmiki.iitk.ac.in/sites/default/files/audio/1-1-1.mp3')
action = ActionChains(driver)
dot_dot_dot = driver.find_element(By.XPATH, "//video[@name='media']")
dot_dot_dot.click().perform()
# remaining code to click on the download button