我只在Chrome浏览器中看到这个。

完整的错误信息如下:

“org.openqa.selenium。WebDriverException:元素在点(411,675)不可点击。其他元素会收到点击:……”

“将接收点击”的元素位于相关元素的一侧,而不是在元素的顶部,也没有重叠,也没有在页面上移动。

我试过加一个偏移量,但也不行。该项目在显示的窗口上,不需要滚动。


当前回答

在Drupal中使用Selenium时:

    // Get element.
    $element = $this->driver->getElement('xpath=//input');        
    // Get screen location.
    $location = $element->getLocation();
    // To make sure that Chrome correctly handles clicking on the elements 
    // outside of the screen, we must move the cursor to the element's location.
    $this->driver->moveCursor($location['x'], $location['y']);

    // Optionally, set some sleep time (0.5 sec in the example below) if your
    // elements are visible after some animation.
    time_nanosleep(0, 500000000);

    // Click on the element.
    $element->click();

其他回答

当您使用分辨率大于1024x768的浏览器时,尝试最大化浏览器。

driver.manage().window().maximize();

我在硒驱动的Chrome窗口开得太小的情况下见过这种情况。要点击的元素不在视口中,因此正在失败。

这听起来合乎逻辑……真正的用户必须调整窗口大小或滚动,以便能够看到元素,并实际上单击它。

在指示selenium驱动程序适当地设置窗口大小后,这个问题就消失了。这里描述了webdriver API。

调试"元素在点上不可点击"错误

要处理此错误,请使用此代码向下滚动。

browser.execute_script("window.scrollTo(0, 300);")

我有同样的问题,并得到'其他元素将收到点击'错误显示,可见的元素。我发现没有其他解决方案,以触发与javascript点击。

我更换:

WebElement el = webDriver.findElement(By.id("undo-alert"));
WebElement closeButton = el.findElement(By.className("close"));
// The following throws 'Element is not clickable at point ... Other element 
// would receive the click'
closeButton.click();

:

((JavascriptExecutor) webDriver).executeScript(
    "$('#undo-alert').find('.close').click();"
);

结果一切都很顺利

我根据Tony Lâmpada的回答做出了这个方法。它工作得很好。

def scroll_to(element)
  page.execute_script("window.scrollTo(#{element.native.location.x}, #{element.native.location.y})")
end