Java 无法单击按钮org.openqa.selenium.WebDriverException:</按钮>;在点(502,85)处不可单击。其他元素将收到单击:
我正在使用AngularJS应用程序。并且使用selenium和Java进行匹配。每当我尝试单击按钮时,就会得到异常作为Java 无法单击按钮org.openqa.selenium.WebDriverException:</按钮>;在点(502,85)处不可单击。其他元素将收到单击:,java,selenium,selenium-webdriver,webdriver,selenium-chromedriver,Java,Selenium,Selenium Webdriver,Webdriver,Selenium Chromedriver,我正在使用AngularJS应用程序。并且使用selenium和Java进行匹配。每当我尝试单击按钮时,就会得到异常作为 Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: Element <button .</button> is not clickable at point (502, 85). Other element would receive the c
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: Element <button .</button> is not clickable at point (502, 85). Other element would receive the click: <div class="col-sm-12 move-buttons">...</div>
我还尝试了正常定位元素并点击它。
这也会产生同样的错误
所以最终我无法点击此按钮您是否尝试过使用Action类-
WebElement element = driver.findElement(By("element"));
Actions action = new Actions(driver);
action.moveToElement(element).click().perform();
或
或
谢谢你的回复。代码使用.js.executeScript(“window.scrollBy(1000,document.body.scrollHeight)”)下面的代码片段为我工作;driver.manage().timeouts().implicitlyWait(20,TimeUnit.SECONDS);WebElement addXYZ=driver.findElement(By.xpath(“//i[@class='fa+fa-2x']);JavascriptExecutor jse2=(JavascriptExecutor)驱动程序;jse2.executeScript(“参数[0].ScrollingToView()”,addXYZ);
WebElement element= driver.findElement(By.xpath("//div[contains(@class,'col-sm-1')]//button[1]"));
js.executeScript("arguments[0].scrollIntoView(true);",element);
js.executeScript("arguments[0].click();", element);
WebElement element = driver.findElement(By("element"));
Actions action = new Actions(driver);
action.moveToElement(element).click().perform();
WebElement elementToClick = driver.findElement(By.xpath("Your xpath"));((JavascriptExecutor)driver).executeScript("window.scrollTo("+elementToClick.getLocation().x+","+elementToClick.getLocation().y+")"); elementToClick.click();
WebDriverWait wait = new WebDriverWait(driver, TIME_IN_SECONDS);
wait.until(ExpectedConditions.elementToBeClickable(By.className("element-class-name")));