There are two ways to login and logout Agent machines while using Leapwork for automation
- Windows Credential Provider
- Image and Text building blocks Blocks
Windows Credential Provider
Leapwork can be set up to log in on the user’s behalf. Users can also start testing single-sign-on between Windows and any other application that reuses the same login credentials.
This means a user can now execute automation on any machine in an incredibly secure and robust manner.
To enable this behavior, building blocks to ‘login’, ‘logout’ and ‘lock’ have been added in the flows as per requirement, below is an example flow where it login block will log in to a remote Agent using give credentials and then perform required automation task and then logout from the agent when the task is completed.
Agent settings also include an option to either manually or automatically log in using a Windows account, and optionally lock sessions automatically after disconnecting from Agents:
The login flow can be used as the first case in the run list or at the beginning of each case if required. The scheduler executes cases in the same order as they are shown in the run list top to down. You can change cases order in the run list by dragging and dropping and then editing and saving your run list.
Login/logout blocks require latest Leapwork to be installed here are few preconditions which need to be met to be able to this feature
- Ensure you have Windows Credential Provider as an update installed in your system.
- Make sure you choose the Windows login (recommended) option while installing LEPWORK Agent else it will not work.
- Make sure no one is connected to Agent machine via a Remote Desktop Connection.
- Restart the machine after installing LEAPWORK.
This login and logout functionality works even with machines that have just been started or rebooted, without any prior user sessions, from Windows 7 SP1 and onwards. This makes it very easy to automate tasks on virtual machines and automate testing of complex, data-driven single-sign-on (SSO) scenarios.
Note that the functionality is based on a Windows “credentials provider” which does not circumvent any security measures in Windows; it simply lets Leapwork interact directly with the login/logout security feature built-in to Windows.
Image and Text building blocks Blocks
User can login to any remote machine by creating a Custom Remote Login Block, below are the steps for same :
- Lock the screen of the machine with the Agent.
- Capture the part of the screen that is always there when it is locked, like “Press Ctrl+Alt+Delete to unlock” in our case.
- Use Type text block to type key combination "Ctrl+Alt+Delete".
- Now capture required “Administrator” or any other "User" using "Find Image" block and pipe position of user image to Click position block.
- After that type password hit enter to login and verify login success.
User can use few more blocks to check screen status, in case of locked screen user can trigger above custom block else continue test.
We recommend user to create logout flow using similar approach and add it as last test in your run list or as last step in run list.
Alternatively, This custom block can be used in first test case in the schedule or at the beginning of each case if required. The scheduler executes cases in the same order as they are shown in case explorer from top to down including sub folders. You can change cases order in explorer by dragging and dropping and then editing and saving your schedule.