import geb.Browser
System.setProperty("webdriver.chrome.driver", 'c:\\webdrivers\\chromedriver.exe')
Browser.drive {
go "https://www.uline.com/Product/GuidedNav?t=184360&dup=over" // direct to Shipping Boxes
assert title == 'ULINE - Shipping Boxes'
while (true) {
def table = $('table.GNItemTable')
assert table!=null && table.size()>0
// def theader = table.$('thead tr th') // usually fails after one page
def theader = $('table.GNItemTable thead tr th') // never fails
def next = $('a.EnabledLink', text: 'Next>')
if (next == null || next.size() == 0) break;
next[0].click()
}
}When I use method chaining; table.$('thead tr th') the code will fail with an ElementReferenceException usually on loading 2nd page. When I use the full selector $('table.GNItemTable thead tr th') it runs consistently flawless.
('table.GNItemTable',0 ).$('thead tr th')
waitFor { next[0].click() }
--
You received this message because you are subscribed to the Google Groups "Geb User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geb-user+u...@googlegroups.com.
To post to this group, send email to geb-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/972bedce-c388-40db-ab4f-b5708c33f6a6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.