Forum Discussion

melanieKno's avatar
melanieKno
Occasional Contributor
4 months ago

WaitForm() method?

I need to wait for a Form object below a java process. The caption of the form is dynamic that's why I cannot use NameMapping. 

In Python the code at the bottom returns "found" when the object is open, but how can I implement the same using a wait method? WaitForm() is not available. Sometimes it takes several minutes for the form until it's shown. 

def test():
process = Sys.Process("java")
caption = "ECH *"

formObject = process.Form(f"{caption}")
if formOjbect.Exists:
Log.Message("found")
else:
Log.Message("doesn't exist")

3 Replies

  • Marsha_R's avatar
    Marsha_R
    Champion Level 3

    Here are all your options for Wait

    https://support.smartbear.com/testcomplete/docs/app-objects/common-tasks/waiting-process-or-window-activation.html

     

    You can still use Name Mapping on a dynamic caption. Take a look at these options:

    https://support.smartbear.com/testcomplete/docs/reference/misc/using-wildcards.html

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    A Python example,

    p = Sys.Process("Notepad")
    # Waits for the window for 10 seconds
    w = p.WaitWindow("*", "Open*", -1, 10000)
    if w.Exists:
      w.Activate
      Log.Picture(w, "Open dialog picture")
    else:
      Log.Warning("Incorrect window")

    ...which is similar to what you have.