This article was published more than 6 months ago,
this means the content may be out of date or no longer relevant.
If you are a PHP developer, you might know Behat, the most popuplar Behavior Driven
Development (BDD) framework for PHP. Personnaly, I frequently annoyed when I have
to write scenario with an UI which is using Select2,
because it's not possilbe to manipulate the field natively with Behat and the Mink
To do this work, you need to create a new Behat context where you will add custom
actions needed to control the Select2 list. Given there is a very few explanations
on the subject, I decide to share the code to do that.
If you are interested by manipulating a Select2 with Behat, please consider this
created and open sourced by my current company. It's can be used with Composer and
provide the most common feature for Select2. It's also available on