This is the HTML code (LinkedIn company's job page, linkedin.com/yourcompany/jobs/)
<li id="ember623" class="ember-view jobs-search-results__list-item occludable-update p0 relative scaffold-layout__list-item
[...]
">
<time datetime="2022-09-20">
2 days ago
<!----> </time>
</li>
[...]
</li>
I'm trying to access the date in the datetime attribute by using CLASS_NAME.
When I search using XPATH, it works, and I get the date: '2022-09-20'
A = browser.find_elements(By.XPATH,"//time")
A[index].get_attribute("datetime")
When I search for the date using class_name, like so:
A = browser.find_elements(By.CLASS_NAME,"occludable-update")
A[index].get_attribute("datetime")
It returns empty.
But if I write:
A = browser.find_elements(By.CLASS_NAME,"occludable-update")
A[index].text
I get: '2 days ago'
How can I get the date, and not the text, by using By.CLASS_NAME?