Phil BakerFront-end developer

Changing a select value programmatically

18 January 2019

I ran into an issue recently where I needed an E2E test to choose an option from a select element and submit a form. This seems like a fairly easy thing to do but changing the the selected item with JavaScript did not work.

It turns out that the change event needs to be dispatched after the value is changed. Here’s an example.


GithubCodepenMastodon