public UIElementJavaPlatformPage(ActUIElement Action) { InitializeComponent(); mAction = Action; if (mAction.ElementType.ToString() == eElementType.Table.ToString()) { if (mAction.GetInputParamValue(ActUIElement.Fields.ControlAction) == ActUIElement.eElementAction.Click.ToString()) { mAction.AddOrUpdateInputParamValue(ActUIElement.Fields.WaitforIdle, ActUIElement.eWaitForIdle.Medium.ToString()); } } else { if (mAction.ElementAction.ToString() == ActUIElement.eElementAction.Click.ToString()) { mAction.AddOrUpdateInputParamValue(ActUIElement.Fields.WaitforIdle, ActUIElement.eWaitForIdle.Medium.ToString()); } else { mAction.AddOrUpdateInputParamValue(ActUIElement.Fields.WaitforIdle, ActUIElement.eWaitForIdle.None.ToString()); } } WaitforIdleComboBox.Init(mAction.GetOrCreateInputParam(ActUIElement.Fields.WaitforIdle), typeof(ActUIElement.eWaitForIdle)); }
public UIElementTableConfigPage(ElementInfo ElementInfo, ObservableList <Act> Actions, Context context) { eBaseWindow = BaseWindow.WindowExplorer; mAct = new ActUIElement(); mAct.Context = context; mAct.Description = "UI Element Table"; string targetApp = context?.BusinessFlow.CurrentActivity.TargetApplication; mPlatform = PlatformInfoBase.GetPlatformImpl((from x in WorkSpace.Instance.Solution.ApplicationPlatforms where x.AppName == targetApp select x.Platform).FirstOrDefault()); if (ElementInfo.ElementType.Contains("JEditor")) { mAct.ElementType = eElementType.EditorPane; mAct.ElementAction = ActUIElement.eElementAction.JEditorPaneElementAction; mAct.AddOrUpdateInputParamValue(ActUIElement.Fields.SubElementType, ActUIElement.eSubElementType.HTMLTable.ToString()); mAct.AddOrUpdateInputParamValue(ActUIElement.Fields.SubElementAction, ActUIElement.eElementAction.TableCellAction.ToString()); } else { mAct.ElementType = eElementType.Table; mAct.ElementAction = ActUIElement.eElementAction.TableCellAction; } mElementInfo = ElementInfo; mActions = Actions; ShowCellActions(); InitializeComponent(); InitTableInfo(); ShowTableControlActionConfigPage(mPlatform); SetComponents(); SetDescriptionDetails(); }
public UIElementTableConfigPage(ActUIElement Act, PlatformInfoBase Platform) { eBaseWindow = BaseWindow.ActEditPage; mAct = Act; mPlatform = Platform; InitializeComponent(); if (Act.ElementData != null) { if (Act.ElementType == eElementType.EditorPane || Act.ElementType.ToString() == "JEditor") { mAct.ElementType = eElementType.EditorPane; mAct.ElementAction = ActUIElement.eElementAction.JEditorPaneElementAction; mAct.AddOrUpdateInputParamValue(ActUIElement.Fields.SubElementType, ActUIElement.eSubElementType.HTMLTable.ToString()); mAct.AddOrUpdateInputParamValue(ActUIElement.Fields.SubElementAction, ActUIElement.eElementAction.TableCellAction.ToString()); mAct.AddOrUpdateInputParamValue(ActUIElement.Fields.ControlAction, ActUIElement.eElementAction.GetValue.ToString()); } else { mAct.ElementType = eElementType.Table; mAct.ElementAction = ActUIElement.eElementAction.TableCellAction; mAct.AddOrUpdateInputParamValue(ActUIElement.Fields.ControlAction, ActUIElement.eElementAction.GetValue.ToString()); } InitTableInfo(); SetComponents(true); SetDescriptionDetails(); } ShowTableControlActionConfigPage(mPlatform); }
public UIElementXYCoordinatePage(ActUIElement Act) { mAct = Act; InitializeComponent(); xXCoordinate.Init(Context.GetAsContext(mAct.Context), mAct.GetOrCreateInputParam(ActUIElement.Fields.XCoordinate, mAct.GetInputParamValue(ActUIElement.Fields.XCoordinate))); xYCoordinate.Init(Context.GetAsContext(mAct.Context), mAct.GetOrCreateInputParam(ActUIElement.Fields.YCoordinate, mAct.GetInputParamValue(ActUIElement.Fields.YCoordinate))); xValue.Init(Context.GetAsContext(mAct.Context), mAct.GetOrCreateInputParam(ActUIElement.Fields.Value, mAct.GetInputParamValue(ActUIElement.Fields.Value))); if (mAct.ElementData != null) { string[] spliter = new string[] { "," }; string[] cordinations = Convert.ToString(mAct.ElementData).Split(spliter, StringSplitOptions.RemoveEmptyEntries); mAct.AddOrUpdateInputParamValue("XCoordinate", cordinations[0]); mAct.AddOrUpdateInputParamValue("YCoordinate", cordinations[1]); } if (mAct.ElementAction == ActUIElement.eElementAction.SendKeysXY) { xValuePanel.Visibility = Visibility.Visible; } else { xValuePanel.Visibility = Visibility.Collapsed; } }
private void ResetActUIFields() { mAction.AddOrUpdateInputParamValue(ActUIElement.Fields.XCoordinate, String.Empty); mAction.AddOrUpdateInputParamValue(ActUIElement.Fields.Value, String.Empty); mAction.AddOrUpdateInputParamValue(ActUIElement.Fields.ValueToSelect, String.Empty); mAction.AddOrUpdateInputParamValue(ActUIElement.Fields.YCoordinate, String.Empty); mAction.AddOrUpdateInputParamValue(ActUIElement.Fields.ControlAction, String.Empty); }
private Act SetActionDetails(Act act) { act.Active = true; act.AddNewReturnParams = true; act.Value = ValueTextBox.Text; //Set action unique input values if (mActInputValues != null) { foreach (ActInputValue iv in mActInputValues) { if (iv.Value != null) { act.AddOrUpdateInputParamValue(iv.Param, iv.Value); } } } ElementLocator EL = (ElementLocator)mLocators.CurrentItem; if ((mActions.CurrentItem).GetType() == typeof(ActUIElement)) { //Set UIElement action locator ActUIElement actUI = (ActUIElement)act; actUI.ElementLocateBy = EL.LocateBy; actUI.ElementLocateValue = EL.LocateValue; //TODO: Remove below if once one of the field from Value and Value to select is removed if (actUI.ElementAction == ActUIElement.eElementAction.Click || actUI.ElementAction == ActUIElement.eElementAction.Select || actUI.ElementAction == ActUIElement.eElementAction.GetControlProperty || actUI.ElementAction == ActUIElement.eElementAction.AsyncSelect || actUI.ElementAction == ActUIElement.eElementAction.SelectByIndex) { actUI.AddOrUpdateInputParamValue(ActUIElement.Fields.ValueToSelect, act.Value); } else if (actUI.ElementAction.Equals(ActUIElement.eElementAction.TableCellAction)) { actUI.AddOrUpdateInputParamValue(ActUIElement.Fields.ControlActionValue, act.Value); } act = actUI; } else { //Set action locator act.LocateBy = EL.LocateBy; act.LocateValue = EL.LocateValue; } return(act); }
public void MapMenuActionItems(String locateValue, ActUIElement newAct) { if (!String.IsNullOrEmpty(locateValue)) { // check if the current action is a garbage action or not if (locateValue.Contains("com.amdocs.crm.workspace.OpenWindows:OpenedWindowsTree")) { newAct.Active = false; newAct.Description = "Please remove this action - " + this.Description; return; } int slash = locateValue.IndexOf("/"); string menuLocateValue = SplitWithEscape(locateValue, '/'); foreach (ActUIElement.eElementAction menuAction in Enum.GetValues(typeof(ActUIElement.eElementAction))) { if (this.MenuAction.ToString().Equals(menuAction.ToString())) { newAct.ElementAction = menuAction; } } newAct.ElementType = eElementType.MenuItem; if (menuLocateValue.IndexOf(";") != -1) { newAct.ElementLocateValue = menuLocateValue.Substring(0, menuLocateValue.IndexOf(';')); newAct.AddOrUpdateInputParamValue(ActUIElement.Fields.Value, locateValue.Substring(menuLocateValue.IndexOf(';') + 1));// menuLocateValue.Substring(menuLocateValue.IndexOf(';') + 1, menuLocateValue.Length - menuLocateValue.IndexOf(';') - 2)); } else { newAct.ElementLocateValue = menuLocateValue; } } }
ObservableList <Act> IWindowExplorerTreeItem.GetElementActions() { mAvailableActions.Clear(); ActUIElement act = new ActUIElement(); act.AddNewReturnParams = true; act.Description = "Get " + ElementInfo.ElementTitle + " Table RowCount"; act.ElementType = eElementType.EditorPane; act.ElementAction = ActUIElement.eElementAction.JEditorPaneElementAction; act.AddOrUpdateInputParamValue(ActUIElement.Fields.SubElementType, ActUIElement.eSubElementType.HTMLTable.ToString()); act.AddOrUpdateInputParamValue(ActUIElement.Fields.SubElementAction, ActUIElement.eElementAction.TableAction.ToString()); act.AddOrUpdateInputParamValue(ActUIElement.Fields.ControlAction, ActUIElement.eTableAction.GetRowCount.ToString()); act.AddOrUpdateInputParamValue(ActUIElement.Fields.ColSelectorValue, ActUIElement.eTableElementRunColSelectorValue.ColTitle.ToString()); act.AddOrUpdateInputParamValue(ActUIElement.Fields.LocateColTitle, "0"); act.AddOrUpdateInputParamValue(ActUIElement.Fields.ByRowNum, "true"); act.AddOrUpdateInputParamValue(ActUIElement.Fields.LocateRowValue, "0"); act.AddOrUpdateInputParamValue(ActUIElement.Fields.LocateRowType, "Row Number"); mAvailableActions.Add(act); ActUIElement act1 = new ActUIElement(); act1.AddNewReturnParams = true; act1.Description = "Get " + ElementInfo.ElementTitle + " Value"; act1.ElementType = eElementType.EditorPane; act1.ElementAction = ActUIElement.eElementAction.JEditorPaneElementAction; act1.AddOrUpdateInputParamValue(ActUIElement.Fields.SubElementType, ActUIElement.eSubElementType.HTMLTable.ToString()); act1.AddOrUpdateInputParamValue(ActUIElement.Fields.SubElementAction, ActUIElement.eElementAction.TableCellAction.ToString()); act1.AddOrUpdateInputParamValue(ActUIElement.Fields.ControlAction, ActUIElement.eTableAction.GetValue.ToString()); act1.AddOrUpdateInputParamValue(ActUIElement.Fields.ColSelectorValue, ActUIElement.eTableElementRunColSelectorValue.ColTitle.ToString()); act1.AddOrUpdateInputParamValue(ActUIElement.Fields.LocateColTitle, "0"); act1.AddOrUpdateInputParamValue(ActUIElement.Fields.ByRowNum, "true"); act1.AddOrUpdateInputParamValue(ActUIElement.Fields.LocateRowValue, "0"); act1.AddOrUpdateInputParamValue(ActUIElement.Fields.LocateRowType, "Row Number"); mAvailableActions.Add(act1); ActUIElement act2 = new ActUIElement(); act2.AddNewReturnParams = true; act2.Description = "Click " + ElementInfo.ElementTitle; act2.ElementType = eElementType.EditorPane; act2.ElementAction = ActUIElement.eElementAction.JEditorPaneElementAction; act2.AddOrUpdateInputParamValue(ActUIElement.Fields.SubElementType, ActUIElement.eSubElementType.HTMLTable.ToString()); act2.AddOrUpdateInputParamValue(ActUIElement.Fields.SubElementAction, ActUIElement.eElementAction.TableCellAction.ToString()); act2.AddOrUpdateInputParamValue(ActUIElement.Fields.ControlAction, ActUIElement.eTableAction.Click.ToString()); act2.AddOrUpdateInputParamValue(ActUIElement.Fields.ColSelectorValue, ActUIElement.eTableElementRunColSelectorValue.ColTitle.ToString()); act2.AddOrUpdateInputParamValue(ActUIElement.Fields.LocateColTitle, "0"); act2.AddOrUpdateInputParamValue(ActUIElement.Fields.ByRowNum, "true"); act2.AddOrUpdateInputParamValue(ActUIElement.Fields.LocateRowValue, "0"); act2.AddOrUpdateInputParamValue(ActUIElement.Fields.LocateRowType, "Row Number"); mAvailableActions.Add(act2); return(mAvailableActions); }
private void SetComponents() { ControlActionComboBox.Visibility = Visibility.Collapsed; ControlActionComboBox.Visibility = Visibility.Collapsed; subElementTypeRow.Height = new GridLength(0); OperationTypeRow.Height = new GridLength(0); mAct.AddOrUpdateInputParamValue(ActUIElement.Fields.ColSelectorValue, ActUIElement.eTableElementRunColSelectorValue.ColTitle.ToString()); RowNum.IsChecked = true; for (int i = 0; i < mRowCount; i++) { RowSelectorValue.ComboBox.Items.Add(i.ToString()); } RowSelectorValue.ComboBox.SelectedIndex = 0; mAct.AddOrUpdateInputParamValue(ActUIElement.Fields.WhereColSelector, ActUIElement.eTableElementRunColSelectorValue.ColTitle.ToString()); mAct.AddOrUpdateInputParamValue(ActUIElement.Fields.WhereProperty, ActUIElement.eTableElementRunColPropertyValue.Value.ToString()); mAct.AddOrUpdateInputParamValue(ActUIElement.Fields.WhereOperator, ActUIElement.eTableElementRunColOperator.Equals.ToString()); }
ObservableList <Act> IWindowExplorerTreeItem.GetElementActions() { // Will be overridden in derived class ObservableList <Act> list = new ObservableList <Act>(); ActUIElement act = new ActUIElement(); act.AddNewReturnParams = true; act.Description = "Get Control Property for " + Name; act.ElementType = eElementType.Unknown; act.ElementAction = ActUIElement.eElementAction.GetControlProperty; act.AddOrUpdateInputParamValue(ActUIElement.Fields.ValueToSelect, ActUIElement.eElementProperty.Value.ToString()); list.Add(act); return(list); }
Act IObsoleteAction.GetNewAction() { AutoMapper.MapperConfiguration mapConfig = new AutoMapper.MapperConfiguration(cfg => { cfg.CreateMap <Act, ActUIElement>(); }); ActUIElement newAct = mapConfig.CreateMapper().Map <Act, ActUIElement>(this); newAct.ElementType = eElementType.Unknown; Type currentType = GetActionTypeByElementActionName(this.ActDropDownListAction); if (currentType == typeof(ActUIElement)) { // check special cases, where name should be changed. Than at default case - all names that have no change switch (this.ActDropDownListAction) { case eActDropDownListAction.SetSelectedValueByIndex: newAct.ElementAction = ActUIElement.eElementAction.SelectByIndex; break; case eActDropDownListAction.SetSelectedValueByValue: newAct.ElementAction = ActUIElement.eElementAction.Select; break; case eActDropDownListAction.SetSelectedValueByText: newAct.ElementAction = ActUIElement.eElementAction.SelectByText; break; case eActDropDownListAction.IsPrepopulated: newAct.ElementAction = ActUIElement.eElementAction.IsValuePopulated; break; default: newAct.ElementAction = (ActUIElement.eElementAction)System.Enum.Parse(typeof(ActUIElement.eElementAction), this.ActDropDownListAction.ToString()); break; } } newAct.ElementLocateBy = (eLocateBy)((int)this.LocateBy); if (!string.IsNullOrEmpty(this.LocateValue)) { newAct.ElementLocateValue = String.Copy(this.LocateValue); } newAct.ElementType = eElementType.ComboBox; newAct.Active = true; newAct.AddOrUpdateInputParamValue(ActUIElement.Fields.ValueToSelect, this.GetInputParamValue("Value")); return(newAct); }
private ActUIElement ConvertJavaTableToActUITable(ActUIElement newActUIElement) { newActUIElement.ElementLocateBy = this.LocateBy; newActUIElement.ElementLocateValue = this.LocateValue; newActUIElement.ElementType = Amdocs.Ginger.Common.UIElement.eElementType.Table; newActUIElement.ElementAction = GetTableElementActionType(this.ControlAction); newActUIElement.GetOrCreateInputParam(ActUIElement.Fields.ControlAction, this.ControlAction.ToString()); newActUIElement.GetOrCreateInputParam(ActUIElement.Fields.ControlActionValue, this.Value); newActUIElement.GetOrCreateInputParam(ActUIElement.Fields.LocateRowType, this.LocateRowType); newActUIElement.GetOrCreateInputParam(ActUIElement.Fields.LocateRowValue, this.LocateRowType); newActUIElement.GetOrCreateInputParam(ActUIElement.Fields.ByWhere, this.ByWhere.ToString()); newActUIElement.GetOrCreateInputParam(ActUIElement.Fields.ByRowNum, this.ByRowNum.ToString()); newActUIElement.GetOrCreateInputParam(ActUIElement.Fields.ByRandRow, this.ByRandRow.ToString()); newActUIElement.GetOrCreateInputParam(ActUIElement.Fields.BySelectedRow, this.BySelectedRow.ToString()); newActUIElement.AddOrUpdateInputParamValue(ActUIElement.Fields.RowSelectorRadioParam, GetCheckedRadioButton()); newActUIElement.GetOrCreateInputParam(ActUIElement.Fields.LocateColTitle, this.LocateColTitle); newActUIElement.GetOrCreateInputParam(ActUIElement.Fields.ColSelectorValue, Convert.ToString(this.ColSelectorValue)); newActUIElement.GetOrCreateInputParam(ActUIElement.Fields.WhereColSelector, Convert.ToString(this.WhereColSelector)); newActUIElement.GetOrCreateInputParam(ActUIElement.Fields.WhereColumnTitle, this.WhereColumnTitle); newActUIElement.GetOrCreateInputParam(ActUIElement.Fields.WhereColumnValue, this.WhereColumnValue); newActUIElement.GetOrCreateInputParam(ActUIElement.Fields.WhereOperator, Convert.ToString(this.WhereOperator)); newActUIElement.GetOrCreateInputParam(ActUIElement.Fields.WhereProperty, Convert.ToString(this.WhereProperty)); if (this.ReturnValues.Count > 0) { if (this.ReturnValues[0].Param == "Actual") { newActUIElement.ReturnValues[0].Param = "Actual0"; } } return(newActUIElement); }
Act IObsoleteAction.GetNewAction() { bool uIElementTypeAssigned = false; AutoMapper.MapperConfiguration mapConfigUIElement = new AutoMapper.MapperConfiguration(cfg => { cfg.CreateMap <Act, ActUIElement>(); }); ActUIElement NewActUIElement = mapConfigUIElement.CreateMapper().Map <Act, ActUIElement>(this); AutoMapper.MapperConfiguration mapConfigBrowserElementt = new AutoMapper.MapperConfiguration(cfg => { cfg.CreateMap <Act, ActBrowserElement>(); }); ActBrowserElement NewActBrowserElement = mapConfigBrowserElementt.CreateMapper().Map <Act, ActBrowserElement>(this); Type currentType = GetActionTypeByElementActionName(GenElementAction); if (currentType == typeof(ActBrowserElement)) { switch (GenElementAction) { case eGenElementAction.Back: NewActBrowserElement.ControlAction = ActBrowserElement.eControlAction.NavigateBack; break; case eGenElementAction.CloseBrowser: NewActBrowserElement.ControlAction = ActBrowserElement.eControlAction.Close; break; default: NewActBrowserElement.ControlAction = (ActBrowserElement.eControlAction)System.Enum.Parse(typeof(ActBrowserElement.eControlAction), GenElementAction.ToString()); break; } } else if (currentType == typeof(ActUIElement)) { switch (GenElementAction) { case eGenElementAction.Click: NewActUIElement.ElementAction = ActUIElement.eElementAction.JavaScriptClick; break; case eGenElementAction.RightClick: NewActUIElement.ElementAction = ActUIElement.eElementAction.MouseRightClick; break; case eGenElementAction.Visible: NewActUIElement.ElementAction = ActUIElement.eElementAction.IsVisible; break; case eGenElementAction.SelectFromListScr: NewActUIElement.ElementAction = ActUIElement.eElementAction.SelectByIndex; NewActUIElement.ElementType = eElementType.List; uIElementTypeAssigned = true; break; case eGenElementAction.AsyncSelectFromDropDownByIndex: NewActUIElement.ElementAction = ActUIElement.eElementAction.SelectByIndex; NewActUIElement.ElementType = eElementType.ComboBox; break; case eGenElementAction.KeyboardInput: NewActUIElement.ElementAction = ActUIElement.eElementAction.SendKeys; break; case eGenElementAction.KeyType: NewActUIElement.ElementAction = ActUIElement.eElementAction.SetText; break; case eGenElementAction.SelectFromDropDown: NewActUIElement.ElementAction = ActUIElement.eElementAction.SelectByText; NewActUIElement.ElementType = eElementType.ComboBox; uIElementTypeAssigned = true; break; case eGenElementAction.GetInnerText: NewActUIElement.ElementAction = ActUIElement.eElementAction.GetText; break; case eGenElementAction.GetCustomAttribute: case eGenElementAction.GetElementAttributeValue: NewActUIElement.ElementAction = ActUIElement.eElementAction.GetAttrValue; break; case eGenElementAction.BatchClicks: NewActUIElement.ElementAction = ActUIElement.eElementAction.MultiClicks; break; case eGenElementAction.BatchSetValues: NewActUIElement.ElementAction = ActUIElement.eElementAction.MultiSetValue; break; case eGenElementAction.SimpleClick: NewActUIElement.ElementAction = ActUIElement.eElementAction.Click; break; case eGenElementAction.Disabled: NewActUIElement.ElementAction = ActUIElement.eElementAction.IsDisabled; break; case eGenElementAction.Enabled: NewActUIElement.ElementAction = ActUIElement.eElementAction.IsEnabled; break; case eGenElementAction.GetNumberOfElements: NewActUIElement.ElementAction = ActUIElement.eElementAction.GetItemCount; break; case eGenElementAction.XYClick: NewActUIElement.ElementAction = ActUIElement.eElementAction.ClickXY; break; case eGenElementAction.Focus: NewActUIElement.ElementAction = ActUIElement.eElementAction.SetFocus; break; case eGenElementAction.RunJavaScript: NewActUIElement.ElementAction = ActUIElement.eElementAction.RunJavaScript; break; default: NewActUIElement.ElementAction = (ActUIElement.eElementAction)System.Enum.Parse(typeof(ActUIElement.eElementAction), GenElementAction.ToString()); break; } } if (currentType == typeof(ActUIElement)) { NewActUIElement.ElementLocateBy = (eLocateBy)((int)this.LocateBy); if (!string.IsNullOrEmpty(this.LocateValue)) { NewActUIElement.ElementLocateValue = String.Copy(this.LocateValue); } if (!uIElementTypeAssigned) { NewActUIElement.ElementType = eElementType.Unknown; } if (!NewActUIElement.Platforms.Contains(this.Platform)) { NewActUIElement.Platform = ePlatformType.Web; // ??? to check } NewActUIElement.AddOrUpdateInputParamValue(ActUIElement.Fields.ValueToSelect, this.GetInputParamValue("Value")); return(NewActUIElement); } if (currentType == typeof(ActBrowserElement)) { return(NewActBrowserElement); } return(null); }
public void MapASCFActionItems(String locateValue, ActUIElement newAct) { switch (LocateBy) { case eLocateBy.ByXPath: newAct.ElementLocateBy = eLocateBy.ByXPath; break; case eLocateBy.ByName: newAct.ElementLocateBy = eLocateBy.ByName; break; case eLocateBy.ByValue: newAct.ElementLocateBy = eLocateBy.ByValue; break; case eLocateBy.ByText: newAct.ElementLocateBy = eLocateBy.ByText; break; case eLocateBy.ByTitle: newAct.ElementLocateBy = eLocateBy.ByTitle; break; default: newAct.ElementLocateBy = eLocateBy.Unknown; break; } if (!String.IsNullOrEmpty(locateValue)) { // check if the current action is a garbage action or not if (!string.IsNullOrEmpty(this.LocateValue) && this.LocateValue.Contains("com.amdocs.crm.workspace.OpenWindows:OpenedWindowsTree")) { newAct.Active = false; newAct.Description = "Please remove this action - " + this.Description; return; } int slash = locateValue.IndexOf("/"); int colon = locateValue.IndexOf(":"); if (slash == -1) { newAct.Value = this.Value; if (locateValue.Count(x => x == ':') > 1) { locateValue = locateValue.Substring(locateValue.LastIndexOf(':') + 1); } else { locateValue = locateValue.Substring(colon + 1); } newAct.ElementLocateValue = locateValue; newAct.ElementType = eElementType.Unknown; foreach (ActUIElement.eElementAction x in Enum.GetValues(typeof(ActUIElement.eElementAction))) { if (this.ControlAction.ToString().Equals(x.ToString())) { newAct.ElementAction = x; return; } else { // if old action is not supported by ACTUIElement, for example, GetControlProperty newAct.ElementAction = ActUIElement.eElementAction.Unknown; } } } else { if (checkWhetherTreeElement(locateValue, newAct)) { return; } newAct.ElementType = eElementType.Table; newAct.ElementAction = ActUIElement.eElementAction.TableCellAction; newAct.ElementLocateBy = eLocateBy.ByContainerName; // Parse the Column Selector int col = locateValue.IndexOf(":", slash); string colSelector = (slash == locateValue.Length - 1) ? "" : locateValue.Substring(slash + 1, (locateValue.Length - 1) - (slash + 1)).Replace(@":", string.Empty); colSelector = colSelector.Trim(); int colNum = 0; if (colSelector.All(char.IsDigit)) { colNum = Convert.ToInt32(colSelector); newAct.AddOrUpdateInputParamValue(ActUIElement.Fields.ColSelectorValue, ActUIElement.eTableElementRunColSelectorValue.ColNum.ToString()); newAct.AddOrUpdateInputParamValue(ActUIElement.Fields.LocateColTitle, colNum.ToString()); } else { if (!String.IsNullOrEmpty(colSelector)) { if (colSelector.IndexOf("[") == -1) { newAct.AddOrUpdateInputParamValue(ActUIElement.Fields.ColSelectorValue, ActUIElement.eTableElementRunColSelectorValue.ColTitle.ToString()); newAct.AddOrUpdateInputParamValue(ActUIElement.Fields.LocateColTitle, colSelector); } else { if (colSelector.StartsWith("[name=")) { newAct.AddOrUpdateInputParamValue(ActUIElement.Fields.ColSelectorValue, ActUIElement.eTableElementRunColSelectorValue.ColName.ToString()); } else if (colSelector.StartsWith("[title=")) { newAct.AddOrUpdateInputParamValue(ActUIElement.Fields.ColSelectorValue, ActUIElement.eTableElementRunColSelectorValue.ColTitle.ToString()); } else if (colSelector.StartsWith("[number=")) { newAct.AddOrUpdateInputParamValue(ActUIElement.Fields.ColSelectorValue, ActUIElement.eTableElementRunColSelectorValue.ColNum.ToString()); } newAct.AddOrUpdateInputParamValue(ActUIElement.Fields.LocateColTitle, colSelector.Split('\"')[1]); } } } // Parse the Row Selector string rowSelector = locateValue.Substring(col + 1); if (!String.IsNullOrEmpty(rowSelector)) { if (rowSelector.StartsWith("[number=")) { string row = rowSelector.Split('\"')[1]; if ("random".Equals(row)) { newAct.AddOrUpdateInputParamValue(ActUIElement.Fields.LocateRowType, "Any Row"); } else { newAct.AddOrUpdateInputParamValue(ActUIElement.Fields.LocateRowType, "Row Number"); newAct.AddOrUpdateInputParamValue(ActUIElement.Fields.LocateRowValue, row); } } else if (rowSelector.All(char.IsDigit)) { int rowNum = Convert.ToInt32(rowSelector); newAct.AddOrUpdateInputParamValue(ActUIElement.Fields.LocateRowType, "Row Number"); newAct.AddOrUpdateInputParamValue(ActUIElement.Fields.LocateRowValue, rowNum.ToString()); } else if (rowSelector.Equals("random")) { newAct.AddOrUpdateInputParamValue(ActUIElement.Fields.LocateRowType, "Any Row"); } else { if (rowSelector == string.Empty) { throw new Exception("Malformed row selector"); } string[] conditions = rowSelector.Split(new string[] { "]]" }, StringSplitOptions.None); foreach (string condition in conditions) { string cond = !String.IsNullOrEmpty(condition) ? condition.Trim() : ""; if (String.IsNullOrEmpty(cond.ToString()) || cond[0] == ']') { break; } if (cond.IndexOf(":") != -1) { colon = cond.IndexOf(":", 1); string rowColSelector = cond.Substring(cond.LastIndexOf("[", colon) + 1, colon); string rowColSelectorValue = rowColSelector.Split('\"')[1]; if (rowColSelector.Contains("\"")) { rowColSelector = rowColSelector.Substring(0, rowColSelector.IndexOf("=")); if (rowColSelector.Equals("name")) { newAct.AddOrUpdateInputParamValue(ActUIElement.Fields.WhereColSelector, ActUIElement.eTableElementRunColSelectorValue.ColName.ToString()); } else if (rowColSelector.Equals("title")) { newAct.AddOrUpdateInputParamValue(ActUIElement.Fields.WhereColSelector, ActUIElement.eTableElementRunColSelectorValue.ColTitle.ToString()); } else if (rowColSelector.Equals("number")) { newAct.AddOrUpdateInputParamValue(ActUIElement.Fields.WhereColSelector, ActUIElement.eTableElementRunColSelectorValue.ColNum.ToString()); } } else { newAct.AddOrUpdateInputParamValue(ActUIElement.Fields.WhereColSelector, ActUIElement.eTableElementRunColSelectorValue.ColTitle.ToString()); } newAct.AddOrUpdateInputParamValue(ActUIElement.Fields.WhereColumnTitle, rowColSelectorValue); // Determine the Property Selector string rowColProperty = cond.Substring(colon + 1); string[] properties = rowColProperty.Split(new string[] { "\\[" }, StringSplitOptions.None); for (int i = 0; i < properties.Length; i++) { if (i > 1) { } string p = new string(properties[i].Split('\"')[0].Where(c => char.IsLetter(c)).ToArray()); string pv = properties[i].Split('\"')[1]; if (pv.Equals("<empty>")) { pv = ""; } string o = properties[i].Split('\"')[0].Substring(p.Length + 1); newAct.AddOrUpdateInputParamValue(ActUIElement.Fields.WhereProperty, p); newAct.AddOrUpdateInputParamValue(ActUIElement.Fields.WhereOperator, "=".Equals(o) ? ActUIElement.eTableElementRunColOperator.Equals.ToString() : "!=".Equals(o) ? ActUIElement.eTableElementRunColOperator.NotEquals.ToString() : "=~".Equals(o) ? ActUIElement.eTableElementRunColOperator.Contains.ToString() : "!~".Equals(o) ? ActUIElement.eTableElementRunColOperator.NotContains.ToString() : "=^".Equals(o) ? ActUIElement.eTableElementRunColOperator.StartsWith.ToString() : "!^".Equals(o) ? ActUIElement.eTableElementRunColOperator.NotStartsWith.ToString() : "=$".Equals(o) ? ActUIElement.eTableElementRunColOperator.EndsWith.ToString() : "!$".Equals(o) ? ActUIElement.eTableElementRunColOperator.NotEndsWith.ToString() : ""); newAct.AddOrUpdateInputParamValue(ActUIElement.Fields.WhereColumnValue, pv); } } } newAct.AddOrUpdateInputParamValue(ActUIElement.Fields.LocateRowType, "Where"); } } foreach (ActUIElement.eElementAction x in Enum.GetValues(typeof(ActUIElement.eElementAction))) { if (this.ControlAction.ToString().Equals(x.ToString())) { newAct.AddOrUpdateInputParamValue(ActUIElement.Fields.ControlAction, x.ToString()); newAct.AddOrUpdateInputParamValue(ActUIElement.Fields.ControlActionValue, this.Value); } } newAct.ElementLocateValue = locateValue.Split('/')[0].Substring(locateValue.Split('/')[0].LastIndexOf(":") + 1); } } }
private Act GetNewActionForWeb() { bool uIElementTypeAssigned = false; ActUIElement NewActUIElement = GetNewUIElementFromAutoMapper(); ActBrowserElement NewActBrowserElement = GetNewBrowserElementFromAutoMapper(); Type currentType = GetActionTypeByElementActionName(GenElementAction); if (currentType == typeof(ActBrowserElement)) { switch (GenElementAction) { case eGenElementAction.Back: NewActBrowserElement.ControlAction = ActBrowserElement.eControlAction.NavigateBack; break; case eGenElementAction.CloseBrowser: NewActBrowserElement.ControlAction = ActBrowserElement.eControlAction.Close; break; case eGenElementAction.StartBrowser: NewActBrowserElement.ControlAction = ActBrowserElement.eControlAction.InitializeBrowser; break; default: try { NewActBrowserElement.ControlAction = (ActBrowserElement.eControlAction)System.Enum.Parse(typeof(ActBrowserElement.eControlAction), GenElementAction.ToString()); } catch (Exception ex) { Reporter.ToLog(eLogLevel.ERROR, "Error occurred while mapping the operation to action while conversion", ex); throw; } break; } } else if (currentType == typeof(ActUIElement)) { switch (GenElementAction) { case eGenElementAction.Click: NewActUIElement.ElementAction = ActUIElement.eElementAction.JavaScriptClick; break; case eGenElementAction.RightClick: NewActUIElement.ElementAction = ActUIElement.eElementAction.MouseRightClick; break; case eGenElementAction.Visible: NewActUIElement.ElementAction = ActUIElement.eElementAction.IsVisible; break; case eGenElementAction.SelectFromListScr: NewActUIElement.ElementAction = ActUIElement.eElementAction.SelectByIndex; NewActUIElement.ElementType = eElementType.List; uIElementTypeAssigned = true; break; case eGenElementAction.AsyncSelectFromDropDownByIndex: NewActUIElement.ElementAction = ActUIElement.eElementAction.SelectByIndex; NewActUIElement.ElementType = eElementType.ComboBox; break; case eGenElementAction.KeyboardInput: NewActUIElement.ElementAction = ActUIElement.eElementAction.SendKeys; break; case eGenElementAction.KeyType: NewActUIElement.ElementAction = ActUIElement.eElementAction.SetText; break; case eGenElementAction.SelectFromDropDown: NewActUIElement.ElementAction = ActUIElement.eElementAction.SelectByText; NewActUIElement.ElementType = eElementType.ComboBox; uIElementTypeAssigned = true; break; case eGenElementAction.GetInnerText: NewActUIElement.ElementAction = ActUIElement.eElementAction.GetText; break; case eGenElementAction.GetCustomAttribute: case eGenElementAction.GetElementAttributeValue: NewActUIElement.ElementAction = ActUIElement.eElementAction.GetAttrValue; break; case eGenElementAction.BatchClicks: NewActUIElement.ElementAction = ActUIElement.eElementAction.MultiClicks; break; case eGenElementAction.BatchSetValues: NewActUIElement.ElementAction = ActUIElement.eElementAction.MultiSetValue; break; case eGenElementAction.SimpleClick: NewActUIElement.ElementAction = ActUIElement.eElementAction.Click; break; case eGenElementAction.Disabled: NewActUIElement.ElementAction = ActUIElement.eElementAction.IsDisabled; break; case eGenElementAction.Enabled: NewActUIElement.ElementAction = ActUIElement.eElementAction.IsEnabled; break; case eGenElementAction.GetNumberOfElements: NewActUIElement.ElementAction = ActUIElement.eElementAction.GetItemCount; break; case eGenElementAction.XYClick: NewActUIElement.ElementAction = ActUIElement.eElementAction.ClickXY; break; case eGenElementAction.Focus: NewActUIElement.ElementAction = ActUIElement.eElementAction.SetFocus; break; case eGenElementAction.RunJavaScript: NewActUIElement.ElementAction = ActUIElement.eElementAction.RunJavaScript; break; case eGenElementAction.SetAttributeUsingJs: NewActUIElement.ElementAction = ActUIElement.eElementAction.RunJavaScript; break; default: try { NewActUIElement.ElementAction = (ActUIElement.eElementAction)System.Enum.Parse(typeof(ActUIElement.eElementAction), GenElementAction.ToString()); } catch (Exception ex) { Reporter.ToLog(eLogLevel.ERROR, "Error occurred while mapping the operation to action while conversion", ex); throw; } break; } } if (currentType == typeof(ActUIElement)) { NewActUIElement.ElementLocateBy = (eLocateBy)((int)this.LocateBy); if (!string.IsNullOrEmpty(this.LocateValue)) { if (GenElementAction == eGenElementAction.SetAttributeUsingJs) { NewActUIElement.Value = string.Format("arguments[0].{0}", this.Value); } else { NewActUIElement.ElementLocateValue = String.Copy(this.LocateValue); } } if (!uIElementTypeAssigned) { NewActUIElement.ElementType = eElementType.Unknown; } if (!NewActUIElement.Platforms.Contains(this.Platform)) { NewActUIElement.Platform = ePlatformType.Web; // ??? to check } NewActUIElement.AddOrUpdateInputParamValue(ActUIElement.Fields.ValueToSelect, this.GetInputParamValue("Value")); return(NewActUIElement); } if (currentType == typeof(ActBrowserElement)) { return(NewActBrowserElement); } return(null); }
private void UpdateRelatedActions() { string previousSelectedControlAction = null; if (mActions != null) { if (mActions.CurrentItem != null) { if (mActions.CurrentItem is ActUIElement) { previousSelectedControlAction = ((ActUIElement)mActions.CurrentItem).GetOrCreateInputParam(ActUIElement.Fields.ControlAction).ToString(); } } mActions.Clear(); } if (cmbColSelectorValue.ComboBox.SelectedIndex != -1) { mAct.AddOrUpdateInputParamValue(ActUIElement.Fields.ColSelectorValue, ((GingerCore.General.ComboEnumItem)cmbColSelectorValue.ComboBox.SelectedItem).Value.ToString()); } string description = ""; string rowVal = ""; string colVal = ""; if (RowNum.IsChecked == true) { mAct.AddOrUpdateInputParamValue(ActUIElement.Fields.LocateRowType, "Row Number"); if (RowSelectorValue != null) { if (RowSelectorValue.ComboBox.SelectedIndex != -1) { rowVal = RowSelectorValue.ComboBox.SelectedItem.ToString(); } else { rowVal = RowSelectorValue.ComboBox.Text; } description = " on Row:" + rowVal; } } else if (AnyRow.IsChecked == true) { mAct.AddOrUpdateInputParamValue(ActUIElement.Fields.LocateRowType, "Any Row"); description = " on Random Row"; } else if (BySelectedRow.IsChecked == true) { mAct.AddOrUpdateInputParamValue(ActUIElement.Fields.LocateRowType, "By Selected Row"); description = " on Selected Row"; } else if (Where.IsChecked == true) { mAct.AddOrUpdateInputParamValue(ActUIElement.Fields.LocateRowType, "Where"); description = " on Row with condition"; } if (cmbColumnValue != null) { if (cmbColumnValue.ComboBox.SelectedIndex != -1) { colVal = cmbColumnValue.ComboBox.SelectedItem.ToString(); } else { colVal = cmbColumnValue.ComboBox.Text; } description = description + " and Column:" + colVal; } if (eBaseWindow.Equals(BaseWindow.WindowExplorer) && cmbColSelectorValue.ComboBox.SelectedIndex != -1 && WhereColumn != null && WhereColumn.ComboBox.SelectedIndex != -1 && RowSelectorValue != null && WhereProperty != null && WhereProperty.ComboBox.SelectedIndex != -1 && WhereOperator != null && WhereOperator.ComboBox.SelectedIndex != -1) { List <string> descriptionString = new List <string>(); descriptionString.Add("Get Value of Cell: "); descriptionString.Add("Set Value of Cell: "); descriptionString.Add("Type Value in Cell: "); descriptionString.Add("Click Cell: "); descriptionString.Add("WinClick Cell: "); descriptionString.Add("Get Selected Cell from Column: "); ActUIElement actObj = (ActUIElement)mAct.CreateCopy(); actObj.AddOrUpdateInputParamValue(ActUIElement.Fields.ControlAction, ActUIElement.eElementAction.SetValue.ToString()); actObj.Description = "Set Value of Cell: " + description; actObj.GetOrCreateInputParam(ActUIElement.Fields.WhereColSelector, mAct.GetInputParamValue(ActUIElement.Fields.WhereColSelector)); actObj.GetOrCreateInputParam(ActUIElement.Fields.WhereColumnTitle, mAct.GetInputParamValue(ActUIElement.Fields.WhereColumnTitle)); actObj.GetOrCreateInputParam(ActUIElement.Fields.WhereColumnValue, mAct.GetInputParamValue(ActUIElement.Fields.WhereColumnValue)); actObj.GetOrCreateInputParam(ActUIElement.Fields.WhereOperator, mAct.GetInputParamValue(ActUIElement.Fields.WhereOperator)); actObj.GetOrCreateInputParam(ActUIElement.Fields.WhereProperty, mAct.GetInputParamValue(ActUIElement.Fields.WhereProperty)); mActions.Add(actObj); ActUIElement actObj1 = (ActUIElement)mAct.CreateCopy();; actObj1.AddOrUpdateInputParamValue(ActUIElement.Fields.ControlAction, ActUIElement.eElementAction.GetValue.ToString()); actObj1.Description = "Get Value of Cell: " + description; actObj1.GetOrCreateInputParam(ActUIElement.Fields.WhereColSelector, mAct.GetInputParamValue(ActUIElement.Fields.WhereColSelector)); actObj1.GetOrCreateInputParam(ActUIElement.Fields.WhereColumnTitle, mAct.GetInputParamValue(ActUIElement.Fields.WhereColumnTitle)); actObj1.GetOrCreateInputParam(ActUIElement.Fields.WhereColumnValue, mAct.GetInputParamValue(ActUIElement.Fields.WhereColumnValue)); actObj1.GetOrCreateInputParam(ActUIElement.Fields.WhereOperator, mAct.GetInputParamValue(ActUIElement.Fields.WhereOperator)); actObj1.GetOrCreateInputParam(ActUIElement.Fields.WhereProperty, mAct.GetInputParamValue(ActUIElement.Fields.WhereProperty)); mActions.Add(actObj1); ActUIElement actObj2 = (ActUIElement)mAct.CreateCopy();; actObj2.AddOrUpdateInputParamValue(ActUIElement.Fields.ControlAction, ActUIElement.eElementAction.Click.ToString()); actObj2.Description = "Click Cell: " + description; actObj2.GetOrCreateInputParam(ActUIElement.Fields.WhereColSelector, mAct.GetInputParamValue(ActUIElement.Fields.WhereColSelector)); actObj2.GetOrCreateInputParam(ActUIElement.Fields.WhereColumnTitle, mAct.GetInputParamValue(ActUIElement.Fields.WhereColumnTitle)); actObj2.GetOrCreateInputParam(ActUIElement.Fields.WhereColumnValue, mAct.GetInputParamValue(ActUIElement.Fields.WhereColumnValue)); actObj2.GetOrCreateInputParam(ActUIElement.Fields.WhereOperator, mAct.GetInputParamValue(ActUIElement.Fields.WhereOperator)); actObj2.GetOrCreateInputParam(ActUIElement.Fields.WhereProperty, mAct.GetInputParamValue(ActUIElement.Fields.WhereProperty)); mActions.Add(actObj2); } if (previousSelectedControlAction != null) { if (mActions != null) { foreach (ActUIElement act in mActions) { if (act.GetOrCreateInputParam(ActUIElement.Fields.ControlAction).ToString() == previousSelectedControlAction) { mActions.CurrentItem = act; break; } } } } if (mActions != null && mActions.CurrentItem == null && mActions.Count > 0) { mActions.CurrentItem = mActions[0]; } }
public ActUIElement CreateActUIElementObject(String descriptionString, String DescriptionValue, String rowVal, String colVal, String LocateRowType) { ActUIElement a = (ActUIElement)mAct.CreateCopy(); a.Description = descriptionString + DescriptionValue; a.AddOrUpdateInputParamValue(ActUIElement.Fields.ControlAction, mAct.GetInputParamValue(ActUIElement.Fields.ControlAction)); a.AddOrUpdateInputParamValue(ActUIElement.Fields.ColSelectorValue, ColSelectorValue.ToString()); a.AddOrUpdateInputParamValue(ActUIElement.Fields.LocateColTitle, colVal.ToString()); a.AddOrUpdateInputParamValue(ActUIElement.Fields.LocateRowType, LocateRowType); a.AddOrUpdateInputParamValue(ActUIElement.Fields.LocateRowValue, rowVal.ToString()); a.AddOrUpdateInputParamValue(ActUIElement.Fields.ByRowNum, RowNum.IsChecked.ToString()); a.AddOrUpdateInputParamValue(ActUIElement.Fields.ByRandRow, AnyRow.IsChecked.ToString()); a.AddOrUpdateInputParamValue(ActUIElement.Fields.BySelectedRow, BySelectedRow.IsChecked.ToString()); a.AddOrUpdateInputParamValue(ActUIElement.Fields.ByWhere, Where.IsChecked.ToString()); a.AddOrUpdateInputParamValue(ActUIElement.Fields.WhereColSelector, mAct.GetInputParamValue(ActUIElement.Fields.WhereColSelector)); a.AddOrUpdateInputParamValue(ActUIElement.Fields.WhereColumnTitle, mAct.GetInputParamValue(ActUIElement.Fields.WhereColumnTitle)); a.AddOrUpdateInputParamValue(ActUIElement.Fields.WhereColumnValue, mAct.GetInputParamValue(ActUIElement.Fields.WhereColumnValue)); a.AddOrUpdateInputParamValue(ActUIElement.Fields.WhereOperator, mAct.GetInputParamValue(ActUIElement.Fields.WhereOperator)); a.AddOrUpdateInputParamValue(ActUIElement.Fields.WhereProperty, mAct.GetInputParamValue(ActUIElement.Fields.WhereProperty)); return(a); }