Hi,
In our application, we are using bootstrap multiselect dropdowns provided by GitHub. It generates html in ul/li format like below.
<
ul
class
=
"multiselect-container dropdown-menu"
>
<
li
class
=
"multiselect-item filter"
value
=
"0"
><
div
class
=
"input-group"
><
span
class
=
"input-group-addon"
><
i
class
=
"glyphicon glyphicon-search"
></
i
></
span
><
input
class
=
"multiselect-search"
type
=
"text"
placeholder
=
"Search"
></
div
></
li
>
<
li
class
=
"multiselect-item multiselect-all"
><
a
href
=
"javascript:void(0);"
class
=
"multiselect-all"
><
label
class
=
"checkbox"
><
input
type
=
"checkbox"
name
=
"multiselect"
value
=
"multiselect-all"
> Select All</
label
></
a
></
li
>
<
li
><
a
href
=
"javascript:void(0);"
><
label
class
=
"checkbox"
><
input
type
=
"checkbox"
name
=
"multiselect"
value
=
"Option 1"
> Option 1</
label
></
a
></
li
>
<
li
><
a
href
=
"javascript:void(0);"
><
label
class
=
"checkbox"
><
input
type
=
"checkbox"
name
=
"multiselect"
value
=
"Option 2"
> Option 2</
label
></
a
></
li
>
<
li
><
a
href
=
"javascript:void(0);"
><
label
class
=
"checkbox"
><
input
type
=
"checkbox"
name
=
"multiselect"
value
=
"Option 3"
> Option 3</
label
></
a
></
li
>
<
li
><
a
href
=
"javascript:void(0);"
><
label
class
=
"checkbox"
><
input
type
=
"checkbox"
name
=
"multiselect"
value
=
"Option 12"
> Option 12</
label
></
a
></
li
>
</
ul
>
Here I am trying to select "Option 3" using below code but it is not working. It performs click action but doesn't select value from dropdown. There are no change events bind for these dropdowns.
IList<​HtmlListItem> List = Pages.TestPage.DropdownDiv.Find.AllByTagName<HtmlListItem>(
"li"
);
foreach
(HtmlListItem item
in
List)
{
if
(item.InnerText.Contains(
"Option 3"
));
{
Log.WriteLine(
"In!"
);
item.​Click(
);
break
;
}
}
Can anyone help me to resolve this ?
Thanks,
Chandresh