【发布时间】:2016-02-17 04:05:54
【问题描述】:
我们的表单上有隐藏的输入字段,我们需要 Selenium 来设置这些字段的值。通过 Selenium IDE 设置隐藏输入值的最佳方法是什么?
【问题讨论】:
标签: html selenium-ide hidden-field
我们的表单上有隐藏的输入字段,我们需要 Selenium 来设置这些字段的值。通过 Selenium IDE 设置隐藏输入值的最佳方法是什么?
【问题讨论】:
标签: html selenium-ide hidden-field
我能找到的最简单的方法:
命令:运行脚本
价值:
javascript{this.browserbot.getCurrentWindow().document.getElementById('hiddenElementId').value='TheValue'}
【讨论】:
$('#hiddenEl').val('foo')
$(function(){// on domready $('#hiddenEl').val('foo');});
聚会迟到了……
当你使用 IDE 时,你可以添加命令 type 与目标 id=yourID 和 value field value,这似乎工作.
复制下方文字粘贴到IDE中试用
<tr>
<td>type</td>
<td>id=yourID</td>
<td>field value</td>
</tr>
这似乎对我有用(Selenium 2.9.1)
【讨论】: