I'm coding in Python, working with Selenium.
I have to print that closed year between the span
tag.
<div class="display_year">
<span class="year">
::before
"1989"
::after
</span>
</div>
I have no experience with Selenium. I tried to write this:
year = driver.find_element_by_xpath("//span::after[@class='year']")
print(year.text)
But it doesn't work.
I guess it's for that :: before ... :: after
, because this code prints an empty string that's the contents of the span tag when it is :: before
Someone, please, can tell me how I have to write to print the contents of the year, in this case "1989"?
most important: In the example I showed, the code was span class = "year"
. But in case the code is span class = "year something somethingelse"
does it change something syntactically?