admin管理员组文章数量:1405168
When loading "; i want to decline all the cookies by clicking the button "Decline All". The button is easy to identify and to avoid to click it while it might not be ready or in a non complete state, i use the explicit waiting mecanism of Selenium. Nevertheless i'm getting an 'ElementClickInterceptedException' both with Chrome and Firefox drivers.
Here my source code:
public static void main(String[] args) throws InterruptedException {
ChromeOptions options = new ChromeOptions();
options.addArguments("--start-maximized");
options.addArguments("--incognito");
options.setImplicitWaitTimeout(Duration.ofSeconds(5L));
WebDriver driver = new ChromeDriver(options);
driver.get(";);
WebDriverWait waitManager = new WebDriverWait(driver, Duration.ofSeconds(5L));
WebElement btnDecline = waitManager.until(ExpectedConditions.elementToBeClickable(By.xpath("//button[@id='gdpr-banner-decline']")));
System.out.println(btnDecline.getText());
// Thread.sleep(Duration.ofSeconds(3L));
btnDecline.click();
The console prints as expected "Decline All" but the following click() statement throws the Exception.
I tried to check this behaviour in another browser (Firefox) but still i got the same Exception, the button is not clickable. However when i inserted before clicking a sleep statement, it works fine and no Exception is thrown. I'm looking for a genuine solution of this issue.
本文标签:
版权声明:本文标题:org.openqa.selenium.ElementClickInterceptedException: element click intercepted exception using Selenium and Java - Stack Overfl 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744887747a2630588.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论