我尝试了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>
&#13;
任何帮助将不胜感激。感谢
答案 0 :(得分:2)
替换:
normalSectionHeader.css("background-color") == "#FFFFFF"
有关:
normalSectionHeader.jquery.css("background-color") == "#FFFFFF"
仅供参考:http://www.gebish.org/manual/current/javascript.html#jquery_integration
答案 1 :(得分:0)
Navigator.css(String)
方法,目前仅在0.9.4-SNAPSHOT中提供。
您需要使用@jripoll建议的快照或变通方法。