I have a web automation script created with python and selenium.
I intend to have the script executed by task scheduler ahead of time (maybe a few seconds before) and have web driver wait until specified time to send input to the form then continue on with the rest of the script.
import schedule
import datetime
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.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import Select
from datetime import timedelta, date
import argparse
import time
#Handle Calendar
WebDriverWait(driver, (5)).until(
EC.presence_of_element_located((By.XPATH, "//div[@id='datediv']"))
)
calendar = driver.find_element(By.XPATH,"//input[@id='datetxt']")
def enterdate():
calendar.send_keys(bookingdate_day)
return schedule.CancelJob
schedule.every().wednesday.at('17:00').do(enterdate)
while True:
schedule.run_pending()
5