2017-07-25 4 views
0

J'essaie d'automatiser une application en utilisant TestStack/White API (qui est basé sur la bibliothèque UI Automation de Microsoft).TestStack/White API

Le problème est le suivant:

À un certain moment de l'automatisation, je dois faire face à une fenêtre « Dialogue », qui semble être un processus distinct, si je regarde « Gestionnaire des tâches Windows ". Mais peu importe comment j'essaie d'accéder à la "fenêtre de dialogue" (classe, ID, texte, ControlType, etc.) je ne suis pas en mesure d'y accéder.

Vous pouvez trouver l'image UISpy et le code ci-dessous ...

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. 

Toutes les suggestions?

Répondre

0

trouvé la solution, a dû utiliser "ProcessStartInfo()" et transmettre les données de retour à "Application.AttachOrLaunch()":

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

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