I am totally new to the selenium package a try to figure out how to get access to dynamic date events. For example on the 10.02.2022 I want only to click on the event at 6.30 - 08.15. I am able to access to particular event with the "find_element_by_xpath" statement but this is just static.
Do you know a way to search in the class of "day has-event" at the data-date "10.02.2022" for the particular time slots as shown in the picture?
Thank you very much!
CodePudding user response:
I think the best way to do that is first of all, find needed date column and than iterate through elements inside that to find time you want. Some code example here:
needed_time = '6.30 - 08.15'
date = page.find_element_by_css_selector('.day.has-event[data-date="10.02.2022"]')
events = date.find_elements_by_css_selector('ul li')
for event in events:
time = event.find_element_by_css_selector('span').text
if time == needed_time:
break
else:
event = None
print("Needed time was not found!")