zoukankan      html  css  js  c++  java
  • WebDriverException:Element is not clickable at point

    Element is not clickable at point (x, y)

     这段可以忽略:本文来自 https://www.cnblogs.com/lozz/p/9947430.html

    引起这个错误的原因有不同的因素

    1.Element not getting clicked due to JavaScript or AJAX calls present

    建议尝试 actions 方法:

    WebElement element = driver.findElement(By.id("xxx"));
    Actions actions = new Actions(driver);
    actions.moveToElement(element).click().build().perform();
    View Code

    2.Element not getting clicked as it is not within viewport

    尝试使用JavascriptExecutor将元素引入视图中:

    WebElement myelement = driver.findElement(By.id("xxx"));
    JavascriptExecutor jse2 = (JavascriptExecutor)driver;
    jse2.executeScript("arguments[0].scrollIntoView()", myelement);
    View Code

    3. The page is getting refreshed before the element gets clickable

    4. Element is present in the DOM but not clickable.

    以上2种因素尝试使用expliciwait方法:

    WebDriverWait wait2 = new WebDriverWait(driver, 10);
    wait2.until(ExpectedConditions.elementToBeClickable(By.id("xxx")));
    View Code

    5. Element is present but having temporary Overlay.

    --元素被临时覆盖

    induce ExplicitWait with ExpectedConditions set to invisibilityOfElementLocatedfor the Overlay to be invisible

    WebDriverWait wait3 = new WebDriverWait(driver, 10);
    wait3.until(ExpectedConditions.invisibilityOfElementLocated(By.xpath("ele_to_inv")));
    View Code

    6. Element is present but having permanent Overlay.

    --元素被永久覆盖,尝试使用JavascriptExecutor

    WebElement ele = driver.findElement(By.xpath("element_xpath"));
    JavascriptExecutor executor = (JavascriptExecutor)driver;
    executor.executeScript("arguments[0].click();", ele);
    View Code

    最后,多使用 https://stackoverflow.com/

  • 相关阅读:
    HDOJ 1677 Nested Dolls(LIS+Dilworth)
    POJ 1548 Robots (Dilworth)
    POJ 1065 Wooden Sticks
    第三百四十天 how can I 坚持
    第三百三十九天 how can I 坚持
    第三百三十八天 how can I 坚持
    第三百三十七天 how can I 坚持
    第三百三十六天 how can I 坚持
    第三百三十五天 how can I 坚持
    第三百三十四天 how can I 坚持
  • 原文地址:https://www.cnblogs.com/lozz/p/9947430.html
Copyright © 2011-2022 走看看