Testing Selenium IDE:意外异常:。。。selenium core/scripts/selenium-browserbot.js,行号->;228

Testing Selenium IDE:意外异常:。。。selenium core/scripts/selenium-browserbot.js,行号->;228,testing,selenium,ide,Testing,Selenium,Ide,我在Firefox14上使用SeleniumIDE1.8.1 我看到这个例外: [error] Unexpected Exception: fileName -> chrome://selenium-ide/content/selenium-core/scripts/selenium-browserbot.js, lineNumber -> 228 运行以下命令时: <tr> <td>assertElementPresent</td>

我在Firefox14上使用SeleniumIDE1.8.1

我看到这个例外:

[error] Unexpected Exception: fileName -> chrome://selenium-ide/content/selenium-core/scripts/selenium-browserbot.js, lineNumber -> 228
运行以下命令时:

<tr>
    <td>assertElementPresent</td>
    <td>//a[text()='! selenium test customer']</td>
    <td></td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>//a[text()='! selenium test customer']</td>
    <td></td>
</tr>

资产负债表
//[text()='!selenium测试客户']
单击并等待
//[text()='!selenium测试客户']
正如您所看到的,元素是存在的(否则断言将无法停止测试),因此我无法找出哪里出了问题。有人找到线索了吗


[编辑]似乎只有当我以最快的速度运行测试时才会出现这种情况。如果我放慢速度,错误就不会发生。但这并不是一个真正的解决方案,因为以半速运行整个套件太慢了。

听起来像是Selenium的一个bug。您归档了吗?

使用Selenium IDE,我发现在clickAndWait调用之前使用waitForElement似乎效果最好

assertElementPresent如果不存在则返回FALSE,如果存在则返回true。它用于if/else构造中,以采用指定的路径


将assertElementPresent替换为waitForElement,您可能会得到更好的结果。

我尝试跟踪对指定代码行的调用,但没有发现明显的失败方式。它似乎被挖得更深/只是偶尔在某个地方出现。我在Selenium bug repository上也没有发现类似的bug,所以我想你能做的最好的事情就是使用你的所有信息(以及一个可复制的测试用例,如果可能的话),并希望它能很快得到修复。如果一两天内没有人真正解决它,你也可以这样做。硒开发人员也在这里,你知道;-)。报告如下,请参见我的回答。我不认为意外异常是来自Selenium的正确响应,但这可能是因为它返回true/false,并且该响应未被处理(至少根据提供的代码片段)。我想waitForElement可能是一个更好的选择,因为我猜您正试图用这个片段来做什么。添加一个等待超时,然后断言。您希望给服务器和DOM处理时间。