WinAppDriver icon indicating copy to clipboard operation
WinAppDriver copied to clipboard

Unable to Switch control between multiple windows of a Windows Application

Open angad16 opened this issue 6 years ago • 4 comments

Hi , i am trying to automate a windows application, while doing so i faced an issue the scenario was :

  1. The application has a button , clicking on it will open a new window.
  2. I want to perform some actions on the window but when i tried to move my control to the new window by Using : Set windowHandles = driver.getWindowHanldes(); windowHanldes.switchTo.window(); the set only had one window in it.

I also Tried using PopUpWindowFinder but was not able to use the class maybe because it is not supported for Java.

Can you please tell me how can i switch my driver focus to other window?

angad16 avatar Jan 27 '20 12:01 angad16

@angad16 I use workaround to attach to new window by process name or window name https://github.com/microsoft/WinAppDriver/issues/534#issuecomment-562030077 Then attach to previous window with the same code.

But this is c# code :(

Shakevg avatar Jan 28 '20 18:01 Shakevg

If the switchTo() method is not working, try calling the Click() method on the other window. I've worked with an Excel Ad In where all Ad-in popups were parented by the Desktop and I found them using a "Root" session. You may try that as well.

naeemakram avatar Jan 29 '20 12:01 naeemakram

Thanks @naeemakram i was able to switch controls by creating new Desktop Session as mentioned in below issue. Do we have possibility switch between apps during test executions? #445

angad16 avatar Jan 30 '20 10:01 angad16

I believe yes, we can create multiple instances of WindowsDriver to automate the UI of different applications. This is a unique strength I must say.

naeemakram avatar Jan 30 '20 17:01 naeemakram