public static void EditUserInUserTable(string userType) { try { Ranorex.Cell cellUser = null; if (userType.ToLower() == "sqluser") { cellUser = repo.Application.TableSystemLoginsWhichBelong.FindSingle("//cell[@accessiblevalue='" + Constants.NewSqlUser + "']"); } else { cellUser = repo.Application.TableSystemLoginsWhichBelong.FindSingle("//cell[@accessiblevalue='" + Constants.NewWindowsUser + "']"); } cellUser.MoveTo(); //Thread.Sleep(2000); cellUser.Click(); //Thread.Sleep(2000); cellUser.DoubleClick(); Reports.ReportLog("Opened User in Edit mode Successfully ! ", Reports.SQLdmReportLevel.Success, null, Configuration.Config.TestCaseName); } catch (Exception ex) { throw new Exception("Failed : EditUserInUserTable : " + ex.Message); } }
public static void VerifyUserAdded(string userType) { try { string user = null; if (userType.ToLower().Equals(Config.NewSqlUser.ToLower())) { user = Config.NewSqlUser; } else { user = Config.NewWindowsUser; } repo.Application.TableSystemLoginsWhichBelongInfo.WaitForItemExists(200000); //Ranorex.Cell cellUser = repo.Application.TableSystemLoginsWhichBelong.FindSingle("/row[1]/cell[@accessiblevalue='"+ user +"']"); Ranorex.Cell cellUser = Host.Local.FindSingle <Ranorex.Cell>(@"/form[@title~'^Idera\ SQL\ diagnostic\ mana']/statusbar[@automationid='statusBar']//container[@automationid='viewContainer']/container[@automationid='windowsFormsHostControl']//container[@controlname='_child']//container[@controlname='ApplicationSecurityView_Fill_Panel']//table[@accessiblename~'^\ \ \ \ \ \ \ System\ logins,\ whi']/row[1]/cell[@accessiblevalue='" + user + "']"); if (cellUser.Text.ToLower().Equals(user.ToLower())) { cellUser.Click(); Reports.ReportLog("New User " + user + " Added Successfully ! ", Reports.SQLdmReportLevel.Success, null, Configuration.Config.TestCaseName); } else { Reports.ReportLog("New User " + user + " not Added : ", Reports.SQLdmReportLevel.Info, null, Configuration.Config.TestCaseName); Validate.Fail("New User not " + user + " Added Successfully"); } } catch (Exception ex) { throw new Exception("Failed : VerifyUserAdded : " + ex.Message); } }
//********************************************************************** /// <summary> /// Click to given items in the comoponet like List, Table and Tree. /// </summary> public static void Select_Item(LxScriptItem item) { object objComponet = item.getComponent(); RepoItemInfo objComponetInfo = item.getComponentInfo(); Type objType = objComponet.GetType(); //MessageBox.Show(objType.Name.ToString()); if (objType.Name.ToString() == "List") { RepoItemInfo targetListItemInfo = new RepoItemInfo(objComponetInfo.ParentFolder, "variableListItem", objComponetInfo.Path + "/listitem[@accessiblename='" + item.getArgText() + "']", 10000, null, System.Guid.NewGuid().ToString()); Ranorex.ListItem targetListItem = targetListItemInfo.CreateAdapter <Ranorex.ListItem>(true); targetListItem.Click(); } if (objType.Name.ToString() == "Table") { RepoItemInfo targetCellInfo = new RepoItemInfo(objComponetInfo.ParentFolder, "variableCell", objComponetInfo.Path + "/row/cell[@text='" + item.getArgText() + "']", 10000, null, System.Guid.NewGuid().ToString()); Ranorex.Cell targetCell = targetCellInfo.CreateAdapter <Ranorex.Cell>(true); targetCell.Click(); } if (objType.Name.ToString() == "Tree") { int treeLevel = Convert.ToInt32(item.getArgText()); string strTreelevel = ""; string strTreelevelCkb = ""; for (int i = 1; i <= treeLevel; i++) { strTreelevel += "/treeitem"; strTreelevelCkb += "/checkbox"; } RepoItemInfo targetTreeItemInfo = new RepoItemInfo(objComponetInfo.ParentFolder, "variableTreeItem", objComponetInfo.Path + strTreelevel + "[@accessiblename='" + item.getArg2Text() + "']", 10000, null, System.Guid.NewGuid().ToString()); if (targetTreeItemInfo.Exists()) { Ranorex.TreeItem targetTreeItem = targetTreeItemInfo.CreateAdapter <Ranorex.TreeItem>(true); targetTreeItem.Click(); } else { targetTreeItemInfo = new RepoItemInfo(objComponetInfo.ParentFolder, "variableTreeItem1", objComponetInfo.Path + strTreelevelCkb + "[@accessiblename='" + item.getArg2Text() + "']", 10000, null, System.Guid.NewGuid().ToString()); Ranorex.CheckBox targetTreeItemCkb = targetTreeItemInfo.CreateAdapter <Ranorex.CheckBox>(true); targetTreeItemCkb.Click(); } } }
public static void ClickThis(this Ranorex.Cell item) { try { item.Click(); Sleep(); } catch (Exception ex) { throw new Exception("Cell Click Failed : " + ex.Message); } }