Code: Select all
from selenium.webdriver.chrome.service import Serviceenter code here
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.by import By
def open_webpage():
service = Service(ChromeDriverManager().install())
driver = webdriver.Chrome(service=service)
driver.get("website_url")
try:
button = driver.find_element(By.XPATH, '//button[@type="submit" and @data-umami-event="download"]')
if button.is_displayed():
button.click()
print("Button clicked")
else:
print("Button is not visible.")
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
WebDriverWait(driver, 10).until(
EC.presence_of_all_elements_located((By.TAG_NAME, 'a'))
) ```