1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-09 01:58:02 +00:00

Add Select A Select By Selector as a rails til.

This commit is contained in:
jbranchaud
2015-11-30 17:40:56 -06:00
parent 260d3e1432
commit 3dea60fd6f
2 changed files with 18 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
# Select A Select By Selector
Generally when using Capybara to select from a `select` input, I reference it by its `name`
which rails associates with the label:
```ruby
select("Charizard", from: "Pokemon")
```
However, not all forms are going to have a label paired with every `select`
input. We don't want to let our test coverage suffer, so we are going to
need a different way to select. Capybara allows us to chain `select` off a
`find` like so:
```ruby
find('#pokemon_list').select('Charizard')
```