0
0

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.

Capybara で select2 項目を選択する

Posted at

select2 のテストについて
Capybara で、ある項目を選択したい時のメモ

普通の select と同じようにやると上手くいかない

select([option ], from: [label ])
=>
Capybara::ElementNotFound:
  Unable to find select box [label ] that is not disabled and Unable to find input box with datalist completion [label ] that is not disabled

タグ構造が変わっているから :thinking:

同じように質問している人がいる
へー、Gem もあるのか(割と最近も更新されている)

手軽にやるなら、とりあえず愚直にやれば OK(他にも方法あるみたいだけど)

find("option[value=[対象の option 値]]").select_option
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?