首先,我的问题与其他问题不同,因为我有一个kendoUI下拉列表,而不是常规的下拉列表。
我无法在下拉列表中发送密钥
<div _ngcontent-c4="" class="col-xs-8 no-padding-sides ng-star-inserted" style="">
<kendo-dropdownlist _ngcontent-c4="" class="custom-dropdown k-widget k-dropdown k-header ng-pristine ng-invalid ng-touched" formcontrolname="countryId" dir="ltr">
<span role="listbox" unselectable="on" class="k-dropdown-wrap k-state-default" id="k-d0697a91-baeb-4960-bfc1-c023903c1159" dir="ltr" readonly="false" tabindex="0" aria-disabled="false" aria-readonly="false" aria-haspopup="true" aria-expanded="false" aria-owns="dbfc0894-a4f5-4f1b-881f-1d88ccdc6002" aria-activedescendant="f65cbfa2-6280-4a84-908b-ba11da75d59d-undefined">
<span unselectable="on" class="k-input">
<!----><!---->Select Country ...
</span>
<span unselectable="on" class="k-select"><span class="k-i-arrow-s k-icon"></span></span><!---->
</span>
<!----><!---->
</kendo-dropdownlist>
</div>
这就是我正在尝试的:
driver.FindElement(By.XPath("(.//*[normalize-space(text()) and normalize-space(.)='Country:'])[1]/following::span[2]")).SendKeys("UK");
我也尝试过
driver.FindElement(By.XPath("(.//*[normalize-space(text()) and normalize-space(.)='Country:'])[1]/following::span[2]")).SendKeys(Keys.ArrowDown);
我收到此错误:
<span class="k-input"> is not reachable by keyboard