Reputation: 558
Okay, so I've got HTML code like this one:
<span class="lista_td_calendar" rel="1617096300">finished</span>
And I would like to fetch it using lxml, though there are many spans of this class, and each of them has different rel
attribute, and I've written something like this:
from lxml import html
import requests
page = requests.get(link)
tree = html.fromstring(page.content)
series = tree.xpath('//span[@class="lista_td_calendar"]/text()')
print(series)
Though it doesn't fetch anything, is there ayway to make it undependant from rel
argument?
Upvotes: 0
Views: 109
Reputation: 558
Problem is that the value I was trying to reach was generated by javascript so it's unreachable through request module, using selenium solved the problem
from selenium.webdriver.chrome.options import Options
from selenium import webdriver
chrome_options = Options()
chrome_options.add_argument("--headless")
driver = webdriver.Chrome(options=chrome_options)
driver.get('https://blackclover.wbijam.pl/pierwsza_seria-170.html')
elements = driver.find_elements_by_class_name('lista_td_calendar')
Upvotes: 1