> For the complete documentation index, see [llms.txt](https://help.autify.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.autify.com/nocode-web/autify-university/foundation/creating-a-scenario/select-from-list-by-label.md). Agents can also search and read this documentation through its [MCP server](https://help.autify.com/~gitbook/mcp).

# リストから値を選択する

## リストから値を選択するステップ

`<select>`要素で実装されたリストから値を選択する操作をレコーディングすると、「リストから〜を選択する」ステップが作成されます。

![](https://50135409-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fof7cb8AGXhWvWThq3R0w%2Fuploads%2Fgit-blob-d18e2e44e88f913bcb6146017ed0800b78f0aac5%2Fja_select_from_list.png?alt=media)

{% hint style="info" %}
**`<select>`要素以外で実装されたリスト**

`<select>`要素以外で実装されたリストから値を選択する操作をレコーディングすると、通常は選択肢を開くためのクリックと選択肢を選択するためのクリックの2つのクリックがレコーディングされます。
{% endhint %}

### 検索対象

テスト実行時は「リストから〜を選択する」ステップのラベルに設定されている値で、リスト内の選択肢を検索し、ラベルに設定されている値を持つ選択肢を選択します。

![](https://50135409-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fof7cb8AGXhWvWThq3R0w%2Fuploads%2Fgit-blob-efc4920177152e30ecc742d598df99e53564459d%2Fja-label-list.png?alt=media)

検索対象はoptionタグで囲まれた値(`<option>この文字列</option>`)です。`<option label="1" value="1"></option>`のように、optionタグに囲まれた値がない選択肢は現状サポートしていません。

{% hint style="warning" %}
**ラベル指定以外の選択はサポートしていません**

現状「リストから〜を選択する」ステップでは、

* 選択肢のN番目を選択する
  * [「要素に対するJSステップ」と組み合わせて「選択肢のN番目を選択する」方法](https://help.autify.com/nocode-web/tips-1/select-box-tips/select-the-nth-of-options.md)
* 「〜」を含む選択肢を選択する
* 「〜」から始まる選択肢を選択する

など、ラベル完全一致以外の方法で選択肢を選択することができません。
{% endhint %}

### ステップがレコーディングされない場合

Autifyレコーダーは、値が変更されたこと（選択肢が変わったことなど）を検知してステップを記録するため、既に選択されている値を選択し直しても、「リストから〜を選択する」ステップはレコーディングされません。 別の選択肢を選択してから、希望の値を選択し直すことでステップのレコーディングが可能です。その後に、不要なステップを削除してください。

### 値がレコーディングされない場合

現状`<option label="1" value="1"></option>`のように、optionタグに囲まれた値がない選択肢はサポートしていないため、この形式の選択肢の選択をレコーディングした場合、値がレコーディングされず、「リストから〜を選択する」の「〜」の部分が空白になります。

シナリオ編集画面で値を後から入力すると、ローカルリプレイではうまく動作しますが、テスト実行では選択肢が見つからずテストが失敗します。

{% hint style="warning" %}
**ローカルリプレイとテスト実行の違い**

ローカルリプレイはシナリオ更新を助けるための機能で、テスト実行とは挙動が違う場合があります。これはその違いの一つです。詳しくは [**ここにレコーディング (ローカルリプレイ) - 3. ローカルリプレイとテスト実行の違い**](https://help.autify.com/nocode-web/autify-university/foundation/creating-a-scenario/local-replay.md#the-difference-between-local-replay-and-test-execution) をご覧ください。
{% endhint %}

### ロケータを設定する

[ロケータ](https://help.autify.com/nocode-web/autify-university/advanced/locator-feature/add-a-locator.md)を設定するときは、選択する`<option>`要素ではなく`<select>`要素のCSSセレクター/XPathを指定してください。`<select>`要素以外のCSSセレクター/XPathを指定した場合は、ローカルリプレイ・テスト実行が失敗します。 なお、ロケータに選択したい選択肢のCSSセレクター/XPathを指定しても、その選択肢を選択するといった動きにはなりませんのでご注意ください。

## 複数選択が可能なリスト

multiple属性が指定されているリストは、複数の選択肢を選択することが可能です。複数選択可能なリストで、選択肢を切り替える操作をした場合は、「リストから〜の選択を解除する」と「リストから〜を選択する」の2つのステップが作成されます。

選択肢から **1** を選択した後に、**2** を選択した場合は以下のようにステップがレコーディングされます。

![](https://50135409-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fof7cb8AGXhWvWThq3R0w%2Fuploads%2Fgit-blob-dcc9bf2541af151563611a20464a963df00ee14d%2Fja-select-multiple.png?alt=media)

**1** を選択した後に、shiftやctrl (cmd)を押したまま **2** を選択した場合は、「リストから〜の選択を解除する」ステップはレコーディングされません。

![](https://50135409-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fof7cb8AGXhWvWThq3R0w%2Fuploads%2Fgit-blob-92e19484e7a8174f21e7f3e3a651f8cdf2e9f9a1%2Fja-select-multiple-shift.png?alt=media)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.autify.com/nocode-web/autify-university/foundation/creating-a-scenario/select-from-list-by-label.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
