C# web scraping with HtmlAgilityPack [closed]

I want to create application in WPF wchich will scrape information from webpage

I read link to the page from text box at the top

I want to extract company name from h6

I don’t understand that format:”//h2[@class=’card__title mdc-typography–headline6′]”. I could’t find documentation abot meaning @ [] etc. to create another filters to scrape other data for example phone number from tag.

Answer

The @, //, ... represent abbreviated syntax for XPath selectors.

  • @abc is short for attribute::abc
  • // is short for /descendant-or-self::node()/

So, in other terms, your current query //h2[@class='card__title mdc-typography--headline6'] represents the action of finding the first descendant- or self-node that has a class attribute of card__title mdc-typography--headline6.

Leave a Reply

Your email address will not be published. Required fields are marked *