Working with Select2
Learn how to work with Select2 using Selenium.
We'll cover the following...
Select2: Single Select
Select2 is a popular JQuery plug-in that makes long select lists user-friendly. It turns the standard HTML select list box into:
The HTML code for this, however, is not much different from the standard select list, except the addition of the class="select2"
tag.
Press + to interact
<select id="country_single" data-placeholder="Choose a Country..." class="select2"><option value=""></option><option value="United States">United States</option><option value="United Kingdom">United Kingdom</option><option value="Australia">Australia</option></select>
By using the class as the identification, the JavaScript included on the page generates the following HTML fragment (beneath the select element). ...