public static Window firstWindow(this API_GuiAutomation guiAutomation) { guiAutomation.sleep(100); // needed on install wizards that change windows quite quickly var windows = guiAutomation.windows(); if (windows.size() > 0) { return(windows[0]); } return(null); }
public static Window window(this API_GuiAutomation guiAutomation, string windowName, int numberOfTries) { for (int i = 0; i < numberOfTries; i++) { var window = guiAutomation.window(windowName); if (window.notNull()) { "after {0} tries, found window with title: {1}".info(i, windowName); return(window); } guiAutomation.sleep(1000, false); } "after {0} tries, cound not find window with title: {1}".info(numberOfTries, windowName); return(null); }
public static Button button(this API_GuiAutomation guiAutomation, string text, int waitCount) { "Trying {0} times to find button '{1}'".info(waitCount, text); for (int i = 0; i < waitCount; i++) { guiAutomation.sleep(2000, true); // wait 2 secs and try again try { var button = guiAutomation.button(text); if (button.notNull()) { return(button); } } catch {} } "Could not find button '{0}'".error(text); return(null); }