我试图在我的测试中将值设置为下面的输入,该输入具有默认值
<input type="text" name="ntsSellAmount" maxlength="7" size="8" tabindex="130" value="0.0">
Run Code Online (Sandbox Code Playgroud)
当我在Geb页面中设置值时,它会被附加到默认值0.00300:
grossExTax {
$("#content > form:nth-child(3) > fieldset:nth-child(8) > table:nth-child(3) > tbody:nth-child(1) > tr:nth-child(10) > td:nth-child(2) > input:nth-child(1)")
}
grossExTax.value("300")
Run Code Online (Sandbox Code Playgroud)
有没有办法清除该字段,然后设置值覆盖默认值0.00
根据手册第4.13.5节,你所做的是对的.
value('foo')应该覆盖,同时<<应该追加.
他们在4.12表单控件快捷方式中有一个示例
与表单控件交互(输入,选择等)是Web功能测试中的常见任务,Geb为常见功能提供了方便的快捷方式.Geb支持以下用于处理表单控件的快捷方式.考虑以下HTML ...<form> <input type="text" name="geb" value="testing" /> </form>可以通过属性表示法读取和写入值...$("form").geb == "testing" $("form").geb = "goodness" $("form").geb == "goodness"这些是字面上的快捷方式...$("form").find("input", name: "geb").value() == "testing" $("form").find("input", name: "geb").value("goodness") $("form").find("input", name: "geb").value() == "goodness"
考虑到这一点,你试过了grossExTax.value = 300吗?
| 归档时间: |
|
| 查看次数: |
4590 次 |
| 最近记录: |