A
A
Andrew2021-11-12 14:55:19
XPath
Andrew, 2021-11-12 14:55:19

How to grab link text using css?

How to grab link text using CSS in a construct like this:

<a href=«#» target="_blank»>
 <i class="fas fa-download»>::before</i>
<b>Нужный текст</b>
</a>

if I do - css('a::text').get(), then it gives - '\n\t\t\t\t\t\t\t\t\t\t\t\t\t'
if I do - css('a::text').getall()[1] returns the text of all links on the page...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Sundukov, 2021-11-12
@alekciy

Through CSS, I'm not sure what will happen, but through XPath you can use this expression:

//i[@class="fas fa-download"]/following-sibling::b[1]/text()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question