gpt4 book ai didi

jquery - GEB 获取背景和文本颜色

转载 作者:行者123 更新时间:2023-12-02 14:31:58 26 4
gpt4 key购买 nike

我尝试了 jQuery 和 javascript 方法来获取背景或文本颜色,但我总是在下面得到一个异常。

groovy.lang.MissingMethodException: No signature of method: geb.navigator.NonEmptyNavigator.css() is applicable for argument types: (java.lang.String) values: [background-color]

这是代码

class BrandingPageSpec extends GebReportingSpec {
def "Scenario: Selecting a pre-set colours should preview the changes."() {
expect: "currently at the branding page"
at BrandingPage

and: "advance settings hide successfully"
normalSectionHeader.css("background-color") == "#FFFFFF"

and: "stays at branding page"
at BrandingPage
}
}

class BrandingPage extends Page {

static at = {
waitFor(wait: true) {js."document.readyState" == "complete"}
}

static content = {
normalSectionHeader{$('#section-header')}
}

static url = "http://someDomain:8080/branding"
}
h1{
background-color: #FFFFFF
}
<html>
<body>
<h1 id="section-header" > Hello Word </h1>
</body>
</html>


任何帮助,将不胜感激。谢谢

最佳答案

代替:

normalSectionHeader.css("background-color") == "#FFFFFF"

为了:
normalSectionHeader.jquery.css("background-color") == "#FFFFFF"

仅供引用: http://www.gebish.org/manual/current/javascript.html#jquery_integration

关于jquery - GEB 获取背景和文本颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26036188/

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