atom feed7 messages in org.codehaus.geb.userRe: [geb-user] "Best" way to search s...
FromSent OnAttachments
Nathan NeffDec 5, 2010 6:49 pm 
Luke DaleyDec 5, 2010 10:25 pm 
Nathan NeffDec 6, 2010 9:59 am 
Luke DaleyDec 6, 2010 1:06 pm 
Nathan NeffDec 6, 2010 2:50 pm 
Luke DaleyDec 7, 2010 4:42 am 
Nathan NeffDec 7, 2010 7:46 am 
Subject:Re: [geb-user] "Best" way to search siblings' text
From:Luke Daley (
Date:Dec 5, 2010 10:25:57 pm

If siblings doesn't support the text predicate then it's a bug (please raise an

You can always use filter:

assert $("h3.reallynow").siblings("p").filter(text: ~/Dangle/).size() == 1

On 06/12/2010, at 12:49 PM, Nathan Neff <> wrote:


I'm trying to assert that has an <h3 class="reallynow"> with a sibling <p> element that contains "Dangle".

Example: <h3 class="reallynow">Version</h3> <p>0.2 "Dangle"</p>

I tried this at first:

assert $("h3.reallynow").siblings("p", text: ~/Dangle/).size() == 1

But, I mistakenly thought that the "siblings" method would accept "text:", but I think that it takes only attribute matchers.

So, the best I could do was:"") {

assert $("h3.reallynow").siblings("p").find { it.text() =~ /Dangle/ }


Is this the most succinct query that I can come up with?

If anyone has a better way, then please let me know.