This is UltimateRPA Documentation
Vault

Managing login details

To work with passwords, the robot has features to communicate with the credential vault (Windows Vault), allowing new login details to be saved and also to be loaded so that the robot can be used to log in to applications. By using these features, you avoid typing passwords directly into the robotic script. You can manage the saved access details in Credential Manager.

Saving passwords

It is advisable to save passwords in the vault in a special script. The function set_password is used to save a password.

Below we illustrate how to use the vault to log in to RpaLoginTest, so "RpaLoginTest" is used as the system parameter. The Username "RPA_test_user" and the Password "12345" are used to log in successfully.

In PyScripter, create a new file and save it. Import the urpa module into the script first. In the main function, invoke set_password.

import urpa
def main():
urpa.set_password("RpaLoginTest", "RPA_test_user", "12345")

Press the keyboard shortcut ALT + F9 to run the script that saves the login details for the address "RpaLoginTest" in the credential vault. A password needs to be saved separately for each user using the script with the access data in question because the credential manager saves the passwords separately for each user.

Logging in to applications

To extract a password from the vault, invoke the function get_password. We illustrate how to use the function to log into RpaLoginTest. In PyScripter, create a new file and save it. Import the urpa module into the script first, save the username used for login in the global variable and create an instance of the class ConditionFactory.

import urpa
USERNAME = "RPA_test_user"

In the main function definition, run RpaLoginTest by invoking exec_app. Using the method find_first, find the username edit box. Using the method send_text, send the name login to the edit box found. The value written to the username edit box is stored in the internal value value (this is evident by using Inspector). By invoking it, you can check that the value is entered correctly.

import urpa
USERNAME = "RPA_test_user"
def main():
app = urpa.exec_app("TutorialApps/RpaLoginTest.exe")
user_box = app.find_first(cf.edit().name("Username"))
user_box.send_text(USERNAME)

The path to an app "TutorialApps/RpaLoginTest.exe" is relative to the script file directory and assumes script is placed in the main directory of UltimateRPA tools. If your script is saved elsewhere, remember to change the path.

After running the script, you should see the application turn on and the username edit box filled in.

RpaLoginTest.png
Figure 1 RpaLoginTest window
Vault_username_filled.png
Figure 2 Username filled in

Find the password edit box in the same way and invoke get_password to get a password from the credential vault. Write this to the edit box by invoking the method send_text. Verify that the password is entered correctly by attempting to log in. Find the login button and click on it by using the method send_mouse_click. Try to find the message "Login was successful" as verification that the login was successful

import urpa
USERNAME = "RPA_test_user"
def main():
app = urpa.exec_app("TutorialApps/RpaLoginTest.exe")
user_box = app.find_first(cf.edit().name("Username"))
user_box.send_text(USERNAME)
pass_box = app.find_first(cf.edit().name("Password"))
pass_box.send_text(urpa.get_password("RpaLoginTest", USERNAME))
app.find_first(cf.button().name("Login")).send_mouse_click()
app.find_first(cf.regexp("^Login was successful"))

Finally, save and run the entire script.

Vault_password_filled.png
Figure 3 Password filled in
Vault_login_successful.png
Figure 4 Successful login