I am using the Geb framework to automate some browser tasks.
This line of code:
!$("h4", 0, text:"Buildings").isEmpty()
is throwing a groovy.lang.MissingMethodException:
groovy.lang.MissingMethodException: No signature of method: geb.navigator.NonEmptyNavigator.$() is applicable for argument types: (java.util.LinkedHashMap, java.lang.String, java.lang.Integer) values: [[text:Buildings], h4, 0]
Possible solutions: tag(), tag(), any(), eq(int), is(java.lang.String), is(java.lang.String)
The Geb documentation provides an example which should perform the same task as my line:
The following is a concrete example…
$("h1", 2, class: "heading")
This would find the 3rd (elements are 0 indexed) h1 element whose class attribute is exactly
“heading”.
Can anyone shed any light on why my code isn’t working?
There is no such method in the api in which you can specify selector, index and a map of attributes.
You can on the other hand get the result you’re expecting using the following: