Css Selectors Knowledgebase

It's not possible to select HTML elements by text in original CSS selectors specification but here are some alternative ways to do it.

To parse HTML using CSS selectors in Python we can use either BeautifulSoup or Parsel packages. Here's how.

To find HTML nodes by class name CSS selectors or XPath can be used. Here's how to do it.


CSS selectors and XPath are both path languages for HTML parsing. Xpath is more powerful but CSS is more approachable - which is one is better?

There are many ways to execute CSS selectors on HTML text in NodeJS but cheerio and osmosis libraries are the most popular ones. Here's how to use them.

To select HTML elements by CSS selectors in Selenium the driver.find_element() method can be used with the By.CSS_SELECTOR option. Here's how to do it.

To find sibling HTML element nodes using BeautifulSoup the find_next_sibling() method can be used or CSS selector ~. Here's how to do it in Python.

To find HTML elements by one of many different element names we can use list of tags in find() methods or CSS selectors. Here's how to do it.

To find HTML node by a specific attribute value in BeautifulSoup the attribute match parameter can be used in the find() methods. Here's how.

To find HTML node by class name using BeautifulSoup the class match parameter can be used using the find() methods. Here's how to do it.

BeautifulSoup is a popular HTML library for Python. It's most popular alternatives are lxml, parsel and html5lib. Here's how they differ from bs4.

Related Blog Posts

Web Scraping With Ruby

Introduction to web scraping with Ruby. How to handle http connections, parse html files for data, best practices, tips and an example project.

Web Scraping With NodeJS and Javascript

In this article we'll take a look at scraping using Javascript through NodeJS. We'll cover common web scraping libraries, frequently encountered challenges and wrap everything up by scraping etsy.com

Parsing HTML with CSS Selectors

Introduction to using CSS selectors to parse web-scraped content. Best practices, available tools and common challenges by interactive examples.