如何使用Selenium网络驱动程序从Kendo ComboBox获取价值?
<span class="k-dropdown-wrap k-state-default" unselectable="on">
<span class="k-input ng-scope" unselectable="on">Select Company </span>
<span class="k-select" unselectable="on">
</span>
<span class="k-select" unselectable="on">
<span class="k-icon k-i-Medical-s" unselectable="on">select</span>
</span>
<select class="ng-pristine ng-empty ng-invalid ng-invalid-required ng-touched" name="BigCompany" style="width: 100%; display:none ;" kendo-drop-down-list="" required="" k-option-label="{id: '', value: 'Select Company Type...'}" k-data-source="BigCompany" k-data-value-field="'id'" k-data-text-field="'value'" ng-model="data.companyTypeId" ng-disabled="isCompanyProfile" data-role="dropdownlist">
<option value="" selected="selected">Select Company Type...</option>
<option value="1">prise</option>
</select>
我使用JavaScript进行了努力,但由于传递了值而无法保存,因此字段仍然是必需的。
IJavaScriptExecutor js = driver as IJavaScriptExecutor;
js.ExecuteScript(string.Format("$('[name ={0}]').data('kendoDropDownList').value('{1}')", "BigCompany", "1"));