Windows Desktop Automation Id | No Dialog Open

How to use RPA.Desktop.Windows Mouse Click without the need of Open Executable before using it?

When I call Mouse Click with Automation Id, “ValueError: No dialog open” error is shown.
I need do quick repeatable testing with RPA.Desktop.Windows Automation Id when using code like:

Mouse Click    id:500

Although I can do like:

*** Tasks ***
test click
    Open Executable    C:/abc.exe
    Mouse Click    id:1
    Type Keys    hello

it is slow to reopen the application everytime with Open Executable
and when run without Open Executable first, the error “ValueError: No dialog open” is shown.

Unlike RPA.Desktop where the

    Click    alias:imageAbc

doesn’t need the target application to be opened by itself; I can just manually open the application first, navigate to specific menu, and then only do testing by running the robot against the opened application.
Is there a way to achieve the similar approach for RPA.Desktop.Windows ?

(and I need use both library RPA.Desktop.Windows and RPA.Desktop for targeting elements with Automation Id and elements by image respectively.)

I think you need to activate the window, so all clicks and presses are going to active window. There is Connect By Handle keyword what you can use to get window activated. Did small test with calculator app:

*** Settings ***
Library         RPA.Desktop.Windows
*** Variables ***
${HANDLE}    0
${TITLE}    Calculator
*** Tasks ***
Minimal task
    @{windows}    Get Window List
    FOR  ${window}  IN  @{windows}
        ${found}=   Run Keyword And Return Status  Should Contain  '${window}[title]'  ${TITLE}    
        IF  ${found}
            Set Task Variable  ${HANDLE}    ${window}[handle]
    ${appid}=   Connect By Handle   ${HANDLE}
    #Switch To Application    ${appid}
    Mouse Click    num8Button
1 Like

Really late comment here. I am wondering how you could have used Open Executable keyword without giving required parameter windowtitle which is required to get handle on the application window… ?