Hi Tommy,
To answer your first question - you no longer need NonEmptyNavigator,
simply return an instance of your custom navigator class (say it's
called DefaultNavigatorWithOverridenClick) from innerNavigatorFactory in
GebConfig:
innerNavigatorFactory = { Browser browser, Iterable<WebElement> elements ->
new DefaultNavigatorWithOverridenClick(browser, elements)
}
To answer your second question - I'm not sure if this would be better
implemented using a NavigatorEventListener but it's definitely possible to
do it that way. I would say that both ways will do the job just fine
with using the listener being maybe slightly more flexible but for your
case it does not matter at all.
Cheers,
Marcin
On Mon, Apr 20, 2020 at 1:33 AM Tommy Marks <[email protected]> wrote:
> The website I test just changed so the header is static and the body
> scrolls under the top menu. (example: https://bertram.d.pr/KKWrUQ)
> When geb tries to click an element under the header, it fails with error
> "org.openqa.selenium.ElementClickInterceptedException"
>
> If I perform this before the click, it works fine:
> interact { moveToElement(element) } //move to element i assume the same
> way selenium does before click
> browser.driver.executeScript("javascript:window.scrollBy(0,-180);")
> //scroll up 180 pixels (height of top menu)
>
> I'm thinking of overriding the DefaultNavigator click method to either
> scroll up a lot at the start, or catch the error, scroll up 180px and try
> again.
> I found this thread on it, but NonEmptyNavigator is no longer used.
>
> https://groups.google.com/forum/#!searchin/geb-user/override$20click%7Csort:date/geb-user/SSyTs3I7Y9Y/Kz7XsFY-AQAJ
>
> Any tips on how to override the click() method?
> Would this be better implemented using NavigatorEventListenerSupport
> beforeClick()?
>
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/93277ec1-e0d9-4d59-bf93-bb8d66474883%40googlegroups.com
> <https://groups.google.com/d/msgid/geb-user/93277ec1-e0d9-4d59-bf93-bb8d66474883%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%2B52dQQMUs5jnWt5Ohk6f6XgrMGxDoEKbCQd8Sbq7%3D7NtEyH%2BA%40mail.gmail.com.