Element MyElement is not clickable at point (x, y)… Other element would receive the click

后端 未结 5 1586
天命终不由人
天命终不由人 2020-11-21 04:42

I am trying to make some tests using selenium based Katalon Studio. In one of my tests I have to write inside a textarea. The problem is that I get the following error:

5条回答
  •  时光说笑
    2020-11-21 05:16

    As @DebanjanB said, your button (or another element) could be temporarily covered by another element, but you can wait and click it even if you don't know which element is covering the button.
    To do this, you can define your own ExpectedCondition with the click action:

    public class SuccessfulClick implements ExpectedCondition {
        private WebElement element;
    
        public SuccessfulClick(WebElement element) { //WebElement element
            this.element = element;
        }
    
        @Override
        public Boolean apply(WebDriver driver) {
            try {
                element.click();
                return true;
            } catch (ElementClickInterceptedException | StaleElementReferenceException | NoSuchElementException e) {
                return false;
            }
        }
    }
    

    and then use this:

    WebDriverWait wait10 = new WebDriverWait(driver, 10);
    wait10.until(elementToBeClickable(btn));
    wait10.until(new SuccessfulClick(btn));
    

提交回复
热议问题