Frage

I am using White Framework for automation. when I trying to get desktop instance I got exception "The type initializer for 'White.Core.Desktop' threw an exception."

My code looks like :

var window = White.Core.Desktop.Instance.Windows().Find(obj => obj.Title.Contains("TestAppHome"));

Is there any way to capture the window without exception that is without using White.Core.Desktop class?

Any help would be greatly appreciated !

War es hilfreich?

Lösung

Try this one:

List<White.Core.UIItems.WindowItems.Window> windows = WindowFactory.Desktop.DesktopWindows();
var window = windows.Find(w => w.Title.Contains("TestAppHome"));

Andere Tipps

Try this. You can directly launch the target application and get it's UI elements rather than search all UI elements in Desktop. I think this is very efficient.

static void Main(string[] args) {

        Application app = Application.Launch(@"C:\Testing\Sample.txt");  //Target application 
        var appWindow = app.GetWindow("Sample - Notepad");
        appWindow.RightClick();
        PopUpMenu popupMenu = appWindow.Popup;
        var saveOptionMenuItem = popupMenu.ItemBy(SearchCriteria.ByText("Open IME"));
        saveOptionMenuItem.Click();

    }
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top