【问题标题】:Cannot select a particular dropdown control with Selenium IDE无法使用 Selenium IDE 选择特定的下拉控件
【发布时间】:2015-04-17 22:02:20
【问题描述】:

我在使用 Selenium IDE 选择网页上的特定下拉菜单时遇到了困难。下拉列表的html代码如下:

<tr>
 <td class="lbl">Change Reason:</td>
  <td class="fld">
   <select class="foggy w162px" onchange="setOtherFieldAvailability(this);" name="drpReason">
    <option value="New Information">New Information</option>
    <option selected="selected" value="Changed Data">Changed Data</option>
    <option value="Transcription Error">Transcription Error</option>
    <option value="Other">Other</option>
  </select>
 </td>
</tr>

这个控件的功能非常好。但是 Selenium IDE 似乎无法选择它。 Selenum 命令行如下:

<tr>
    <td>select</td>
    <td>name=drpReason</td>
    <td>value=Other</td>
</tr>

我收到以下错误消息:

[错误] 指定元素不是 Select(没有选项)

然后我尝试使用以下内容验证下拉菜单的文本:

<tr>
    <td>assertText</td>
    <td>name=drpReason</td>
    <td>New Information Changed Data Transcription Error Other</td>
</tr>

我收到以下错误消息:

[错误] 实际值 '' 与 'New Information Changed Data Transcription Error Other' 不匹配

我不明白发生了什么。任何帮助将不胜感激。

伊利亚

【问题讨论】:

  • 尝试使用不选择,而是点击 - clickAt("css=select[name=drpReason] option[value=Other]"); 但是你知道,你应该点击下拉菜单来展开它?

标签: selenium selenium-ide


【解决方案1】:

感谢您的帮助。我们想通了。事实证明,该字段被隐藏了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-04
    • 1970-01-01
    • 1970-01-01
    • 2016-12-31
    相关资源
    最近更新 更多