简体   繁体   English

无法删除由于Selenium Grid而创建的%temp%文件

[英]Unable to delete %temp% files created due to Selenium Grid

I have a grid configuration where the node is a windows 7 machine configured to run IE9 browser. 我有一个网格配置,其中节点是配置为运行IE9浏览器的Windows 7机器。 Test Cases are running fine but after some time the browser gets slow. 测试用例运行正常,但一段时间后浏览器变慢。 While searching I found out that it was due to the temp files created by the Selenium Grid NODE . 搜索时我发现它是由Selenium Grid NODE创建的临时文件引起的。

After clearing the Temp files created by the NODE the browser worked fine. 清除NODE创建的Temp文件后,浏览器运行正常。

Now I need a way to clear the temp files on the NODE after a Test Case finishes execution or before starting a Test Case execution. 现在我需要一种方法来在测试用例完成执行后或开始测试用例执行之前清除NODE上的临时文件。

I tried to clear the system temp files from my Java code but this won't work in Grid configuration as the code runs in the HUB not NODE . 我试图从我的Java代码中清除系统临时文件,但这在Grid配置中不起作用,因为代码在HUB而非NODE运行。

Is there any solution?? 有没有解决方案?

I've run into something very similar. 我遇到了一些非常相似的东西。

The system that I use, is a combination between selenium 1, and selenium 2 on a grid server on the intranet, which goes out to the AWS which is connected to several hundred nodes. 我使用的系统是内部网上网格服务器上的selenium 1和selenium 2之间的组合,它连接到连接到数百个节点的AWS。

Each one of these nodes, once they start up the selenium server to run tests as a node, once that server is shut down, it will execute a batch file which just loops through each folder and deletes it in the temp folder. 这些节点中的每一个,一旦启动selenium服务器以将测试作为节点运行,一旦该服务器关闭,它将执行批处理文件,该文件只循环遍历每个文件夹并将其删除到临时文件夹中。

You can use PsExec to execute a batch file that does the cleanup on the node machine. 您可以使用PsExec执行在节点计算机上执行清理的批处理文件。

Obtain the node address to use in the psexec command by making a POST call to the grid 通过对网格进行POST调用,获取要在psexec命令中使用的节点地址

http://<yourhub:port>/grid/api/testsession?session=" + driver.getSessionId()

The returned JSON will contain the session information, including the address of the node. 返回的JSON将包含会话信息,包括节点的地址。

You can find sample code to get the node IP here . 您可以在此处找到示例代码以获取节点IP。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM