如何在页面完全加载之前单击元素,我被卡住了,加载完成需要太多时间 [英] How to click on an element before the page is fully loaded i'm stuck, it takes too much time until loading completed
本文介绍了如何在页面完全加载之前单击元素,我被卡住了,加载完成需要太多时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道是否有任何方法可以强制浏览器停止加载,但是我要单击的元素是可见的,因此无需等到完全加载即可.
I want to know if there is any way to force the browser stop loading, however the element i want to click on is visible, so that no need to wait untill fully loaded.
推荐答案
尝试一下:
WebElement myButton = (new WebDriverWait(driver, 10))
.until(ExpectedConditions.presenceOfElementLocated(By.id("myButtonId")));
((JavascriptExecutor)driver).executeScript("window.stop();");
这篇关于如何在页面完全加载之前单击元素,我被卡住了,加载完成需要太多时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文