Is there a way to disable caching in case #2?

My experience with geb so-far, is that it is quite prickly with dynamic 
pages. I may be able to interact with (module) content for the duration of 
a call, but then if I call the same method a second time, it will fail, 
citing "content not found". I keep being dumbfounded by cases where I 
believe my geb code is mirroring what I see in the browser, yet some 
underlying, invisible issue fails a test.


On Monday, September 25, 2017 at 4:18:55 AM UTC+10, Marcin Erdmann wrote:
>
> 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] 
> <javascript:>> 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] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> 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/540478f0-3217-43d4-8ddc-8f90b280bd36%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to