在 (355, 160) 异常处获取元素不可点击 [英] getting Element is not clickable at point (355, 160) exception

查看:27
本文介绍了在 (355, 160) 异常处获取元素不可点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于以下异常,我的脚本失败.

My script is failing because of the following exception.

org.openqa.selenium.WebDriverException:未知错误:元素不是可在 (355, 160) 点点击

org.openqa.selenium.WebDriverException: unknown error: Element is not clickable at point (355, 160)

加载页面时,如果元素出现在后台,selenium 尝试点击并失败.我用过 webdriverwait.在 10 次中,它至少失败了大约 3 次.

While loading the page if the element appears in the background, selenium tries to click and fails. I have used webdriverwait. Out of 10 times it fails around 3 times minimum.

如何在不使用 Thread.sleep() 的情况下避免/处理此问题;

How can I avoid/handle this without using Thread.sleep();

推荐答案

您应该使用 invisibilityOfElementLocated 等待元素不可见,如下所示:-

You should wait until invisibility of element using invisibilityOfElementLocated as below :-

WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.invisibilityOfElementLocated(By.xpath('xpath of please wait loading...')));

在此之后,您可以在目标 element

After this you could perform click on target element

希望它会起作用..:)

Hope it will work..:)

这篇关于在 (355, 160) 异常处获取元素不可点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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