Python Forum

Full Version: Keep trying link until enabled
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I have a program to book a court at the gym, it looks like this

import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

options = Options()
# to remove the usb errors
options.add_experimental_option('excludeSwitches', ['enable-logging'])

# to save session data
options.add_argument(
    r'--user-data-dir=C:\Users\pepe\AppData\Local\Google\Chrome\User Data2')
driver = webdriver.Chrome(options=options)

driver.get("https://mydomain.com/someurl")

driver.find_element(By.LINK_TEXT, "19:30").click()
...
And it works, but the thing is the link is enabled at 7am and there is a lot of people trying to book the court at that time.

Is there a way to be able to run the program as soon as the link is enabled?

What can be done in this situation?

Thanks
Anyone?
what is the URL?
It is a private URL only for members.
Here is the page

[Image: TQQJRVt.png]