/// <summary> /// Checks if an item is enabled /// </summary> /// <param name="elementInfo">RepoItemInfo Path of element to check</param> /// <param name="timeout">Time to search fot the element in ms; /// if null then the default timeout 1000 is used</param> /// <returns>true if the element is enabled; false in all other cases</returns> public static bool checkEnabled(RepoItemInfo elementInfo, Duration timeout) { if (timeout == null) { timeout = 1000; } if (checkVisible(elementInfo, timeout)) { Report.Debug("The element " + elementInfo.ToString() + " seems to be enabled: " + element.Enabled.ToString()); return(element.Enabled); } else { Report.Debug("The element " + elementInfo.ToString() + " does not seem to be visible."); return(false); } }
/// <summary> /// Checks if an item is visible /// </summary> /// <param name="elementInfo">RepoItemInfo of element to check</param> /// <param name="timeout">Time to search fot the element in ms; /// if null then the default timeout 1000 is used</param> /// <returns>true if the element is visible; false in all other cases</returns> public static bool checkVisible(RepoItemInfo elementInfo, Duration timeout) { if (timeout == null) { timeout = 1000; } bool exists = Ranorex.Host.Local.TryFindSingle(elementInfo.AbsolutePath, timeout, out element); if (exists) { Report.Debug("The element " + elementInfo.ToString() + " seems to be visible: " + element.Visible.ToString()); return(element.Visible); } else { Report.Debug("The element " + elementInfo.ToString() + " does not seem to exist."); return(false); } }
public void MergeScreenshotAndWaitUntilDialogClosed(RepoItemInfo formInfo) { try { formInfo.WaitForExists(2000); Report.Screenshot(ReportLevel.Info, "User", "", formInfo.FindAdapter <Form>(), false); Report.Info("Waiting 4h to not exist. Associated repository item: 'formInfo'" + formInfo.ToString()); formInfo.WaitForNotExists(14400000); } catch (Exception) { } }