> For the complete documentation index, see [llms.txt](https://docs.flowstem.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flowstem.app/commands/data-extraction.md).

# Data extraction

Data extraction commands save page information into variables for later commands. Variable names begin with `$`.

## Text

Gets the readable text from the first matching element.

* **Configure:** Element selector, output variable, visibility requirement, and whether to return a blank value when no element is found.
* **Output:** A text variable such as `$element_text`.
* **Example:** Save a product price to `$price`.

## Link URL

Gets the destination address from the first matching link.

* **Configure:** Link selector, output variable, visibility requirement, and missing-element behavior.
* **Output:** The link's resolved URL.
* **Example:** Save a profile link to `$profile_url`.

## Page URL

Gets the complete URL of the current automation tab.

* **Configure:** Output variable.
* **Output:** A URL such as `https://example.com/results?page=2`.
* **Example:** Record the final page after a redirect.

## Page Title

Gets the browser title of the current page.

* **Configure:** Output variable.
* **Output:** The current document title.
* **Example:** Save the title for a report or validation step.

## Element Count

Counts all elements matching a selector.

* **Configure:** Element selector and output variable.
* **Output:** A number stored in the selected variable.
* **Example:** Count the number of result cards and use Assert to confirm results exist.

## Element Attribute

Gets one HTML attribute from the first matching element.

* **Configure:** Element selector, attribute name, output variable, visibility requirement, and missing-element behavior.
* **Output:** The attribute value, such as `href`, `src`, `data-id`, or `aria-label`.
* **Example:** Save a row's `data-customer-id` attribute to `$customer_id`.

## Element HTML

Gets the HTML inside the first matching element.

* **Configure:** Element selector, output variable, visibility requirement, and missing-element behavior.
* **Output:** An HTML string.
* **Example:** Capture a formatted description for later parsing.

{% hint style="info" %}
Use **Text** when you need readable content. Use **Element HTML** only when the markup itself is important.
{% endhint %}

## Save File

Downloads a file from a page element or a direct URL.

* **Configure:** Source type, element selector or URL, destination, optional file name, output variable, and visibility requirement when using an element.
* **Destinations:** Save locally or upload to the connected Google Drive account.
* **Output:** The local saved path or Google Drive link.
* **Example:** Download an invoice link and store its location in `$invoice_file`.

Google Drive must be connected before using it as the destination.
