Issue
I want to click a day of the calendar(doesn't matter what day) if it's available
There are days that are available and other that they aren't. The calendar is made with table, each td tag, if it is Disabled , has a class
td class="fc-daygrid-day fc-day fc-day-mon fc-day-disabled"
if it is There is not available, has a class
td class="fc-daygrid-day fc-day fc-day-wed fc-day-past
if it is There is available, has a class
class="fc-daygrid-day fc-day fc-day-mon fc-day-future date-availiable"
that i want to select (clicking on it ) the day available(doesn`t matter which day).Just any day which appears to be available
Here is the calendar:
this is full page Source
I am using SeleniumBase Codes
from seleniumbase import SB
with SB(uc=True, demo=True) as sb:
while True:
try:
open_the_form_turnstile_page(sb)
click_turnstile_and_verify(sb)
Pick_available_date(sb)
except Exception as e:
print(f'error encountered: {e}')
finally:
sleep(2)
quit()
def open_the_form_turnstile_page(sb):
sb.driver.uc_open_with_reconnect(
"https://localhost", reconnect_time=12,
)
# Captcha Check
def click_turnstile_and_verify(sb):
# sb.driver.uc_switch_to_frame("iframe") #Enable it if the Captcha not check automatic
# sb.driver.uc_click("span.mark")
sb.highlight('/html/body/app-root/div/div/app-login/section/div/div/mat-card/form/app-cloudflare-captcha-container/div', timeout=3.33)
print("Captcha Check >>>>> Success")
sleep(5)
def Pick_available_date(sb):
sb.click("td.fc-daygrid-day fc-day fc-day-fri fc-day-future date-availiable")
print("Time Slots click >>>>> Success")
sb.highlight_click('a:contains("Select")')
print("Select Button click >>>>> Success")
sleep(2)
return Review(sb)
how can do this with seleniumbase?
Thank you so much, I can't thank you enough for your effort Seleniumbase amazing library, I've really loved it. Your work is impressive!
Solution
To click an available date on that page, you can use td.date-availiable
as the selector:
sb.click("td.date-availiable")
If for some reason that makes selenium detected, use this version instead in UC Mode:
sb.driver.uc_click("td.date-availiable")
Answered By - Michael Mintz
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.