Hi Nico, Your problem is most likely a timing issue.
Is there any difference defining the element in the content closure or > using the navigator directly in the method? > Strictly speaking there is, because the calls will go through different code paths but in general the outcome should be the same. Unless, like in your case, we are dealing with an async page which exposes certain timing properties. Using a selector is just about quicker than using a page definition and I suspect, and it's only a suspicion, that in this case it's quicker enough to lead to a different behaviour because the page is in a different state when clicking on the element. I'd advise you to never put click() within waitFor() blocks - it will be prone to timing issues and can sometimes lead to the element being clicked multiple times. What I would do to make your test reliable is to identify the object which is overlaying the element you're clicking and causing the exception, wait for it to appear, dismiss it and then click on your target element. That way things will be reliable. On Wed, Dec 18, 2019 at 11:45 AM Nico Janssens <[email protected]> wrote: > Hey , > > Hmmm , I'm already using a waitFor closure in the method , which should > result in the same behaviour as using the wait option in content block. > Anyway when I apply the wait option and remove the waitFor in the method , > I get the same error. > > --------------------------------------- > > dashboardListSaveButton { $('[data-gtm="content-planner/filters/save"]')} > > def "save dashboard list"() { > waitFor { > dashboardListSaveButton > } > } > > --------------------------------------- > > VS > > --------------------------------------- > > dashboardListSaveButton(wait: true) { > $('[data-gtm="content-planner/filters/save"]')} > > def "save dashboard list"() { > dashboardListSaveButton > } > > --------------------------------------- > > > thx > > On Wednesday, 18 December 2019 11:27:50 UTC+1, micha.kutz wrote: >> >> Hey Nico, >> >> the difference is the `waitFor` in the method. You can achieve the same >> behavior in the content block by adding a `wait: true` like this: >> >> static content = { >> ... >> dashboardListSaveButton(wait: true) { >> $('[data-gtm="content-planner/filters/save"]')} >> ... >> } >> >> See https://gebish.org/manual/current/#content-dsl-wait >> >> Kind regards >> >> Nico Janssens <[email protected]> schrieb am Mi., 18. Dez. 2019, >> 11:08: >> >>> Hi, >>> >>> A question about content closure. >>> >>> In the content closure of a page object , I have defined some elements : >>> >>> static content = { >>> .... >>> dashboardListSaveButton { $( >>> '[data-gtm="content-planner/filters/save"]')} >>> ... >>> } >>> >>> >>> In that same page object , I have a method like >>> >>> def "save dashboard list"() { >>> waitFor { >>> dashboardListSaveButton.click() >>> } >>> } >>> >>> >>> When running the test ( via spock framework) which makes use of the >>> method above, I always get following exception >>> : ElementClickInterceptedException: element click intercepted: Element is >>> not clickable at point (924, 913) >>> >>> When I modify the method like this >>> >>> def "save dashboard list"() { >>> waitFor { >>> $('[data-gtm="content-planner/filters/save"]').click() >>> } >>> } >>> >>> and rerun the test, it works fine. >>> >>> >>> Is there any difference defining the element in the content closure or >>> using the navigator directly in the method? >>> >>> thx >>> >>> >>> Kind regards >>> >>> Nico >>> >>> >>> >>> >>> >>> >>> >>> -- >>> 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 view this discussion on the web visit >>> https://groups.google.com/d/msgid/geb-user/6d2f7006-b5f5-47bb-bd7d-9d4a66dab8dd%40googlegroups.com >>> <https://groups.google.com/d/msgid/geb-user/6d2f7006-b5f5-47bb-bd7d-9d4a66dab8dd%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- > 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 view this discussion on the web visit > https://groups.google.com/d/msgid/geb-user/581f4240-f58e-41d4-aced-74426616db39%40googlegroups.com > <https://groups.google.com/d/msgid/geb-user/581f4240-f58e-41d4-aced-74426616db39%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/CA%2B52dQQ0Lm9EkB-oFSjYtYaaWqSj_HmsTxbKusXYcqAuHOxcyQ%40mail.gmail.com.
