public static bool ClickThis(this Ranorex.MenuItem item) { System.Threading.Thread.Sleep(200); item.Click(); System.Threading.Thread.Sleep(200); return(true); }
public static void ClickThis(this Ranorex.MenuItem item) { try { item.Click(); Sleep(); } catch (Exception ex) { throw new Exception("MenuItem Click Failed : " + ex.Message); } }
public static bool DoEnable(ListItem item, bool isEnable) { bool isActionSucceeded = false; if (isEnable) { // do enable item.Click(System.Windows.Forms.MouseButtons.Right); Delay.Milliseconds(1000); // select disable Ranorex.MenuItem menuitem = repo.ContextMenu.Self.FindSingle <Ranorex.MenuItem>("./?/?/menuitem[@accessiblename='Enable']"); menuitem.Click(); int i = 0; do { Delay.Milliseconds(3000); Text text = item.FindSingle <Text>("./text[@childindex=3]"); string status = text.TextValue; if (status != "Not connected" && status != "Identifing..." && status != "Disabled" && status != "Network cable unplugged" && status != "Unidentified network") { isActionSucceeded = true; break; } i++; }while(i < 3); } else { // do disable item.Click(System.Windows.Forms.MouseButtons.Right); Delay.Milliseconds(1000); // select disable Ranorex.MenuItem menuitem = repo.ContextMenu.Self.FindSingle <Ranorex.MenuItem>("./?/?/menuitem[@accessiblename='Disable']"); menuitem.Click(); int i = 0; do { Delay.Milliseconds(3000); Text text = item.FindSingle <Text>("./text[@childindex=3]"); string status = text.TextValue; if (status == "Disabled") { isActionSucceeded = true; break; } i++; }while(i < 3); } return(isActionSucceeded); }
public static void SelectConnectRepoOption() { try { Ranorex.MenuItem fileMenuItem = FILECONNECT_MENU; if (fileMenuItem != null) { fileMenuItem.ClickThis(); } Reports.ReportLog("SelectConnectRepoOption", Reports.SQLdmReportLevel.Success, null, Config.TestCaseName); } catch (Exception ex) { throw new Exception("Failed : SelectConnectRepoOption :" + ex.Message); } }
public static void SelectGroomingOption() { try { Ranorex.MenuItem groomingMenuItem = GROOMING_MENU; if (groomingMenuItem != null) { groomingMenuItem.ClickThis(); } Reports.ReportLog("SelectGroomingOption", Reports.SQLdmReportLevel.Success, null, Config.TestCaseName); } catch (Exception ex) { throw new Exception("Failed : SelectGroomingOption :" + ex.Message); } }
public static void SelectMaintainceModeMenuItem() { try { Ranorex.MenuItem snoozeMenuItem = MAINTAINANCEMODE_MENU; if (snoozeMenuItem != null) { snoozeMenuItem.ClickThis(); Reports.ReportLog("Selected SelectMaintainceModeMenuItem MenuItem", Reports.SQLdmReportLevel.Success, null, Config.TestCaseName); } else { Reports.ReportLog("MenuItem SelectMaintainceModeMenuItem not Selected", Reports.SQLdmReportLevel.Info, null, Config.TestCaseName); } } catch (Exception ex) { throw new Exception("Failed : SelectMaintainceModeMenuItem :" + ex.Message); } }
public static void SelectSnoozeAlertMenuItem() { try { Ranorex.MenuItem snoozeMenuItem = SNOOZEALERT_MENU; if (snoozeMenuItem != null) { snoozeMenuItem.ClickThis(); Reports.ReportLog("Selected SnoozeAlert MenuItem", Reports.SQLdmReportLevel.Success, null, Config.TestCaseName); } else { Reports.ReportLog("MenuItem SnoozeAlert not Selected", Reports.SQLdmReportLevel.Info, null, Config.TestCaseName); } } catch (Exception ex) { throw new Exception("Failed : SelectSnoozeAlertMenuItem :" + ex.Message); } }
public static void ResumeAlertMenuItem() { try { Ranorex.MenuItem resumeAlert = RESUMEALERT_MENU; if (resumeAlert != null && resumeAlert.Enabled) { resumeAlert.ClickThis(); repo.SnoozeAlertsDialog.OkButton.ClickThis(); Reports.ReportLog("Selected ResumeAlert MenuItem", Reports.SQLdmReportLevel.Success, null, Config.TestCaseName); } else { Reports.ReportLog("MenuItem ResumeAlert not Selected", Reports.SQLdmReportLevel.Info, null, Config.TestCaseName); } } catch (Exception ex) { throw new Exception("Failed : ResumeAlertMenuItem :" + ex.Message); } }
public static void VerifySnoozeAlertApplied() { try { Ranorex.MenuItem snoozeMenuItem = SNOOZEALERT_MENU; Report.Info(snoozeMenuItem.Enabled.ToString()); if (!snoozeMenuItem.Enabled) { Reports.ReportLog("SnoozeAlert is applied successfully ! ", Reports.SQLdmReportLevel.Success, null, Config.TestCaseName); } else { Reports.ReportLog("SnoozeAlert Not applied successfully. ", Reports.SQLdmReportLevel.Success, null, Config.TestCaseName); Validate.Fail("SnoozeAlert Not applied successfully."); } } catch (Exception ex) { throw new Exception("Failed : VerifySnoozeAlertApplied :" + ex.Message); } }
public static Ranorex.MenuItem GetMenunItem(this Ranorex.ContextMenu treeitem, string dbkey) { Ranorex.MenuItem item = null; try { foreach (var itemtree in treeitem.Items) { if (itemtree.Text.Trim() == dbkey) { item = itemtree; System.Threading.Thread.Sleep(500); break; } } } catch (Exception ex) { throw new Exception("ContextMenu Get Menun Item Failed : " + ex.Message); } return(item); }
public static void Click_On_BiModaluserGuide(string _marketname, string buildname) { string FSW_PageURL = ""; Ranorex.ContextMenu HelpMenuItems = "/contextmenu[@processname='SmartFit' and @win32ownerwindowlevel='1']"; IList <MenuItem> All_MenuItems = HelpMenuItems.FindChildren <MenuItem>(); for (int k = 0; k <= All_MenuItems.Count - 1; k++) { int k1 = k + 1; Ranorex.MenuItem HelpMenuText = "/contextmenu[@processname='SmartFit' and @win32ownerwindowlevel='1']/menuitem[" + k1 + "]"; string txt = HelpMenuText.Text; if (txt != null) { if (txt == "Bimodal Fitting Guide") { Mouse.Click(HelpMenuText); Delay.Seconds(6); IList <Ranorex.WebDocument> AllDoms = Host.Local.FindChildren <Ranorex.WebDocument>(); foreach (WebDocument myDom in AllDoms) { if (myDom.Page.Contains("Bimodal")) { FSW_PageURL = myDom.PageUrl; myDom.Close(); break; } } break; } } } Ranorex.MenuItem HelpButtonclick = "/form[@title~'Smart Fit' or @title~'Solus Max' or @title~'Audigy']/contextmenu/menuitem[@automationid='MenuAutomationIds.HelpAction']"; string Excel_Preference = ""; string excelFinalPath = ""; buildname = buildname.Replace(" ", string.Empty); buildname = buildname.ToLower(); if (buildname.Contains("smartfit")) { excelFinalPath = @"D:\TFS\FSW\TestSuites\Market_Preferences\Mkt Preferences_Smart Fit.xlsx"; } else if (buildname.Contains("audigy")) { excelFinalPath = @"D:\TFS\FSW\TestSuites\Market_Preferences\Mkt Preferences_Audigy.xlsx"; } //string excelFinalPath = @"D:\TFS\FSW\TestSuites\Market_Preferences\Mkt Preferences_Smart Fit.xlsx"; Microsoft.Office.Interop.Excel.Application application = new Microsoft.Office.Interop.Excel.Application(); XLS.Workbook workBook = application.Workbooks.Open(excelFinalPath); Excel.Worksheet worksheet = (Excel.Worksheet)workBook.Worksheets[3]; for (int i = 2; i <= 70; i++) { object cellValue = ((Microsoft.Office.Interop.Excel.Range)worksheet.Cells[3, i]).Value; if (cellValue != null) { string _Excel_Bimodal_Value = cellValue.ToString(); if (_Excel_Bimodal_Value == "Bimodal User Guide") { for (int j = 2; j <= 50; j++) { string Marketname = ""; object cellValue2 = ((Microsoft.Office.Interop.Excel.Range)worksheet.Cells[j, 1]).Value; if (cellValue2 != null) { Marketname = cellValue2.ToString(); _marketname = _marketname.Replace(" ", string.Empty); Marketname = Marketname.Replace(" ", string.Empty); if (Marketname == "UK") { Marketname = "United Kingdom"; } if (Marketname == "USA") { Marketname = "United States"; } } // Marketname=Marketname.Replace(" ",string.Empty); // _marketname=_marketname.Replace(" ",string.Empty); Marketname = Marketname.Replace(" ", string.Empty).Replace("InternationalBusiness", "International"); _marketname = _marketname.Replace(" ", string.Empty).Replace("InternationalBusiness", "International"); if (_marketname != null) { object cellValue3 = ((Microsoft.Office.Interop.Excel.Range)worksheet.Cells[j, i]).Value; if (cellValue3 != null) { Excel_Preference = cellValue3.ToString(); } } } } } } string Excel_Preference2 = Excel_Preference; Excel_Preference = Excel_Preference.Substring(0, Excel_Preference.LastIndexOf(":")); Excel_Preference = Excel_Preference.Replace("embedded", string.Empty).Replace("PDF", string.Empty).Replace(" ", string.Empty); if (FSW_PageURL.Contains(Excel_Preference)) { Report.Success("Bimodal User Guide Validation is success"); } else { Report.Failure("Bimodal User Guide of Excel file :" + Excel_Preference2 + " -is different from Bimodal User Guide edirection PDF :" + FSW_PageURL); } workBook.Close(0); application.Quit(); }