[英]winappdriver based java selenium automation stops working after some time
I want to run a java based automation test (using testng) on a windows application 24*7.我想在 windows 应用程序 24*7 上运行基于 java 的自动化测试(使用 testng)。 The code is working fine but after some time the winappdriver responds very slowly and selenium's basic operation like clicking element is taking a lot of time unless I restart my windows machine.
代码运行良好,但一段时间后 winappdriver 响应非常缓慢,selenium 的基本操作(如单击元素)需要花费大量时间,除非我重新启动我的 Windows 机器。 WinAppDriver gets stuck on the state shown in image.
WinAppDriver 卡在图中所示的状态。 winappdriver state
winapp 驱动程序状态
I tried driver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS);
我试过
driver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS);
so that if it could not find an element within 2 seconds then it should throw an exception but it is not working.因此,如果它在 2 秒内找不到元素,那么它应该抛出异常但它不起作用。 I just want that if it is taking too long to perform an operation then it should throw an exception and my Retryanalyzer will restart the test but I dont know how to achieve this.
我只是想,如果执行操作花费的时间太长,那么它应该抛出异常,我的 Retryanalyzer 将重新启动测试,但我不知道如何实现这一点。
try {
driver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS);
do action
CustomReporter.log("\n action");
} catch (NoSuchElementException e) {
call reset method
CustomReporter.log("\n reset");
}
But using implicitlyWait is not a very good approach in general但是一般来说,使用 implicitlyWait 并不是一个很好的方法
Did you check memory usage?您检查内存使用情况了吗? It would be better to check it
最好检查一下
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.