Search code examples
pythonweb-scrapingpython-requests-html

How to get last element when scraping with requests_html


I try to scrape something with requests_html. There is several div tag that contains the class name that i want to scrap. I know that you can select just the first element with first=True as it is:

driver.html.find(".company__item-value", first=True)

But how can I do if i only want to select the last element of the class company__item ?

enter image description here


Solution

  • Find all elements and get last one find(...)[-1]