How do you select a dropdown option with marionette?
In some cases, I've been successful by using element-type! to type the value, but that doesn't work in some cases. In particular, if there are key handling listeners on the dropdown e.g. for an enhanced dropdown.
Is there a more direct way to select an option?
Ok, I think I found a way to do this. Use a css selector to target a particular <option> and click it:
(element-click! (page-query-selector!
page
"#history_address__state option[value=\"NC\"]"))
I think part of my issue is the dynamic nature of some of the <select> elements I have i.e. fetching data from the server after another <select> is chosen.