# For

此按钮允许您选择循环类型：数据、元素、或在脚本中重复特定操作或处理特定次数。

## For Data

<figure><img src="/files/lyjNuEDzr6pD7CoYH0OE" alt=""><figcaption></figcaption></figure>

<table><thead><tr><th width="258">参数</th><th>说明</th></tr></thead><tbody><tr><td>For from value</td><td>输入数值或选择包含有效值的变量</td></tr><tr><td>For to value</td><td>输入数值或选择包含有效值的变量</td></tr></tbody></table>

For to value 的值必须大于 For from value 的值

{% file src="/files/CHREfPgc4Di8lPC3276Y" %}

## For Elements

您可以输入要循环的元素的 CSS 选择器。您可以选择在每个循环中提取的内容并将其保存到变量中。

<figure><img src="/files/JiAeORtwvWrYCmLe7mFW" alt=""><figcaption></figcaption></figure>

**Selector element**：输入CSS选择器，例如#email、\[data-results-grid-container]>li

**Content**：选择提取类型，包括：

* Text：提取您选择的元素的文本
* HTML：提取您选择的元素的 HTML
* Attribute：提取元素的属性，输入要提取的属性。

**Loop object save to**：将每次循环提取的网页元素保存为变量。

**Loop index save to**：将每次循环中提取的网页元素的位置保存到变量中。请注意，循环中网页元素的位置（索引）从 0 开始。

{% file src="/files/wZZAZC0VXVaHWEYOxHLZ" %}

## For Times

当选择For Times时，您可以输入您想要的迭代次数。

<figure><img src="/files/ie3BiuSR8pfSri4KesuV" alt=""><figcaption></figcaption></figure>

<table><thead><tr><th width="258">参数</th><th>说明</th></tr></thead><tbody><tr><td>Times</td><td>输入所需的迭代次数，最多 99。</td></tr><tr><td>Loop index save to</td><td>将每次循环中提取的网页元素的位置保存到变量中。注意循环中网页元素的位置（索引）从1开始。</td></tr></tbody></table>

{% file src="/files/mvYBoILfsXyUUppNd3ti" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hidemium.io/zi-dong-hua-yong-hu-shou-ce/qi-ta-other/for.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
