1

I am getting following error intermittently at a component click in my geb UI tests on Firefox 45.0.1, Selenium 2.53.1 and following Jars:

geb-spock-1.1.1.jar

geb-core-1.1.1.jar

geb-ast-1.1.1.jar

geb-waiting-1.1.1.jar

geb-implicit-assertions-1.1.1.jar

geb-exceptions-1.1.1.jar

geb-test-common-1.1.1.jar

spock-spring-1.0-groovy-2.4.jar

spock-core-1.0-groovy-2.4.jar

org.openqa.selenium.WebDriverException: Element is not clickable at point (499.95001220703125, 375.6000061035156). Other element would receive the click:

The tests fail intermittently. Adding a sleep of 200 ms before component click viz. sleep(200) does help but I do not want to use sleep() with such fix time values for the sake of good practice.

waitFor() does not help either:

myButton(wait:true) {$('#myBtn')}
waitFor { myButton.isDisplayed() }
myButton.click()

Launching tests in full screen also does not make things any better:

def setupSpec() {
        getDriver().manage().window().maximize()
    }
aristotll
  • 8,694
  • 6
  • 33
  • 53
user2918640
  • 473
  • 1
  • 7
  • 25
  • Provide reproducible case / sample code. – Rao Aug 18 '17 at 06:59
  • 1
    Possible duplicate of [Selenium Web Driver & Java. Element is not clickable at point (36, 72). Other element would receive the click:](https://stackoverflow.com/questions/44912203/selenium-web-driver-java-element-is-not-clickable-at-point-36-72-other-el) – undetected Selenium Aug 18 '17 at 07:12

1 Answers1

0

Its likely that the element is displayed before it is clickable I have seen this behaviour with clickable elements that animate. E.G.

  • Page loads
  • button is displayed
  • button begins animating
  • button animation finishes
  • Button is clickable

Given this is intermittent I suspect the problem is related. It might not be animation related but a simple race condition.

you could add a method to your pageObject or even better create a custom navigator that waits for the element to be clickable:

def waitForAndClick(Navigator element, Integer timeoutSeconds) {
    def timeStart = new Date().getTime()
    while ( timeStart <= timeStart + timeoutSeconds ) {
        try { 
            element.click()
        }
        catch (WebDriverException ex) {
             pass
        }
        break
    }
}

Hope this helps.

CommodoreBeard
  • 340
  • 2
  • 12