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:58 am 
Luke DaleyDec 6, 2010 1:05 pm 
Nathan NeffDec 6, 2010 2:49 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 (ld@ldaley.com)
Date:Dec 5, 2010 10:25:34 pm
List:org.codehaus.geb.user

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

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 <nath@gmail.com> wrote:

Hello,

I'm trying to assert that http://enrollio.org 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:

Browser.drive("http://enrollio.org") {

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.