I'm trying to extract "Date Applied" and "17 Apr 2025 06:00", from html below:
<span class="labels" part="text-and-icon-labels">
<slot part="text-and-icon-label" class="label" data-cy="label">
<!--?lit$536635879$-->
Date applied
</slot>
<slot part="text-and-icon-sublabel" name="sublabel" class="sublabel">
<!--?lit$536635879$-->
17 Apr 2025 06:00
</slot>
</span>
Tried code below on python but doesn't work at all:
html_ = body.get_attribute('innerHTML')
soup = BeautifulSoup(html_, "html.parser")
all_items = soup.find_all('span')
for item in all_items:
print(item.text)
Answer
How you grab span should work. What's the error you are getting though?