Search code examples
seleniumselenium-grid2

Running Hub and Nodes remotely on Windows without a user logged into the machine


Selenium GRID2 is setup with a hub and three nodes (VMs Windows). All the config files are set and I start the services with a couple batch files executed on each machine. Once everything is started up it works great. When the remotely connected user who executed the batch files actually logs out of the machine the tests fail to connect to the browsers anymore.

I could leave the user account logged on after starting everything and just stay logged on. However, I would much rather find a way to get the services to startup and stay active without any user logged on the systems. Is there a way to force all the services to stay active after all users logout of the machine. Also need the full browser to function as there are screenshots as well. Could someone point me in the right direction or tell me how to get that to work or if it's possible?


Solution

  • Setup a scheduled task via Task Scheduler to execute the batch files to start the node on each machine. You can set a trigger to execute the batch file on system startup, or at a specific time.

    Also, when creating the task, select the option "Run whether user is logged on or not"

    I also add a task to restart the node machines (every night) to keep it clean of stale browser windows.Since the node batch files runs at startup, you do not need to login to the hub/node machine to start it manually.