gpt4 book ai didi

Geb 设置输入值,附加默认值

转载 作者:行者123 更新时间:2023-12-05 01:02:00 25 4
gpt4 key购买 nike

我试图在我的测试中为下面的输入设置一个值,该输入具有默认值

    <input type="text" name="ntsSellAmount" maxlength="7" size="8" tabindex="130" value="0.0">

当我在 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")

有没有办法清除该字段,然后设置覆盖默认值 0.00 的值

最佳答案

根据 section 4.13.5 of the manual ,你做的是对的。

value('foo')应该覆盖,而 <<应该追加。

他们在 4.12 Form Control Shortcuts 部分有一个示例

Interacting with form controls (input, select etc.) is such a common task in web functional testing that Geb provides convenient shortcuts for common functions.Geb supports the following shortcuts for dealing with form controls.Consider the following HTML…
<form>
<input type="text" name="geb" value="testing" />
</form>
The value can be read and written via property notation…
$("form").geb == "testing"
$("form").geb = "goodness"
$("form").geb == "goodness"
These are literally shortcuts for…
$("form").find("input", name: "geb").value() == "testing"
$("form").find("input", name: "geb").value("goodness")
$("form").find("input", name: "geb").value() == "goodness"

考虑到这一点,您是否尝试过:grossExTax.value = 300

关于Geb 设置输入值,附加默认值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25026929/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com