全部!我想在我的测试中上传文件。在Geb-book上写下它是如何制作的,但它对我不起作用。
我有领域:
<input id="bla-bl-bla" type="file" name="foo-foo-foo">
和按钮:
<input type="submit" value="Загрузить файл" name="bar-bar-bar">
我尝试:
def "choose banner format"() {
when: "choose fake format"
$("select", name: Const.namespaceId + "createBanner:j_id83:j_id91")
and: "wait load"
waitFor(25, 2) { $("input", name : Const.namespaceId + "createBanner:upload:j_id256")}
then: "can upload file"
$("input", id : "name") << name_banner
String file_1 = "/full/path/to/file"
String uploadfile = "foo-foo-foo"
$("input").uploadfile = banner
$("input", name : "bar-bar-bar").click()
def createActLink = $("input", name : "save")
createActLink.click()
sleep 20000
}
但我有错误:
Expected a condition, but found an assignment. Did you intend to write '==' ?
Geb:0.9.0-RC-1 Groovy:2.1.1 浏览器:FF 19
谢谢!