软硬环境
操作系统:win10
IDE:eclipse
Java:1.8
selenium:3.141.59
解决element 被弹窗覆盖,可以找到却无法点击
点击下拉按钮时,弹出一个框,会把“Save API Version and Continue”按钮覆盖掉,会造成能够找到按钮,但是无法点击的情况
解决方法:
import org.openqa.selenium.JavascriptExecutor;
/**
* Solve the problem of element overwriting
*
* @param element 这个参数就是你需要找到并点击的元素
*/
public void clickOnHideButton(WebElement element) {
((JavascriptExecutor) driver).executeScript("arguments[0].click()", element);
}
原文地址:https://www.cnblogs.com/aidegongyang/p/11015315.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。