1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

XPathで指定した要素のうちN番目の要素を指定する方法

Last updated at Posted at 2023-02-15

結論

最初の指定箇所の記述を( )で囲んでから番号を指定する。

例(「ログイン」という文字列が含まれるdivタグを子要素にもつbuttonタグのうち2番目の要素)
(//button[div[contains(text(), "ログイン")]])[2]

単純ですが検索してもなかなか見つからなかったので記事にしました。
お役に立てたら幸いです。

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?