Search code examples
robotframeworkautoit

How to use Wingethandle in Robot framework


I try to use this in Robot framework

@{Title} = Win get handle("[ACTIVE]")

But It seem doesn't work.I need some Example for this command.

Please Help Sorry for my poor Grammar

**ERROR**
Cannot set variable '@{Title}': Expected list-like value, got string.

Solution

  • When running keywords, you don't use parentheses after the keyword to submit parameters. Instead use:

    ${Title}= Win Get Handle [ACTIVE]

    The [ACTIVE] parameter is automatically submitted as a string.

    Also, notice that I changed @{Title} into ${Title}. That is because @ denotes a list variable that expects a list return from the keyword. Apparently the Win get handle returns a String variable, which shall be assigned to a scalar $-denoted variable.

    Lastly, I'm not sure if you're using Win Get Handle correctly. To my understanding the implementation for that keyword would return a handle to a window (a unique identifier to run further actions against it) rather than its title.