Skip to content

Instantly share code, notes, and snippets.

@rudensm
Last active February 12, 2023 13:30
Show Gist options
  • Save rudensm/f1bb27b6524f246fc946cc588416cc73 to your computer and use it in GitHub Desktop.
Save rudensm/f1bb27b6524f246fc946cc588416cc73 to your computer and use it in GitHub Desktop.
Python Selenium Yahoo
from seleniumwire import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
# open browser;
options = webdriver.ChromeOptions()
options.add_argument("--window-size=1920,2000")
driver = webdriver.Chrome(chrome_options=options)
# load website;
driver.set_page_load_timeout(30)
driver.get("https://yahoo.com/")
# wait for necessary element;
wait = WebDriverWait(driver, 30)
element = wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, ".consent-form [type=submit]")))
# perform;
element.click()
# close browser;
driver.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment