WebDriverException:Element is not clickable at point - selenium执行过程中遇到的相关报错
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();
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);
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")));
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")));
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);
最后,多使用 https://stackoverflow.com/
 
                     
                    
                 
                    
                
 
 
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号