I tried to extract all text from a 'time' tag. The HTML is from this page : https://www.python.org
Here is my code:
event_times = driver.find_elements(By.CSS_SELECTOR, value=".event-widget time")
for time in event_times:
print(time.get_attribute("innerHTML"))
I have this output:
<span class="say-no-more">2021-</span>11-13
<span class="say-no-more">2021-</span>11-15
<span class="say-no-more">2021-</span>11-18
<span class="say-no-more">2021-</span>11-19
<span class="say-no-more">2021-</span>11-24
If I change to :
for time in event_times:
print(time.text)
The output:
11-13
11-15
11-18
11-19
11-24
My question : is there a direct way to display all the text contained in the time tag, namely 2021-11-13
, 2021-11-15
, etc...?
Except to separate into two searches (in span for "year" and in time for "month-day"), I don't see how to do this...