- [[el-select]]には[[data-testid]]を割り当てる - 要素は`.el-select-dropdown`の子孫にあるため、`:has-text(string)`を使う ```ts const itemName = "hoge"; // 選択肢を表示するためにクリック await this.page.click("data-test-id=selector"); await this.page.click(`.el-select-dropdown:has-text("${itemName}")`); ``` ==2つ以上の[[el-select]]が存在する場合、この方法ではドロップダウンの選択肢指定がうまくいかない。==以下のようにする必要がある。 ```ts // 選択肢を表示するためにクリック await this.page.click("data-test-id=selector"); await this.page .locator(`.el-select-dropdown:right-of(:text("動物"))`) // 動物というラベルの右側にセレクタ .locator(`text=dog >> nth=2`) // dogを含む3つ目の選択肢を指定する場合 .click(); ``` もしくは ```ts // 選択肢を表示するためにクリック await this.page.click("data-test-id=selector"); await this.page .locator(`.el-select-dropdown:right-of(:text("動物")) >> li`) // 動物というラベルの右側にセレクタ .nth(2) // 3つ目の選択肢を指定する場合 .click(); ```