以下是我的页面和规格。我可以输入 的值,firstName
但我收到以下错误lastName
。我认为我们可以在这里http://www.gebish.org/manual/current/navigator.html#text_inputs_and_textareas使用基于 Geb doc 的 '=' 运算符来分配值
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
}