--- title: "要素のテキストを取得する" slug: "getting-an-elements-text" updated: 2025-09-30T06:20:24Z published: 2025-09-30T06:20:24Z canonical: "helpcenter.autify.com/getting-an-elements-text" --- > ## Documentation Index > Fetch the complete documentation index at: https://helpcenter.autify.com/llms.txt > Use this file to discover all available pages before exploring further. # 要素のテキストを取得する **Autify Nexus**では、[標準のアサーション](https://helpcenter.autify.com/docs/ja/getting-an-elements-text-to-use-in-later-steps)を利用することで要素のテキストを取得することができるため、可能な限りその機能を使用することをお勧めします。 標準のテキストアサーションでテキストが取得できない場合は、以下の **Playwright** コードスニペットを回避策として使用できます。 ### 設定方法 1. 対象要素のCSSセレクターを取得し、メモしておきます。 2. シナリオに **Playwright**コードステップを挿入し、以下のスニペットをそのステップにコピー&ペーストします。 ```typescript // TODO: Please replace the selector with the one for the target element const selector = ""; // Get the text content of the element // If the element is not found, the test will fail here const text = await page.locator(selector).first().textContent(); return text; ``` 3. 上記スニペット内の `<TODO: REPLACE SELECTOR>` を、ステップ1でメモしたCSSセレクターに置き換えてください。