I tried the jQuery and javascript approach to get the background or text color but I always got an Exception below.
groovy.lang.MissingMethodException: No signature of method: geb.navigator.NonEmptyNavigator.css() is applicable for argument types: (java.lang.String) values: [background-color]
Heres the code
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>
Any help would be appreciated. Thanks
Replace:
normalSectionHeader.css("background-color") == "#FFFFFF"
For:
normalSectionHeader.jquery.css("background-color") == "#FFFFFF"
FYI: http://www.gebish.org/manual/current/javascript.html#jquery_integration