Forum Discussion

cvanvlack's avatar
Occasional Contributor
5 months ago

What is the correct format for WaitWPFObject in Python?

Here is the name mapping when I use the object spy

I am running the application and getting the process with 

process <SPAN class="token operator">=</SPAN> TestedApps<SPAN class="token punctuation">.</SPAN>Virtek_Applications_ServerManager<SPAN class="token punctuation">.</SPAN>Run<SPAN class="token punctuation">(</SPAN>count<SPAN class="token punctuation">,</SPAN> ignore_running<SPAN class="token punctuation">,</SPAN> timeout_ms<SPAN class="token punctuation">)</SPAN>

and attempting to make sure it exists via

 o <SPAN class="token operator">=</SPAN> process<SPAN class="token punctuation">.</SPAN>WaitWPFObject<SPAN class="token punctuation">(</SPAN><SPAN class="token string">'WPFObject("HwndSource: ShellView", "Virtek Iris")'</SPAN><SPAN class="token punctuation">,</SPAN> timeout_ms<SPAN class="token punctuation">)</SPAN>


o<SPAN class="token punctuation">.</SPAN>Exists

is returning False even though the application is definitely open.

Here are the docs I have been using for reference,

However, the WaitWPFObject doc doesn't actually have a code snippet example to follow. 


  • This was SUPER helpful. Thank you very much!!

    Here is what I learned after using this example. 

    1. Basically, whatever arguments you can get to work for the WPFObject Method, you need to use the exact same arguments for the WaitWPFObject Method.

    2. I had misread the API and thought the WndCaption was optional. So I passed the ClassName, but left off the WndCaption so the function overloaded to assume I was passing in the Name.

    So when I was using 

    p = Sys.Process("VirtekIrisClient")
    o = p.WaitWPFObject("HwndSource: ShellView",timeout_ms)

    It wouldn't work. When I used

    p = Sys.Process("VirtekIrisClient")
    o = p.WaitWPFObject("HwndSource: ShellView","Virtek Iris",timeout_ms)

    It worked.

9 Replies

  • rraghvani's avatar
    Champion Level 3

    I have no idea what process <SPAN class="token operator">... is about?

    It will be something along the lines of,

    Sys.Process("VirtekIrisClient").WaitWPFObject("WPFObject", "HwndSource: ShellView", 5000)

    This will wait up to 5 seconds for the object "WPFObject" to appear with the caption "HwndSource: ShellView"

    • cvanvlack's avatar
      Occasional Contributor

      Thanks for the response! I have absolutely no idea what happened with those code blocks as that's not what I had put there... I'll try to edit the original message to try to fix it.

      • cvanvlack's avatar
        Occasional Contributor

        The code blocks keep adding that stupid span object. Here's the actual code.
        p = TestedApps.Virtek_Applications_ServerManager.Run(count, ignore_running, timeout_ms)
        o = p.WaitWPFObject('WPFObject("HwndSource: ShellView", "Virtek Iris")', timeout_ms)