Saturday, September 19, 2015

Chromedriver: "Element is not clickable at point (x, y). Other element would receive the click.."

If you've done any automated testing with Chromedriver, you'll likely have come across the following classic error at some stage:
WebDriverException: Message: unknown error: Element is not clickable at point (x, y). Other element would receive the click: <div> class='header'>...</div>
It's triggered by a block like this one:

element = self.driver.find_element_by_css_selector("a.terms")
element.click()


The solution? Use javascript:

self.driver.execute_script("document.querySelector('a.terms').click();")

Note that the error above is confined to Chrome/Chromedriver only. The JS solution works well cross-browser, cross-device and cross-platform.

More on Stack Overflow

No comments:

Post a Comment