Reputation: 585
Is there any way to trigger a .bat script when a selenium node is idle?
I have a selenium grid setup consisting of one hub and three nodes on separate machines. What i'm trying to do is to have a script that cleans up the testing environment on each node after a test suite has been executed. As there might be other test suites starting directly after another, I somehow need to trigger the script when the node has been idle for a few seconds.
The script itself is relatively fast, takes about 1-2seconds to run. How can I trigger this at an appropriate time?
Upvotes: 0
Views: 502
Reputation: 14746
The short answer is, you cannot do this from outside of the grid (atleast its not that straight forward). The reason why I say this is because, at any given point in time you can very easily find out the current usage statistics, but just before you trigger some cleanup actions, the grid may end up routing a new test to the node which is being cleaned up and thus causing invalid test failures.
Sometime back I created a blog post which talks about how to go about building a Self Healing Grid (which is what you are after). The details are specified in an elaborate manner here
If you are interested in consuming something thats already built and don't want to spend time re-inventing the wheel, you can take a look at the following Open source implementations implementations:
Upvotes: 1