线程"main"中的异常org.openqa.selenium.ElementClickInterceptedException [英] Exception in thread "main" org.openqa.selenium.ElementClickInterceptedException

查看:119
本文介绍了线程"main"中的异常org.openqa.selenium.ElementClickInterceptedException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

线程主"中的异常org.openqa.selenium.ElementClickInterceptedException:元素单击被拦截:元素...在点(1075,323)不可单击.其他元素将获得点击:(会话信息:chrome = 79.0.3945.130)

Exception in thread "main" org.openqa.selenium.ElementClickInterceptedException: element click intercepted: Element ... is not clickable at point (1075, 323). Other element would receive the click: (Session info: chrome=79.0.3945.130)

如何解决Selenium WebDriver代码的此错误..使用xpath来单击POST按钮时devloperr不提供该按钮的ID代码:

How to solve this error for selenium webdriver code..FOR CLICKING THE POST BUTTON using xpath the devloperr donot provide id for that button CODE:

WebElement element1=driver.findElement(By.xpath("//*[@id=\"SINPost\"]/button"));
element1.click();

推荐答案

如果您使用的是chrome,则有时可能会发生这种情况,因为chrome总是尝试单击元素的中间位置.您可以做的是使用硒的JavaScriptExecutor接口.代码应如下所示

If you are using chrome it can happen sometimes, because chrome always tries to click at the middle of the element. What you can do is use JavaScriptExecutor interface of selenium. The code should look like this

JavascriptExecutor js = (JavascriptExecutor) DriverManager.getWebDriver();
js.executeScript("arguments[0].click();", element);

这篇关于线程"main"中的异常org.openqa.selenium.ElementClickInterceptedException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆