1

I am having an issue with an element which works with a mouse click and there are some items from which one has to be selected but its unselectable is set to on.

Whenever I try to select the elements I get back an error the element is not visible so may not be interacted with, but the element is visible.

We are using a Kendo UI in there.

The Html code:

<div class="k-multiselect-wrap k-floatwrap" unselectable="on">
<ul id="ProfileEditSharedModel_SelectedIndustrySectorIds_taglist" class="k-reset" unselectable="on" role="listbox">
<li class="k-button" unselectable="on">
<span unselectable="on">Sector 1</span>
<span class="k-icon k-delete" unselectable="on">delete</span>
</li>
</ul>
<input class="k-input" style="width: 25px;" accesskey="" role="listbox" aria-expanded="false" tabindex="0" aria-owns="ProfileEditSharedModel_SelectedIndustrySectorIds_taglist ProfileEditSharedModel_SelectedIndustrySectorIds_listbox" aria-disabled="false" aria-readonly="false" aria-busy="false">
<span class="k-icon k-loading k-loading-hidden"></span>
</div>
<select id="ProfileEditSharedModel_SelectedIndustrySectorIds" class="bigselect" name="ProfileEditSharedModel.SelectedIndustrySectorIds" multiple="multiple" data-val-required="*" data-val="true" data-placeholder="Select Sectors..." data-role="multiselect" style="display: none;" aria-disabled="false" aria-readonly="false">
<option value="1">Sector 1</option>
<option value="2">Sector 2</option>
<option value="3">Sector 3</option>
</select>
Niels van Reijmersdal
32.7k4 gold badges59 silver badges125 bronze badges
asked Apr 22, 2014 at 18:26

2 Answers 2

1

I found a solution using JavascriptExecutor

I can either use this:

((IJavaScriptExecutor)driver).ExecuteScript(String.Format("$('#{0}')
.data('kendoMultiSelect')
.value({1});", "ProfileEditSharedModel_SelectedIndustrySectorIds", 3,));

or

((IJavaScriptExecutor)driver).ExecuteScript(String.Format("$('#ProfileEditSharedModel_SelectedIndustrySectorIds')
.data('kendoMultiSelect')
.value([values]);", "ProfileEditSharedModel_SelectedIndustrySectorIds", 3,));

I was using a kendoMultiSelect there

Niels van Reijmersdal
32.7k4 gold badges59 silver badges125 bronze badges
answered Apr 26, 2014 at 17:47
0

This worked for me.

 public void ResetKendoDropdown(string identifier, string defaultText)
 {
 var kendoElement = _driver.FindElement(By.Id(identifier));
 kendoElement.Click();
 while (kendoElement.FindElement(By.ClassName("k-dropdown-wrap")).Text != defaultText)
 {
 kendoElement.FindElement(By.ClassName("k-dropdown-wrap")).SendKeys(Keys.ArrowUp);
 }
 kendoElement.Click();
 }
answered Mar 11, 2019 at 6:02

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.