- from selenium import webdriver
- from selenium.webdriver.chrome.options import Options
- from selenium.webdriver.common.by import By
- from selenium.webdriver.support.ui import WebDriverWait
- from selenium.webdriver.support import expected_conditions as EC
- from selenium.common.exceptions import TimeoutException
- chrome_options = Options()
- chrome_options.add_argument("--headless")
- chrome_options.add_argument("--no-sandbox")
- driver = webdriver.Chrome(options=chrome_options)
- driver.get("https://toolkit.tesco.com/sign-in/")
- try:
- login_button = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.LINK_TEXT, "Partner sign-in")))
- login_button.click()
- username_field = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.CSS_SELECTOR, '[aria-label="Email address"]')))
- username_field.send_keys('[email protected]')
- password_field = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.CSS_SELECTOR, '[aria-label="Password"]')))
- password_field.send_keys('Pladmarch11')
- password_field.send_keys(Keys.RETURN)
- except TimeoutException:
- print("Timeout error: Unable to locate login elements.")
- driver.quit()
[text] Co
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
Editor
You can edit this paste and save as new: