James L.
James L.

Reputation: 1153

python scrapy get value using span=id

I'm trying to get the word "Profession" from this html line:

    <span id="PractitionerDetails1_Label4">Profession:</span>           

I've tried doing this:

sel.css(span[id=PractitionerDetails1_Label4]).extract()

It clearly doesn't work. Please help

Upvotes: 0

Views: 1456

Answers (1)

Pawel Miech
Pawel Miech

Reputation: 7822

You need to use text():

sel.xpath("//span[@id='PractitionerDetails1_Label4']/text()").extract()

Upvotes: 2

Related Questions