2014-09-25 112 views
1

我嘗試了jQuery和JavaScript方法來獲取背景或文本顏色,但我總是得到下面的異常。GEB獲取背景和文本顏色

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>

任何幫助,將不勝感激。由於

+0

你想在jquery中獲得'h1'的'background-color'嗎? – 2014-09-25 10:28:40

回答

0

Navigator.css(String)方法是剛加入,僅在此刻0.9.4-SNAPSHOT可用。

您需要使用快照或@jripoll建議的解決方法。