--- title: "特定の要素が存在しないことをテストする方法 | Autify Guide" slug: "is-it-possible-to-test-the-absence-of-a-specific-element" description: "Autifyを使用して特定の要素が存在しないことをテストする方法について説明します。" tags: ["アサーション"] updated: 2023-08-25T06:37:56Z published: 2023-08-25T06:37:56Z canonical: "help.autify.com/is-it-possible-to-test-the-absence-of-a-specific-element" --- > ## Documentation Index > Fetch the complete documentation index at: https://help.autify.com/llms.txt > Use this file to discover all available pages before exploring further. # 特定の要素がないことをテストできますか? 要素がないことを確認したい場合、いくつか方法があります。 ## 確認したい対象が文字列の場合 アサーション機能でテスト可能です。 [基本的なテキストアサーションにおける 対象のテキストが〇〇を含まないことを確認する](/v1/docs/ja/assertion-elements-on-the-page)をご参照ください。 ## 確認したい対象が文字列を持たない場合 ### 「要素がページ内に存在しないこと」を確認したい場合 「[JSステップ](/v1/docs/ja/javascript-steps)」でテスト可能です。 ``` var selector = ""; //置き換えてください var element = document.querySelector(selector); if (element) { throw new Error('Error: 存在してはいけない要素が存在します (' + selector + ').'); } ```