Selecting values
Each field picks elements on the page and returns a value for them. Pick them with CSS or XPath, then choose what to read: the text, an attribute, the HTML or Markdown.
All examples use the demo product page, /demo/product.
CSS selectors
The default. A string is a CSS selector, and { "selector": "…" } is the same field with room for options:
Actions
Data
See Fields for multiple and comma-separated selectors.
XPath
xpath instead of selector, for what CSS can't express: an element by its text, its siblings, its parent:
Actions
Data
XPath can return elements, attributes (//a/@href), text or numbers (count(…)); all become values the same way.
Attributes and URLs
attribute reads an attribute instead of the text:
Actions
Data
URL attributes (href, src, action, poster…) are made absolute against the page's final address (or its <base>), so they work as they are, for example as the target_url of a next step. "absolute": false keeps them as written.
HTML and Markdown
output changes what's read from each element:
output | Value |
|---|---|
"text" | The text, whitespace collapsed. The default |
"html" | The element's HTML, tags included |
"markdown" | The element as Markdown: headings, lists, links (absolute), bold, tables |
"table" | A table's rows, see Lists & tables |
Actions
Data
Text values are capped at 10,000 characters; html and markdown at 200,000.
Field options
| Property | Type | Description |
|---|---|---|
selector | string | CSS selector |
xpath | string | XPath expression, instead of selector |
attribute | string | Read this attribute instead of the text |
absolute | boolean | URL attributes made absolute. Default true |
output | string | text, html, markdown or table |
multiple | boolean | Every match, as an array |
transform | array | Convert the values: numbers, prices, dates… See Transforms |
items | fields | A list of objects, see Lists & tables |
extract | string | Page-level data instead of a selector, see Page data |