bottlenecked
Wallaby: how to interact with select boxes
Hi all, does anyone have any tips on how to best interact with <select> elements? After some experimentation I managed to get my test working by sending keys to the element but not by clicking
# this worked
session
|> send_keys(Query.select("List"), ["Option name"])
# this didn't
session
# note: after the following click a take_screenshot shows that the options do not appear open
|> click(Query.css("select"))
|> click(Query.option("Option name")
Sending keys is not how most users interact with the select boxes, so I’d be interested in learning about alternative approaches.
Marked As Solved
mhanberg
Clicking the option tag is generally how I do it. (Only the option, no need to click the select)
One thing to consider is anther you’re working with a native select element or a JS drop down widget (that probably reimplements it all using other elements).
Also Liked
dblack
Forgive me for resurrecting this old thread!
I’m a massive Wallaby newb and was struggling with selects. I was thankful for the solution here but just wanted to add how I limited the scope to selecting an option in a specific select. Probably dead simple if you know how, but took me a bit of figuring out, and might help the next newb who finds this!
session
|> find(Query.select("Some select"), fn select ->
click(select, Query.option("Some option"))
end)
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








