Debugging “Element is not clickable at point” error

后端 未结 30 2732
余生分开走
余生分开走 2020-11-21 23:55

I see this only in Chrome.

The full error message reads:

\"org.openqa.selenium.WebDriverException: Element is not clickable at point (411, 675

30条回答
  •  猫巷女王i
    2020-11-22 00:19

    Re Tony Lâmpada's answer, comment #27 did indeed solve the problem for me, except that it provided Java code and I needed Python. Here's a Python function that scrolls to the element's position and then clicks it.

    def scroll_to_and_click(xpath):
        element = TestUtil.driver.find_element_by_xpath(xpath)
        TestUtil.driver.execute_script('window.scrollTo(0, ' + str(element.location['y']) + ');')
        element.click()
    

    This solved the problem for me in Chrome 34.0. It caused no harm in Firefox 28.0 and IE 11; those browsers aren't subject to the problem, but scrolling to the element's position before clicking it still isn't a bad thing.

提交回复
热议问题