I'm trying to download the following PDF from a browser's PDF viewer by clicking the download button.
I tried the following code using ID, CSS_SELECTOR, and XPATH locators, but it seems not to be working.What could be the issue? Can someone help me with this?
import timefrom selenium import webdriverfrom selenium.webdriver.chrome.service import Service as ChromeServicefrom webdriver_manager.chrome import ChromeDriverManagerfrom selenium.webdriver.support import expected_conditions as ECfrom selenium.webdriver.common.by import Byfrom selenium.webdriver.support.ui import WebDriverWaitdownload_url = "https://www.npci.org.in/PDF/nach/circular/2015-16/Circular-No.135.pdf"options = webdriver.ChromeOptions()driver = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install()), options=options)driver.get(download_url)WebDriverWait(driver, 30).until(EC.presence_of_element_located((By.CSS_SELECTOR, '#icon')))driver.find_element(By.ID, '#icon').click()time.sleep(5)driver.quit()
