The Dialogs library provides a way to display information to a user and request input while a robot is running. It allows building processes that require human interaction.

Some examples of use-cases could be the following:

  • Displaying generated files after an execution is finished
  • Displaying dynamic and user-friendly error messages
  • Requesting passwords or other personal information
  • Automating based on files created by the user

Workflow

The library is used to create dialogs, i.e. windows, that can be composed on-the-fly based on the current state of the execution.

The content of the dialog is defined by calling relevant keywords such as Add text or Add file input. When the dialog is opened the content is generated based on the previous keywords.

Depending on the way the dialog is started, the execution will either block or continue while the dialog is open. During this time the user can freely edit any possible input fields or handle other tasks.

After the user has successfully submitted the dialog, any possible entered input will be returned as a result. The user also has the option to abort by closing the dialog window forcefully.

Results

Each input field has a required name argument that controls what the value will be called in the result object. Each input name should be unique, and must not be called submit as that is reserved for the submit button value.

A result object is a Robot Framework DotDict, where each key is the name of the input field and the value is what the user entered. The data type of each field depends on the input. For instance, a text input will have a string, a checkbox will have a boolean, and a file input will have a list of paths.

If the user closed the window before submitting or there was an internal error, the library will raise an exception and the result values will not be available.

Examples

Success dialog
    Add icon      Success
    Add heading   Your orders have been processed
    Add files     *.txt
    Run dialog    title=Success

Failure dialog
    Add icon      Failure
    Add heading   There was an error
    Add text      The assistant failed to login to the Enterprise portal
    Add link      https://robocorp.com/docs    label=Troubleshooting guide
    Run dialog    title=Failure

Large dialog
    Add heading    A real chonker   size=large
    Add image      fat-cat.jpeg
    Run dialog     title=Large    height=1024    width=1024

Confirmation dialog
    Add icon      Warning
    Add heading   Delete user ${username}?
    Add submit buttons    buttons=No,Yes    default=Yes
    ${result}=    Run dialog
    IF   $result.submit == "Yes"
        Delete user    ${username}
    END

Input form dialog
    Add heading       Send feedback
    Add text input    email    label=E-mail address
    Add text input    message
    ...    label=Feedback
    ...    placeholder=Enter feedback here
    ...    rows=5
    ${result}=    Run dialog
    Send feedback message    ${result.email}  ${result.message}

Dialog as progress indicator
    Add heading    Please wait while I open a browser
    ${dialog}=     Show dialog    title=Please wait    on_top=${TRUE}
    Open available browser    https://robocorp.com
    Close dialog   ${dialog}