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>
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

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();
    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.