I would be interested in collecting statistics on what are the most upvoted questions on SO. Using Geb, I tried to extract the relevant HTML:
@Integration
class PlayTestsSpec extends GebSpec {
void "check stackoverflow"() {
when: "Go to so"
go "https://stackoverflow.com/questions/1223354/undo-git-pull-how-to-bring-repos-to-old-state"
$('#sidebar.show-votes div.related.js-gps-related-questions').children()
then:
System.out.println("Done.")
}
}
I actually end up with an array (?) of divs:
[<div class="spacer">, <div class="spacer">, <div class="spacer">, <div class="spacer">, <div class="spacer">, <div class="spacer">, <div class="spacer">, <div class="spacer">, <div class="spacer">, <div class="spacer">]
How would I iterate over each of these divs and extract the vote counter and question title?