zoukankan      html  css  js  c++  java
  • Selenium => Debugging “Element is not clickable at point” error

    [From] http://stackoverflow.com/questions/11908249/debugging-element-is-not-clickable-at-point-error

    I see this only in Chrome.

    The full error message reads:

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

    The element that 'would receive the click' is to the side of the element in question, not on top of it and not overlapping it, not moving around the page.

    I have tried adding an offset, but that does not work either. The item is on the displayed window without any need for scrolling.

    This is caused by following 3 types:

    1.The element is not visible to click.

    Use Actions or JavascriptExecutor for making it to click.

    By Actions:

    WebElement element = driver.findElement(By("element_path"));
    
    Actions actions = new Actions(driver);
    
    actions.moveToElement(element).click().perform();

    By JavascriptExecutor:

    JavascriptExecutor jse = (JavascriptExecutor)driver;
    
    jse.executeScript("scroll(250, 0)"); // if the element is on top.
    
    jse.executeScript("scroll(0, 250)"); // if the element is on bottom.

    or

    JavascriptExecutor jse = (JavascriptExecutor)driver;
    
    jse.executeScript("arguments[0].scrollIntoView()", Webelement); 

    Then click on the element.

    2.The page is getting refreshed before it is clicking the element.

    For this, make the page to wait for few seconds.

    3. The element is clickable but there is a spinner/overlay on top of it

    The below code will wait until the overlay disppears

    By loadingImage = By.id("loading image ID");
    
    WebDriverWait wait = new WebDriverWait(driver, timeOutInSeconds);
    
    wait.until(ExpectedConditions.invisibilityOfElementLocated(loadingImage));

    Then click on the element.

  • 相关阅读:
    P2762 [网络流24题]太空飞行计划问题(最小割)
    poj2987 Firing[最小割]
    P2051 [AHOI2009]中国象棋[线性DP]
    poj1637 Sightseeing tour[最大流+欧拉回路]
    hdu3739 Anti LIS[最小割]
    P2766 [网络流24题]最长不下降子序列问题
    P2764 [网络流24题]最小路径覆盖问题[最大流]
    P2936(BZOJ3396) [USACO09JAN]全流Total Flow[最大流]
    BZOJ4278 [ONTAK2015]Tasowanie[后缀数组+贪心]
    Robot framework之元素定位实战
  • 原文地址:https://www.cnblogs.com/pekkle/p/6601143.html
Copyright © 2011-2022 走看看