rouis
rouis

Reputation: 21

selenium aria-activedescendant multiple select box java

I need to automate the selection for a multidrop down box in selenium. The html code which comprises the dropdown is given below. The html code for each component is taken using firebug.

<input type="text" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" class="select2-input" id="s2id_autogen346" tabindex="-1" placeholder="" style="width: 269px;" aria-activedescendant="select2-result-label-367">

I have the aria-activedescendant="select2-result-label-367" value is changing when i change the select value in the list

enter image description here

enter image description here

Upvotes: 2

Views: 2772

Answers (1)

undetected Selenium
undetected Selenium

Reputation: 193218

As per the HTML you have shared to select the multidrop down box you can use the following line of code :

driver.findElement(By.xpath("//li[@class='select2-search-field']//input[@class='select2-input' and contains(@id,'id_autogen')]")).click();

Upvotes: 1

Related Questions