Selenium IDE 找不到元素

Selenium IDE can't find an element

我正在尝试 运行 在 Selenium IDE 中记录测试用例。问题是,当我尝试执行整个测试用例时,Selenium 阻止它在页面上找不到元素。问题是我可以执行测试用例的单个步骤。我认为 Selenium 会在加载新页面之前尝试查找元素,所以我使用了 clickAndWait、pause 和 waitForElementPresent 命令——没有任何效果,Selenium 停止了测试用例。

调试日志

•  [info] Executing: |`clickAndWait` | css=i.fa.fa-arrow-left | | 
•  [debug] Command found, going to execute clickAndWait 
•  [debug] modifyWindow seleniumMarker1429084950752:selenium1429084951105 
•  [debug] _getFrameElement: frameElement=null 
•  [debug] modifySeparateTestWindowToDetectPageLoads: already polling this window: selenium1429084951105 
•  [debug] getCurrentWindow newPageLoaded = false 
•  [error] Element css=i.fa.fa-arrow-left not found 
•  [debug] commandError 
•  [debug] testComplete: failed=true 
•  [info] Test case failed

如果有任何帮助和建议,我将不胜感激。

在某些情况下,'ClickAndWait' 并不可靠,不会等到命令完成后再转到下一个命令。在这种情况下,另一种方法是使用 'Click' 代替,然后使用 'waitForPageToLoad'.

示例...

原创

<tr>
    <td>clickAndWait</td>
    <td>//input[@type='submit']</td>
    <td></td>
</tr>

<tr>
    <td>click</td>
    <td>//input[@type='submit']</td>
    <td></td>
</tr>
<tr>
    <td>waitForPageToLoad</td>
    <td>10000</td>
    <td></td>
</tr>

如果这没有帮助,请post你的源代码,我会看看是否还有其他建议。

通过结合使用 waitForElementPresent、verifyElementPresent 并为 IDE 安装隐式等待插件,我发现这个问题(元素尚未出现)取得了很大成功。 (https://addons.mozilla.org/en-US/firefox/addon/selenium-ide-implicit-wait/)。我现在几乎完全能够从我的测试中删除所有 "pause" 命令。

克伦达图