gpt4 book ai didi

testing - geb.error.RequiredPageContentNotPresent : The required page content 'loginButton is not present

转载 作者:行者123 更新时间:2023-11-28 21:28:23 28 4
gpt4 key购买 nike

您好,我在尝试启动测试时遇到了这个错误。

请帮我看看为什么它不能点击我的提交按钮

geb.error.RequiredPageContentNotPresent: The required page content 'loginButton - SimplePageContent (owner: LoginPage, args: [], value: null)' is not present

在我的登录页面下方

import geb.Page
import pages.IndexPage

class LoginPage extends Page {

static url = "login/auth"

static at = { title == "[Paynum] Identification" }

static content = {
loginForm { $("form") }
loginButton { $("input", type: "submit") }
}
}

在我的测试页下面

import geb.spock.GebReportingSpec
import pages.*
import spock.lang.Stepwise

@Stepwise
class FactControllerSpec extends GebReportingSpec {

def "invalid login"() {
given: "I am at the login page"
to LoginPage

when: "I am entering invalid password"
loginForm.j_username = "bba"
loginForm.j_password = "Bocxy1990"
loginButton.click()

then: "I am being redirected to the login page, the password I entered is wrong"
at LoginPage
loginForm.j_username == "bba"
!loginButton.j_password
}
}

这是我的提交按钮的片段

<div>
<button id='submit' type='submit'>
<em class='fa fa-sign-in fa-lg'></em>
<g:message code='springSecurity.login.button' />
</button>
</div>

最佳答案

loginButton { $("input", type: "submit") }

应该是

loginButton { $("button", type: "submit") } 或者可能更好

loginButton { $("button#submit") } 这意味着给我找到一个 ID 等于提交的按钮。

关于testing - geb.error.RequiredPageContentNotPresent : The required page content 'loginButton is not present,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32697366/

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