TestStack/White API

607 views Asked by At

I'm trying to automate an application using TestStack/White API (Which is based on Microsoft's UI Automation library).

The problem is the following:

At a certain point of automation, I have to deal with an "Dialog" window, which looks to be a separate process, if i look at "Windows Task Manager". But no matter how i try to access the "Dialog Window" (Class, ID, Text, ControlType, etc.) I'm not able to access it.

You can find the UISpy image and code below...

Using UISpy - Dialog Information

using (var DISCLAIMER_App = Application.Attach(@"PathToExecutable"))
                    using (var DISCLAIMER_Window = DISCLAIMER_App.GetWindow(SearchCriteria.ByClassName("#32770"), InitializeOption.NoCache))
                    {
                        var IAccept_button = DISCLAIMER_Window.Get<Button>(SearchCriteria.ByText("I accept"));
                        IAccept_button.Click();
                    } 
# I've tried also Application.Launch, Application.AttachOrLaunch.
# I also looked to be sure that the Dialog window is a separated process and doesn't belong to any parent window.

Any suggestions?

1

There are 1 answers

0
Mihai Iliuhin On

Found the Solution, had to use "ProcessStartInfo()" and pass the return data to "Application.AttachOrLaunch()":

 var psi = new ProcessStartInfo(@"PathToExecutable");
 using (var DISCLAIMER_App = Application.AttachOrLaunch(psi))

Source: http://techqa.info/programming/tag/white?after=24806697