This code is a pared-down version of some web scraping to isolate errors 
I'm experiencing in a minimal implementation.  I've narrowed it down to the 
difference between doing Navigator.$(selector)  and  $(full selector).   

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.

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/2a7c3034-5aa3-4ac3-ba77-440780ae4770%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to