Watch and Set Credentials in Browser

Watches for any dialog boxes used for credential filling and automatically fills in the credentials.

Command availability: IBM RPA SaaS and IBM RPA on premises

Description

This command watches for any dialog boxes used for credential filling and automatically fills in the credentials with the username and password defined, or cancels the dialog box.

Script syntax

IBM RPA's proprietary script language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.

watchAndSetBrowserCredentials --browser(Browser) [--cancel(Boolean)] [--cancelxpath(String)] --username(String) --password(String) [--usernamexpath(String)] [--passwordxpath(String)] [--stopaftersignin(Boolean)] [--interval(TimeSpan)] (CancellationTokenSource)=value

Input parameter

The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.

Designer mode label Script mode name Required Accepted variable types Description
Browser browser Required Browser Variable of type "Browser" that stores the instance of a browser.
Cancel Dialog Box cancel Optional Boolean Enable to cancel the dialog box when it appears.
XPath Cancel Button cancelxpath Optional Text XPath of the Cancel button in the dialog box.
User Name username Required when the Cancel Dialog Box parameter is disabled Text Login user name.
Password password Required when the Cancel Dialog Box parameter is disabled Text Login password.
XPath User Field usernamexpath Optional Text XPath to the username field. If left blank, the field considers the pages default XPath. Otherwise, it overwrites the current XPath.
XPath Password Field passwordxpath Optional Text The XPath to the password field. If left blank, the field considers the pages default XPath. Otherwise, it overwrites the current XPath.
Stop After Filling stopaftersignin Optional Boolean Enable to stop watching for dialog boxes after filling in the credentials.
Interval interval Optional Time Span Time interval between each attempt to complete the credential. By default, the interval is 5 seconds.

Output parameter

Designer mode label Script mode name Accepted variable types Description
Cancellation Token Source value Cancellation Token Source Returns a cancellation token source indicating if the action was interrupted.

🛈 Remember: To use this output, you must use the Cancel Token Source (cancelToken) command. If the Stop After filling parameter is enabled, it is not necessary to use the cancellation token, as the process is interrupted automatically.

Example

The Watch and Set Credentials in Browser command fills in the credentials fields after the bot opens a server URL using the Navigate (webNavigate) command. The Wait for Web Page Requests (webWait) command gives the bot time to find and select the dialog box.

defVar --name cancellationToken --type CancellationTokenSource
defVar --name browser --type Browser
defVar --name web01 --type String --value "Google Chrome\r\n"
webStart --name "${web01}" --type "Chrome" browser=value
webNavigate --url "ftp://ftp.dlptest.com/"
watchAndSetBrowserCredentials --browser ${browser} --username "dlpuser@dlptest.com" --password bbCKucPzfr4b9YXUY7tvsNKyh cancellationToken=value
webWait
webClose --name "${web01}" --leavebrowseropen

Limitations

  • The command runs in the background and must run before any interaction with a web page (Navigation or Click on Web Page, for example), otherwise the command will fail. If the Stop After Filling parameter is not enabled, the command won't stop looking for a dialog box.
  • The command currently only supports English and Portuguese.
  • The command currently only supports Google Chrome and Internet Explorer.