Long explanation coming but the more I provide hopefully the better the chance someone has done something similar.
I'm currently working on a test solution to test a web app (Visual Studio, C#, Seleno, MSTest)that uses windows credentials to log into the application. These credentials can either be stored in the windows vault and internet options can be set to automatic login or by entering them into an alert box. Most tests use different users as they have different permissions within the application.
The alert box isnt a standard javascript alert but a windows prompt skinned by the browser. I've been dealing with this from my automation solution by pushing credentials into the windows vault and configuring internet options for automatic login using current username and password but I've recently been implementing Selenium Grid for parallel test running as part of a CI pipeline instead of our Distributed approach with Microsoft Test Manager
Sounds easy enough but turns out it isn't
Previously with MTM the dlls were distributed to each Test Agent and managed by a test controller. We have a class that pushes credentials into the windows vault so that worked for each machine. With Grid these are pushed into the master machines vault and not the nodes. I had planned on using PowerShell to add credentials on the nodes as this needs to happen before the browser instance is created but selenium grid doesn’t tell the user which nodes it’s executing tests on.
I tried using selenium to interact with the alert but when navigating to the app the page constantly loads until credentials are entered so the selenium GoToUrl() method gets caught in a loop. If you stop the method using a timeout the alert disappears. (Can recreate manually by pressing the X button in browser to stop page loading)
I changed approach and using the SessionID of the RemoteWebDriver I sent a rest request to the selenium hub to get the Host name of all the machines that are executing tests. Now that I have the nodes I can use remote PowerShell to update the credential store. As i said at the start most tests use different users so I also need grid to tell me which test is executing on the hosts too but I can't find a way to get the grid hub to tell me what tests it's running programatically
so in short I wanted to:
Get Nodes for current test session from Selenium grid
Get Test name running on each node
Once I have both of these I can send appropriate user details via remote PowerShell
If anyone has done anything similar or has any advice it would be much appreciated.
Thanks
G