S.Roshanth
S.Roshanth

Reputation: 1507

White Automation framework throws an exception when using "White.Core.Desktop" Class

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 !

Upvotes: 1

Views: 2234

Answers (2)

Shiran Jayawardena
Shiran Jayawardena

Reputation: 509

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();

    }

Upvotes: 0

drets
drets

Reputation: 2805

Try this one:

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

Upvotes: 0

Related Questions