Jacek,

I personally would not depend on there being isClickable() or isVisible()
but would have code that checks if an ad is shown when loading the page and
dismiss it. On one of my projects we had a problem with a cookie bar
overlaying some elements on pages causing flakiness in our tests. We solved
it by dismissing the cookie bar in `onLoad()` of our pages:

class CookieBarPage extends Page {

    boolean autoCloseCookieBar = true

    static content = {
        cookieBar(required: false) { $('.cookie-message.is-visible-block ')
}
    }

    void onLoad(Page previousPage) {
        if (autoCloseCookieBar && cookieBar) {
            cookieBarCloseButton.click()
        }
        super.onLoad(previousPage)
    }

}

Note that autoCloseCookieBar method can be used to disable closing the bar
upon page load when testing the cookie bar itself:

to(new CookieBarPage(autoCloseCookieBar: false))
....


Cheers,
Marcin

On Tue, Feb 28, 2017 at 1:15 PM, Jacek Tołkanowicz <[email protected]>
wrote:

> Currently when I login to my portal, sometimes I get advertisment which
> overlays login button. Currently I use this code:
> waitFor(){
>    loginButton.click()
> }
>
> It works but as I see in Geb source code Wait.waitFor executes click() and
> catches the exception thrown by Selenium. If we had sth like isClickable or
> isVisible that we could eliminate clicking and catching Exception from
> waitFor.
> On the other hand Selenium probably check's this clickability/visibility
> underneath before executing click() so the main gain would come from not
> throwing (Selenium) and catching exception (Geb).
>
>
> W dniu niedziela, 26 lutego 2017 14:51:22 UTC+1 użytkownik Marcin Erdmann
> napisał:
>>
>> Everything is a possibilty, you know, Jacek. Why do you ask? Why would
>> you need a method like that?
>>
>> On Sun, 26 Feb 2017 at 05:15, Jacek Tołkanowicz <[email protected]>
>> wrote:
>>
>>> Hi Marcin,
>>> is there possibility that Navigator could have property isClickable()
>>> which would mean that elememnt isDisplayed and you can click it? That there
>>> is no overlay on top of it.
>>>
>>>
>>> W dniu poniedziałek, 23 marca 2015 12:59:30 UTC+1 użytkownik Marcin
>>> Erdmann napisał:
>>>
>>>> Both Varun's suggestions are spot on.
>>>>
>>> On Mon, Mar 23, 2015 at 11:06 AM, Varun Menon <[email protected]>
>>>> wrote:
>>>>
>>> Hi Subrahmanyam,
>>>>>
>>>>> According to the link you shared the main reason behind the failure is
>>>>> element not clickable for the given where you are clicking.
>>>>> It will be good if you change the locator to exact clickable item on
>>>>> the page as suggested in the link shared by you.
>>>>>
>>>>> Your solution will have multiple implications in your execution and
>>>>> hence I wont really suggest it to be used:
>>>>> - Increases the execution time for all the browsers.
>>>>> - Any failure thrown during click action will be overridden by timeout
>>>>> exception.
>>>>>
>>>>>
>>>>> In case you still want to go with the implementation  you can do so by
>>>>> implementing your own InnerNavigatorFactory as mentioned below:
>>>>> https://github.com/geb/geb/blob/master/module/geb-core/src/
>>>>> main/groovy/geb/navigator/factory/DefaultInnerNavigatorFactory.groovy
>>>>>
>>>>> And then configuring Geb to use your Navigator Factory by setting the
>>>>> property "*innerNavigatorFactory*" in GebConfig.groovy as mentioned
>>>>> below.
>>>>>
>>>>> innerNavigatorFactory = new CustomNavigatorFactory()
>>>>>
>>>>> - Varun
>>>>> http://in.linkedin.com/in/varunmenon/en
>>>>>
>>>> On Mon, Mar 23, 2015 at 3:48 PM, Subrahmanyam Rentala <
>>>>> [email protected]> wrote:
>>>>>
>>>> Problem Statement: 'Element in not clickable error' comes while using
>>>>>> the click action on any element in Chrome. Refer this site for more 
>>>>>> details:
>>>>>> https://sites.google.com/a/chromium.org/chromedriver/help/
>>>>>> clicking-issues
>>>>>>
>>>>>> How i overcome this issue ?
>>>>>> I used waitFor closure on click actions. This has resolved the issue.
>>>>>>
>>>>>> I tried to override the click() method of NonEmptyNavigator Class,
>>>>>> but i was unable to do that.
>>>>>> Is there way that i can override this method in my Framework ?
>>>>>>
>>>>>> If not, then i would like to make changes in click method by putting
>>>>>> waitFor inside the the click method.
>>>>>> eg: I will replace the following code:
>>>>>>
>>>>>> @Override
>>>>>> Navigator click() {
>>>>>>     contextElements.first().click()
>>>>>>     this
>>>>>> }
>>>>>>
>>>>>> with
>>>>>>
>>>>>>
>>>>>> @Override
>>>>>> Navigator click() {
>>>>>>     getBrowser().waitFor {contextElements.first().click()}
>>>>>>     this
>>>>>> }
>>>>>>
>>>>>>
>>>>>> Please suggest.
>>>>>>
>>>>>>
>>>>>> ~Subrahmanyam
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> 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/b681b234-3734-49f
>>>>>> b-8bae-d95488bcd254%40googlegroups.com
>>>>>> <https://groups.google.com/d/msgid/geb-user/b681b234-3734-49fb-8bae-d95488bcd254%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/ms
>>>>> gid/geb-user/CACVPfJk-4t-cc2J0dhr5cxJrN70O08WPCK%2BA%2B-%
>>>>> 2B72%2B%2BpNrxacg%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/geb-user/CACVPfJk-4t-cc2J0dhr5cxJrN70O08WPCK%2BA%2B-%2B72%2B%2BpNrxacg%40mail.gmail.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/ms
>>> gid/geb-user/68e63ff8-ca63-4d3a-b273-c05c9b149e64%40googlegroups.com
>>> <https://groups.google.com/d/msgid/geb-user/68e63ff8-ca63-4d3a-b273-c05c9b149e64%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/a5046f05-e7f2-4135-aaf6-38bf36c51edd%40googlegroups.com
> <https://groups.google.com/d/msgid/geb-user/a5046f05-e7f2-4135-aaf6-38bf36c51edd%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%2B52dQSMyD-maU_VpDD_%2BXSbUQMBxkTC5gRZjbQ9CLQog6fjOA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to