- 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
- # Configure Chrome options
- chrome_options = Options()
- chrome_options.add_argument("--headless")
- chrome_options.add_argument("--no-sandbox")
- # Initialize WebDriver
- driver = webdriver.Chrome(options=chrome_options)
- driver.get("https://toolkit.tesco.com/sign-in/")
- try:
- # Wait for the "Partner sign in" button to become clickable
- partner_sign_in_button = WebDriverWait(driver, 30).until(EC.element_to_be_clickable((By.LINK_TEXT, "Partner sign-in")))
- partner_sign_in_button.click()
- # Wait for the email address field to appear
- #username_field = WebDriverWait(driver, 30).until(EC.presence_of_element_located((By.CSS_SELECTOR, 'input[name="email-address"]')))
- # Fill in the email address and password fields
- #username_field.send_keys('[email protected]')
- #password_field = driver.find_element(By.XPATH, '//input[@name="password"]')
- # password_field.send_keys('Pladmarch11')
- # Click the "Sign in" button
- #login_button = WebDriverWait(driver, 30).until(EC.element_to_be_clickable((By.XPATH, '//button[contains(text(), "Sign in")]')))
- # login_button.click()
- except TimeoutException as e:
- print("Timeout error: Unable to locate login elements." + str(e))
- # Close the WebDriver session
- driver.quit()
[text] f
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: