Hello, '
So I am trying to get selenium up and working and it seems to work fine on the first element I target but every other element it times out waiting for the element to be clickable. It all works find on my local server so I'm not sure if there is something else I need to do to get it running on pythonanywhere?
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-gpu")
driver = webdriver.Chrome(options=chrome_options)
driver.get("https://ticket.toureiffel.paris/en")
try:
# Wait for the accept button to be clickable
accept = WebDriverWait(driver, 60).until(
EC.element_to_be_clickable((By.ID, "tarteaucitronPersonalize2"))
)
accept.click()
print("Accept button clicked successfully.")
except TimeoutException:
print("Timed out waiting for the accept button to be clickable.")
except ElementClickInterceptedException:
print("Another element intercepted the click on the accept button.")
except StaleElementReferenceException:
print("The accept button reference became stale before it could be clicked.")
except Exception as e:
print(f"An unexpected exception occurred: {e}")
try:
# Wait for the date button to be clickable
data_date_label_value = date
date= WebDriverWait(driver, 60).until(
EC.element_to_be_clickable((By.XPATH,
f"//label[@data-date-label='{data_date_label_value}']"))
)
date.click()
print("Date button clicked successfully.")
except TimeoutException:
print("Timed out waiting for the Date button to be clickable.")
except ElementClickInterceptedException:
print("Another element intercepted the click on the Date button.")
except StaleElementReferenceException:
print("The Date button reference became stale before it could be clicked.")
except Exception as e:
print(f"An unexpected exception occurred: {e}")
driver.quit()