Forum Discussion

m_essaid's avatar
m_essaid
Valued Contributor
6 years ago

Switch TestComplete's focus among processes

Hi,

 

I have 2 processes that opens 2 forms side by side. Visualy, there isn't a form that overlaps another.

I have to focus on the left form, but it says :

 

Unexpected window: 'theRightForm'

 

So before acting on this form i'm trying to set the focus, but I didn't manage to do so.

 

I tried :

Aliases.MyProcess.MyForm.Activate()

or

Aliases.MyProcess.MyForm.SetFocus()

or

Aliases.MyProcess.MyForm.Click()

 

Anyone could advise please ?

 

Thank you,

 

Mehdi

  • You can, in the project, check the option to ignore unexpected windows.  Will this resolve things?  It's possible that the unexpected window handler is preventing the additional clicks.

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    If the RightForm is modal in any way, while it doesn't overlap, it will still be an "unexpected window".

    • m_essaid's avatar
      m_essaid
      Valued Contributor

      Hi Robert,

      But when I manualy clic on the left window the test succeed...

      I wish I could make the robot do this click.

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        You can, in the project, check the option to ignore unexpected windows.  Will this resolve things?  It's possible that the unexpected window handler is preventing the additional clicks.