selenium chromedriver抛出元素在有输入框占位符时被拦截

fkaflof6  于 2021-07-06  发布在  Java
关注(0)|答案(0)|浏览(217)

我有一个输入框,其html结构如下所示。

我使用下面的xpath通过selenium单击元素。

//input[@class='Select-input']

尽管这个xpath只匹配输入元素而不匹配占位符,但是当尝试单击时,SeleniumChrome驱动程序抛出以下异常。

Caused by: org.openqa.selenium.WebDriverException: element click intercepted: Element <input aria-activedescendant="react-select-2--value" aria-expanded="false" aria-haspopup="false" aria-owns="" class="Select-input" role="combobox" value=""> is not clickable at point (519, 348). Other element would receive the click: <div class="Select-placeholder">...</div>

(会话信息:chrome=87.0.4280.88)
我试着等待元素被点击,还尝试了以下操作。

JavascriptExecutor executor = (JavascriptExecutor)driver;
    executor.executeScript("arguments[0].click();", searchField);

他们两个都没帮上忙。在此方面如有任何帮助/建议,将不胜感激。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题