我正在编写脚本来在 JIRA 的下面屏幕中选择并输入值。
The 'issue type' is an 'input' element with autocomplete property:
<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">
So 我想要的只是等待“摘要”输入字段被启用然后发送密钥给它。我正在寻找类似的东西
ExpectedConditions.presenceOfElementLocated
但我想要'enabled', not presenceOfElementLocated
or visibilityOfElementLocated
。我不想使用Thread.sleep()
either.
有什么建议么?
怎么样ExpectedConditions.elementToBeClickable(locator)
?
elementToBeClickable
检查该元素是否已启用。
https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/support/ui/ExpectedConditions.html#elementToBeClickable-org.openqa.selenium.By- https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/support/ui/ExpectedConditions.html#elementToBeClickable-org.openqa.selenium.By-
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)