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); }
public static bool hasButton(this API_GuiAutomation guiAutomation, string text) //search on the first window { return(guiAutomation.button(text).notNull()); }