我正在编写脚本以在 JIRA 的下方屏幕中选择和输入值。
<input type="text" autocomplete="off" role="combobox" aria-autocomplete="list" aria-haspopup="true" aria-expanded="false" class="text aui-ss-field ajs-dirty-warning-exempt" id="issuetype-field" aria-controls="issuetype-suggestions">
在为“输入类型”输入值后,其余字段(例如“摘要”)会变灰几秒钟。如果我尝试使用以下代码立即为“摘要”字段输入值:
myDriver.findElement(By.id("summary")).sendKeys(summary);
将不会输入摘要字段,而是会出现错误“缓存中未找到元素 - 也许页面在查找后已更改......”。
“摘要”字段的 HTML 代码是:
<input type="text" value="" name="summary" id="summary" class="text long-field">
所以我想要的只是等待启用“摘要”输入字段,然后向其发送 key 。我正在寻找类似的东西
ExpectedConditions.presenceOfElementLocated
但我想要“enabled”,而不是 presenceOfElementLocated
或 visibilityOfElementLocated
。我也不想使用 Thread.sleep()
。
有什么建议吗?
最佳答案
ExpectedConditions.elementToBeClickable(locator)
怎么样?
elementToBeClickable
检查元素是否启用。
关于html - 如何等待 selenium webdriver 中启用的输入元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32971546/