Python Forum
Get the attributes value with xPath
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get the attributes value with xPath
#1
Hello everyone,

I would like to get the value from the data-score attribute within the <span>-element.
<span class="index__stars__2ads4 index__large__1Ez3-" data-fillcolor="butterscotch" data-score="2.5"></span>

The following line returns an empty list:
score = tree.xpath('//span[@class="index__stars__2ads4 index__large__1Ez3-"]//data-score/text()')
What am I doing wrong here? Rolleyes

Greetings
Reply


Messages In This Thread
Get the attributes value with xPath - by vulturas - May-22-2022, 05:28 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  need help with xpath pythonprogrammer 1 2,889 Jan-18-2020, 11:28 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020