public void CheckMatrixNamesAdapter(Ranorex.Adapter adapter, int expCount, int loopCount) { adapter.Click(); adapter.Click(); Delay.Seconds(1); var items = adapter.Children[3].Children[0].Children[0].Children; if (items.Count == expCount) { var actualItem = ""; for (int i = 0; i < loopCount; i++) { actualItem = items[i].Element.GetAttributeValueText("Text"); if (!actualItem.Equals(_expectedNames[i])) { Report.Info("Index: " + i); Report.Failure(String.Format("Matrix combobox item with index: {0} does not equal to expected value. Actual: {1}, Expected: {2}", i, actualItem, _expectedNames[i])); } else { Report.Success(String.Format("Matrix combobox item with index: {0} equals to expected value. Actual: {1}, Expected: {2}", i, actualItem, _expectedNames[i])); } } } else { Report.Failure(String.Format("Matrix Selection combobox contains {0} items, expected: 26", items.Count)); } }
public void VerifyListItemDropdown(Ranorex.Adapter dpdwnData, string[] itemValues, string dpdwnName) { int k = 0; dpdwnData.Click(); var cmbbxData = dpdwnData.As <Ranorex.ComboBox>(); //cmbbxData.Click(); IList <Ranorex.ListItem> listitems = cmbbxData.Items; foreach (string item in itemValues) { foreach (Ranorex.ListItem val in listitems) { // Report.Info(val.Text.ToString()); if (val.Text.Equals(item)) { //item.Click(); Report.Success(String.Format("Value \"{0}\" Present as expected in \"{1}\" dropdown", item, dpdwnName)); k++; //break; } } } // Report.Info(k.ToString()); // Report.Info(itemValues.Length.ToString()); if (k == itemValues.Length) { Report.Success(String.Format("{0} Values present for selection in \"{1}\" dropdown as expected", itemValues.Length, dpdwnName)); } else { Report.Failure(String.Format("{0} Values not present for selection in \"{1}\" dropdown as expected", itemValues.Length, dpdwnName)); } dpdwnData.Click(); }
public void SelectItemDropdown(Ranorex.Adapter dpdwnData, string itemValue, string dpdwnName) { int k = 0; dpdwnData.Click(); var cmbbxData = dpdwnData.As <Ranorex.ComboBox>(); //cmbbxData.Click(); IList <Ranorex.ListItem> listitems = cmbbxData.Items; Delay.Milliseconds(500); foreach (Ranorex.ListItem item in listitems) { if (item.Text.Equals(itemValue)) { item.Click(); Report.Success(String.Format("Value \"{0}\" Selected as expected in \"{1}\" dropdown", itemValue, dpdwnName)); k++; break; } } if (k == 0) { Report.Failure(String.Format("Value \"{0}\" not present for selection in \"{1}\" dropdown", itemValue, dpdwnName)); } }
public void InputLimit(string limit, Ranorex.Adapter adapter) { adapter.Click(); Report.Log(ReportLevel.Info, "Keyboard", "Key sequence '{LControlKey down}{Akey}{LControlKey up}'."); Keyboard.Press("{LControlKey down}{Akey}{LControlKey up}"); Keyboard.Press(limit); }
public void Click_fn(Ranorex.Adapter repoObj) { repoObj.Click(); Report.Screenshot(); Report.Success(repoObj.Element.GetAttributeValueText("accessiblename") + "is clicked."); }
public void Action() { pre.MainForm.Self.Activate(); pre.MainForm.OfficeModule.Click(); pre.MainForm.OfficeModuleHeaderInfo.WaitForExists(customWaitTime); // int i = 0; // while (i < 5) // { // pre.MainForm.Preferences.Click(); // i++; // } try { pre.MainForm.Preferences.Click(); pre.MainForm.PreferencesForm.SelfInfo.WaitForExists(customWaitTime); } catch (Exception) { pre.MainForm.Preferences.Click(); } foreach (var prefItem in pre.MainForm.PreferencesForm.SelfInfo.Children) { Ranorex.Adapter itemAdapter = prefItem.CreateAdapter <Ranorex.Text>(true); // pre.MainForm.PreferencesForm.MyProfile.ty // Report.Log(ReportLevel.Info, "Pref Item Actions: " + itemAdapter.Element.Actions); // Report.Log(ReportLevel.Info, "Pref Item: " + itemAdapter.GetPath()); // Report.Log(ReportLevel.Info, "Pref Item: " + itemAdapter.GetType()); // pre.MainForm.PreferencesForm.Self.Focus(); try { itemAdapter.Click(); pre.GeneralPreferencesForm.GeneralPreferencesFormInfo.WaitForExists(customWaitTime); } catch (Exception) { if (!pre.GeneralPreferencesForm.GeneralPreferencesFormInfo.Exists()) { itemAdapter.Click(); } else { Report.Log(ReportLevel.Failure, "Preference Item Click failed"); } } try { // Report.Log(ReportLevel.Info, "Preference form active? " + pre.GeneralPreferencesForm.GeneralPreferencesForm.Active); pre.GeneralPreferencesForm.ButtonOKInfo.WaitForExists(customWaitTime); pre.GeneralPreferencesForm.ButtonOKInfo.WaitForAttributeEqual(customWaitTime, "Enabled", true); pre.GeneralPreferencesForm.ButtonOK.Click(); pre.GeneralPreferencesForm.GeneralPreferencesFormInfo.WaitForNotExists(customWaitTime); } catch (Exception) { if (pre.GeneralPreferencesForm.ButtonOKInfo.Exists()) { pre.GeneralPreferencesForm.ButtonOK.Click(); } else { Report.Log(ReportLevel.Failure, "Failed to click OK button to close the Preference form"); } } } //Email Preference Open and Close try { pre.MainForm.Email.Click(); pre.EmailPreferencesForm.SelfInfo.WaitForExists(customWaitTime); } catch (Exception) { if (!pre.EmailPreferencesForm.SelfInfo.Exists()) { pre.MainForm.Email.Click(); } } try { pre.EmailPreferencesForm.CloseInfo.WaitForExists(customWaitTime); pre.EmailPreferencesForm.CloseInfo.WaitForAttributeEqual(customWaitTime, "Enabled", true); pre.EmailPreferencesForm.Close.Click(); pre.EmailPreferencesForm.SelfInfo.WaitForNotExists(customWaitTime); } catch (Exception) { if (pre.EmailPreferencesForm.CloseInfo.Exists()) { pre.EmailPreferencesForm.Close.Click(); } } try { pre.MainForm.CalendarContacts.Click(); pre.GeneralPreferencesForm.GeneralPreferencesFormInfo.WaitForExists(customWaitTime); } catch (Exception) { if (!pre.GeneralPreferencesForm.GeneralPreferencesFormInfo.Exists()) { pre.MainForm.CalendarContacts.Click(); } } try { // Report.Log(ReportLevel.Info, "Preference form active? " + pre.GeneralPreferencesForm.GeneralPreferencesForm.Active); pre.GeneralPreferencesForm.ButtonOKInfo.WaitForExists(customWaitTime); pre.GeneralPreferencesForm.ButtonOKInfo.WaitForAttributeEqual(customWaitTime, "Enabled", true); pre.GeneralPreferencesForm.ButtonOK.Click(); pre.GeneralPreferencesForm.GeneralPreferencesFormInfo.WaitForNotExists(customWaitTime); } catch (Exception) { if (pre.GeneralPreferencesForm.ButtonOKInfo.Exists()) { pre.GeneralPreferencesForm.ButtonOK.Click(); } else { Report.Log(ReportLevel.Failure, "Failed to click OK button to close the Preference form"); } } }
public void InputObservation(string observationStr, Ranorex.Adapter adapter) { adapter.Click(); Keyboard.Press(observationStr); }
public void EnterFileToImport(Ranorex.Adapter adapter) { adapter.Click(); Keyboard.Press(Path.Combine(HelperConstants.getExeAssemblyPath(), @"Inputs\ImportMeasurements\ELISA Absorbance_20180126_145323.xlsx")); }