以下是我的页面和规范。我可以输入firstName
的值,但我收到了以下lastName
的错误。我想我们可以在这里使用基于Geb文档的"="运算符来赋值http://www.gebish.org/manual/current/navigator.html#text_inputs_and_textareas
geb.error.UnresolvablePropertyException: Unable to resolve lastName as a property to set on NewConsumerApplicationPage's Navigator context
at geb.content.NavigableSupport.propertyMissing(NavigableSupport.groovy:141)
at geb.Browser.propertyMissing(Browser.groovy:182)
at geb.spock.GebSpec.propertyMissing(GebSpec.groovy:59)
at WorkItemSpec.Create workitem(WorkItemSpec.groovy:32)
页面
class NewConsumerApplicationPage extends Page
{static content =
{
newApplicationForm
{ $("form", id: "newApplicationConsumerForm") }
firstName
{newApplicationForm.find("input", id: "newApplication_primaryApplicant:consumerIdentification:firstName")}
lastName
{newApplicationForm.find("input", id: "newApplication_primaryApplicant:consumerIdentification:lastName")}
submitButton
{
$("button", id: "newConsumerApplication_submit")
}
}
}
规格
def "Create workitem"()
{
given : "I am successfully logged into the application"
to NewConsumerApplicationPage
when:
firstName.value "CCERASTOSTIGMA"
lastName = "PAULA"
submitButton.click()
then :
at ApplicationSummaryPage
}
我从Geb邮件列表中得到了答案。张贴在这里是为了大家的利益。
这有点令人困惑,但本手册的这一部分是"表单控件快捷方式",即仅适用于表单内容要素假设您的表单具有name=lastName
输入元素,则会起作用:
newApplicationForm.lastName = 'value'
但是,当手动选择使用CCD_ 4。