Home > Enterprise >  get text inside elements from class name using scrapy
get text inside elements from class name using scrapy

Time:09-18

How can I get the first text, I mean "Quotes to Scrape", from the following element using class name by scrapy python?

<div class="col-md-8">
                <h1>
                    <a href="/" style="text-decoration: none">Quotes to Scrape</a>
                </h1>
            </div>

Thanks for your time.

CodePudding user response:

The element has no class, but you can get the text like this:

response.css('h1 a::text').get()

CodePudding user response:

Here is a reasonable list of selectors both for css and xpath.enter image description here

  • Related