For the following element on the web
<span title="点赞数14332" class="like"><!----><!----><!----><!----><!----><i class="van-icon-videodetails_like" style="color:;"></i>1.4万
</span>
<span title="number" class="like">
<!---->
<!---->
<!---->
<!---->
<!---->
<i class="van-icon-videodetails_like" style="color:;"></i>
"121.6"
</span>
What I want to get is the number "121.6". I tried,
likes = driver.find_elements_by_xpath('//span[@class="like"]')[0].text
It returns me "--", and nothing else.
I also tried to copy the X-path from the inspection,
likes = driver.find_elements_by_xpath('//*[@id="arc_toolbar_report"]/div[1]/span[1]/text()')
But selenium returns me:
selenium.common.exceptions.InvalidSelectorException: Message: invalid selector: The result of the xpath expression "//*[@id="arc_toolbar_report"]/div[1]/span[1]/text()" is: [object Text]. It should be an element.
What should I do to get the number "121.6"?