WinAppDriver icon indicating copy to clipboard operation
WinAppDriver copied to clipboard

Is there a way to control pop up/new windows?

Open SimonKirkhamCL4U opened this issue 10 years ago • 3 comments

Using the driver I can open my application and click a button. The button however launches a new window. Looking at the webDriver.PageSource or trying to find element by the name show no sign of any of the controls of the new window. Is there a way to achieve this?

SimonKirkhamCL4U avatar Dec 01 '16 11:12 SimonKirkhamCL4U

Got it working sporadically. Using the the Selenium popupWindowFinder in the same way as you would a browser -

            _mainWindowHandle = _webDriver.CurrentWindowHandle;
            var finder = new PopupWindowFinder(_webDriver);
            var popupWindowHandle = finder.Click(SearchButton);

            _webDriver.SwitchTo().Window(popupWindowHandle); 

SimonKirkhamCL4U avatar Dec 01 '16 11:12 SimonKirkhamCL4U

I'm trying to use this method with Java in a WPF application, but it won't work. Can't switch between the pop-up and the main window. Is it because the application is WPF? If so is there any solutions?

hakkori avatar Jan 04 '17 08:01 hakkori

if you can't find the popup in your current session then it probably isn't parented to your application window. Could you use inspect.exe to check. If that's the case you'll need to create a desktop session to find your popup window. The other area is the find method being used and whether you can use a different element attribute and find method to find the window.

What you're wanting to do should work.

yodurr avatar Feb 16 '17 21:02 yodurr