简体   繁体   中英

unable to click the kendo dropdown in selenium webdriver

Here is my selenium code:

WebDriverWait fee = new WebDriverWait(driver, 10);
fee.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//span[text()='select']")));
fee.until(ExpectedConditions.elementToBeClickable(By.xpath("//span[text()='select']"))).click();

Here is my HTML code:

<span title="" class="k-widget k-dropdown k-header" unselectable="on" role="listbox" aria-haspopup="true" aria-expanded="false" tabindex="0" aria-owns="ddlSaleItem_listbox" aria-disabled="false" aria-readonly="false" aria-busy="false" aria-activedescendant="e30bc773-2592-40f2-aa5f-38850a538cd6"
  style="width: 115%;">
  <span unselectable="on" class="k-dropdown-wrap k-state-default">
  <span unselectable="on" class="k-input"></span>
<span unselectable="on" class="k-select">
  <span unselectable="on" class="k-icon k-i-arrow-s">select</span></span>
</span>
<div id="ddlSaleItem" data-id="" style="width: 115%; display: none;" data-role="dropdownlist"></div>
</span>

I'm getting this kind of error message:

Exception in thread "main" org.openqa.selenium.ElementClickInterceptedException: 
element click intercepted: Element <span un...able="on" class="k-icon k-i-arrow-s">
select</span> is not clickable at point (402, 143). Other element would receive the 
click: <div class="k-overlay" style="display: block; z-index: 10002; opacity: 0.5; 
transition: all 350ms ease-out 0s;"></div>

You can click on the element using JavaScriptExecutor click method.
You can use it like:

WebElement element = driver.findElement(By.xpath("//span[text()='select']"));
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click();", element);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM