Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ajax Selenium IDE脚本在页面上找不到第二个select元素_Ajax_Selenium_Automation_Browser Automation - Fatal编程技术网

Ajax Selenium IDE脚本在页面上找不到第二个select元素

Ajax Selenium IDE脚本在页面上找不到第二个select元素,ajax,selenium,automation,browser-automation,Ajax,Selenium,Automation,Browser Automation,我正在测试一个Ajax应用程序,并在Firefox17的SeleniumIDE1.9.1中录制了一个脚本。它通常是有效的,但在某些时候会挂断。我遇到的一个问题是,脚本正确地从选择元素下拉列表中找到并选择了正确的选项。在这个元素的正下方还有另一个select元素,出于某种原因,Selenium表示它找不到该元素,即使它清楚地存在并且名称正确 代码如下: <tr> <td>select</td> <td>id=answerChoice7

我正在测试一个Ajax应用程序,并在Firefox17的SeleniumIDE1.9.1中录制了一个脚本。它通常是有效的,但在某些时候会挂断。我遇到的一个问题是,脚本正确地从选择元素下拉列表中找到并选择了正确的选项。在这个元素的正下方还有另一个select元素,出于某种原因,Selenium表示它找不到该元素,即使它清楚地存在并且名称正确

代码如下:

<tr>
    <td>select</td>
    <td>id=answerChoice7_8</td>
    <td>label=Massachusetts</td>
</tr>
<tr>
    <td>select</td>
    <td>id=answerChoice7_9</td>
    <td>label=Boston University - Boston</td>
</tr>
第一个选择工作正常,但由于某些原因,当它尝试选择第二个时,我得到以下错误:Element id=answerChoice7\u 9 not found。我用Firebug检查元素名,它肯定是正确的


谢谢。

Selenium经常出现计时问题。因为这两个元素之间没有页面加载,所以selenium不知道等待元素出现。我想有一个waitForElementPresent命令。试试看

在选择之前添加一个命令waitForElementPresentid=answerChoice7\u 9。它应该会起作用

您的html元素有名称吗?
如果它有一个名称,那么命令name=answerChoice7_9

Selenium IDE实际上只是一个很好的教学工具。您可能希望将Selenium与编程语言结合使用,因为IDE非常有限。