Skip to main content

SeleniumBase for Rust supports three primary ways to express automation: direct API calls in Rust, CLI commands, and JSON-based scenarios. This page compares the formats and links to deeper guides.

Info

What you will learn

  • How the same action looks in each format.
  • How selectors are represented across formats.
  • When to choose one format over another.

The formats#

The most flexible format. Use it for production tests and complex logic.

The pure CDP engine has its own API, in which the selector lives in a Locator instead of being passed to every call:

Selector syntax#

SeleniumBase accepts multiple selector formats. See the Selectors Guide for details.

FormatExample
CSS#my-button
XPath//button[@id='my-button']
Link textlink=Sign in
Partial link textpartial_link=Privacy
Shadow DOMmy-app ::shadow button

A selector beginning with /, ./ or ( (or an XPath axis such as parent::) is XPath, the link=, link_text= and text= prefixes mean link text, and the partial_link=, partial_link_text= and partial_text= prefixes mean partial link text; anything else is CSS.

Choosing a format#

Use caseRecommended format
Production regression testsDirect API
CI smoke checksCLI or JSON scenarios
Prototyping / demosRecorder → Rust or JSON
Non-developer authorsJSON scenarios

Next steps#