如何从selenium向剑道multiselect发送多个值
本文关键字:multiselect selenium | 更新日期: 2023-09-27 18:00:03
我想向Kendo Multiselect
元素发送多个值。每当我使用以下功能时
((IJavaScriptExecutor)driver).ExecuteScript(String.Format("$('# {0}').data('kendoMultiSelect').value({1});", "TagName", "Value"));
如果我尝试发送另一个值,我只能发送一次值。第一个值被删除,即每当我尝试发送新值时,旧值就会被删除。Html代码:-
<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>
您可以在值方法中发送数组
((IJavaScriptExecutor)driver).ExecuteScript(String.Format("$('# {0}').data('kendoMultiSelect').value([1,2,3]);", "TagName", "Value"));