Geb indeed evaluates templates on every call but there are multiple
situations when results of that evaluation are "cached" in the context of
what you're doing. To name three:
1. Some operations are not atomic. What I mean by that is what looks like a
single Geb call results in multiple WebDriver calls. Take
$(".description").text() - it actually results in two calls, one to locate
the element(s) having description as the class and one to obtain the text
of that element. If the element is removed from the DOM in-between the two
calls you will get a StaleElementException.
2. Geb's modules have a concept of base element. That element is located
when an instance of a module is created and "cached" for the lifetime of
that instance. So if you are calling any methods on instance of a module
and its base element has been removed from the DOM then you will get a
StaleElementException.
3. If you assign elements returned from evaluation of content definitions
to a variable and then call multiple methods on that variable then you are
effectively "caching" that element in that context. If the element is
removed from the DOM between being assigned to the variable and the method
calls will get a StaleElementException.

On Fri, Sep 22, 2017 at 12:46 AM, Samuel Rossinovic <
[email protected]> wrote:

> I am confused about those exceptions I'm seeing on content elements.
>
> In Geb's manual, I read:
>
> cache
>
> Default value: false
>
> The cache option controls whether or not the definition is evaluated each
> time the content is requested
>
> So, if Geb evaluates content templates on every access, how can stale
> element exceptions occur?
>
> Thanks
>
> --
> 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/38944bfb-daaf-4eac-a803-93583ea5e0bb%40googlegroups.com
> <https://groups.google.com/d/msgid/geb-user/38944bfb-daaf-4eac-a803-93583ea5e0bb%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CA%2B52dQRMyfD2PJ6chW8db2SWXRjdwm%2BpWq4xrn2EW57QmDRAnQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to