Esempio n. 1
0
        public void ComplexEnumStringsInts()
        {
            //Arrange
            int       vala  = 123;
            int       valb  = 545;
            string    valsa = "String1";
            string    valsb = "ZXCVFDSW";
            eLocateBy loc   = eLocateBy.ByName;

            PayLoad pl = new PayLoad("ComplexEnumStringsInts");

            pl.AddValue(vala);
            pl.AddValue(valb);
            pl.AddValue(valsa);
            pl.AddValue(valsb);
            pl.AddEnumValue(loc);
            pl.ClosePackage();

            // Act
            byte[] b = pl.GetPackage();

            PayLoad pl2    = new PayLoad(b);
            int     vala2  = pl2.GetValueInt();
            int     valb2  = pl2.GetValueInt();
            string  valsa2 = pl2.GetValueString();
            string  valsb2 = pl2.GetValueString();
            string  Loc2   = pl2.GetValueEnum();

            //Assert
            Assert.AreEqual(vala, vala2);
            Assert.AreEqual(valb, valb2);
            Assert.AreEqual(valsa, valsa2);
            Assert.AreEqual(valsb, valsb2);
            Assert.AreEqual(loc.ToString(), Loc2);
        }
Esempio n. 2
0
        private void SetLocateValueControls()
        {
            if (xElementLocateByComboBox.SelectedItem == null)
            {
                xLocateValueVE.Visibility        = System.Windows.Visibility.Visible;
                xLocateValueEditFrame.Visibility = System.Windows.Visibility.Collapsed;
                return;
            }

            eLocateBy SelectedLocType = (eLocateBy)((GingerCore.General.ComboEnumItem)xElementLocateByComboBox.SelectedItem).Value;

            switch (SelectedLocType)
            {
            case eLocateBy.POMElement:
                xLocateValueVE.Visibility        = System.Windows.Visibility.Collapsed;
                xLocateValueEditFrame.Visibility = System.Windows.Visibility.Visible;
                Page p = new LocateByPOMElementPage(mAct);
                xLocateValueEditFrame.Content = p;
                break;

            default:
                xLocateValueVE.Visibility        = System.Windows.Visibility.Visible;
                xLocateValueEditFrame.Visibility = System.Windows.Visibility.Collapsed;
                break;
            }
        }
Esempio n. 3
0
        private void SetLocateValueControls()
        {
            if (xElementLocateByComboBox.SelectedItem == null)
            {
                xLocateValueVE.Visibility        = System.Windows.Visibility.Visible;
                xLocateValueEditFrame.Visibility = System.Windows.Visibility.Collapsed;
                return;
            }
            else
            {
                mAct.LocateBy = (eLocateBy)((ComboEnumItem)xElementLocateByComboBox.SelectedItem).Value;
            }

            eLocateBy SelectedLocType = (eLocateBy)((ComboEnumItem)xElementLocateByComboBox.SelectedItem).Value;

            switch (SelectedLocType)
            {
            case eLocateBy.POMElement:
                xLocateValueVE.Visibility        = System.Windows.Visibility.Collapsed;
                xLocateValueEditFrame.Visibility = System.Windows.Visibility.Visible;
                Page p = new LocateByPOMElementPage(Context.GetAsContext(mAct.Context), null, null, mAct, nameof(ActBrowserElement.LocateValue));
                xLocateValueEditFrame.Content = p;
                break;

            default:
                xLocateValueVE.Visibility        = System.Windows.Visibility.Visible;
                xLocateValueEditFrame.Visibility = System.Windows.Visibility.Collapsed;
                break;
            }
        }
Esempio n. 4
0
 public void SetActionDetails(String Description, eLocateBy LocateBy, String LocateValue, ActPBControl.eControlAction ControlAction, String Value)
 {
     this.Description   = Description;
     this.LocateBy      = LocateBy;
     this.LocateValue   = LocateValue;
     this.ControlAction = ControlAction;
     this.Value         = Value;
 }
Esempio n. 5
0
 public object GetElementData(eLocateBy elementLocateBy = eLocateBy.ByXPath, string elementLocateValue = "")
 {
     //We cache the data, if needed add refresh button
     if (mData == null)
     {
         mData = this.WindowExplorer.GetElementData(this, elementLocateBy, elementLocateValue);
     }
     return(mData);
 }
Esempio n. 6
0
        private Page GetLocateValueEditPage(eLocateBy SelectedLocType)
        {
            switch (SelectedLocType)
            {
            case eLocateBy.ByXY:
                return(new LocateByXYEditPage(mAction));

            default:
                return(new LocateValueEditPage(mAction));
            }
        }
Esempio n. 7
0
 public override bool HandleSwitchWindow(eLocateBy locateBy, string locateValue)
 {
     if (locateBy == eLocateBy.ByXPath)
     {
         object AE = FindElementByLocator(locateBy, locateValue);
         CurrentWindow = (AutomationElement)AE;
         UpdateRootElement();
         return(true);
     }
     return(SwitchToWindow(locateValue));
 }
Esempio n. 8
0
        public override object FindElementByLocator(eLocateBy eLocatorType, string LocateValue)
        {
            AutomationElement CurAE = null;

            switch (eLocatorType)
            {
            case eLocateBy.ByName:
                ConditionBase CurCond2 = new PropertyCondition(AutomationObjectIds.NameProperty, LocateValue);
                CurAE = this.CurrentWindow.FindFirst(TreeScope.Subtree, CurCond2);

                //For old compativity where Name was the text we fail over to search by Text, PB Only, it is slower as it scan the tree and call win api to get the text
                if (Object.ReferenceEquals(CurAE, null) && mPlatform == ePlatform.PowerBuilder)
                {
                }
                break;

            case eLocateBy.ByXPath:
                UIAElementInfo e = (UIAElementInfo)mXPathHelper.GetElementByXpath(LocateValue);
                CurAE = (AutomationElement)e.ElementObject;
                break;

            case eLocateBy.ByAutomationID:
                ConditionBase CurCond3 = new PropertyCondition(val.AutomationId, LocateValue);
                CurAE = CurrentWindow.FindFirst(TreeScope.Subtree, CurCond3);
                break;

            case eLocateBy.ByClassName:
                ConditionBase CurCond4 = new PropertyCondition(val.ClassName, LocateValue);
                CurAE = CurrentWindow.FindFirst(TreeScope.Subtree, CurCond4);
                break;

            case eLocateBy.ByXY:
                double   xx = 0, yy = 0;
                bool     statusFlag;
                string[] str = LocateValue.Split(',');
                xx = Convert.ToDouble(str[0]);
                yy = Convert.ToDouble(str[1]);
                xx = xx + Convert.ToInt32(CurrentWindow.Properties.BoundingRectangle.Value.X);
                yy = yy + Convert.ToInt32(CurrentWindow.Properties.BoundingRectangle.Value.Y);
                System.Windows.Point point = new System.Windows.Point(xx, yy);
                statusFlag = WinAPIAutomation.SetForeGroundWindow(CurrentWindow.Properties.ProcessId);
                if (statusFlag == false)
                {
                }
                CurAE = CurrentWindow.Automation.FromPoint(point);
                break;

            default:
                throw new Exception("Locator not implement - " + eLocatorType.ToString());
            }
            return(CurAE);
        }
Esempio n. 9
0
        private bool IsLocatorExist(ObservableList <ElementLocator> locators, eLocateBy locateBy, string locateValue)
        {
            ElementLocator locator = locators.Where(x => x.LocateBy == locateBy && x.LocateValue == locateValue).FirstOrDefault();

            if (locator != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 10
0
        private bool CheckLocatorPriority(ObservableList <ElementLocator> locators, eLocateBy locateBy, string locateValue, bool isActive, int priorityIndexValue)
        {
            ElementLocator locator = locators.Where(x => x.LocateBy == locateBy && x.LocateValue == locateValue).FirstOrDefault();

            if (locator != null && locator.Active == isActive && locators.IndexOf(locator) == priorityIndexValue)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 11
0
        private void ElementLocateByComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            LocateValueEditFrame.Content = null;
            if (ElementLocateByComboBox.SelectedItem == null)
            {
                return;
            }
            eLocateBy SelectedLocType = (eLocateBy)((GingerCore.General.ComboEnumItem)ElementLocateByComboBox.SelectedItem).Value;
            Page      p = GetLocateValueEditPage(SelectedLocType);

            LocateValueEditFrame.Content = p;
            UpdateActionInfo(mAction.ElementAction);
        }
Esempio n. 12
0
        private eLocateBy GetLocateBy()
        {
            eLocateBy eVal = eLocateBy.ByXPath;

            if (Enum.TryParse <eLocateBy>(mAct.GetOrCreateInputParam(ActVisualTesting.Fields.LocateBy).Value, out eVal))
            {
                return(eVal);
            }
            else
            {
                return(eLocateBy.ByXPath);
            }
        }
        /// <summary>
        /// This method is used to find the relative element from POM for the existing action
        /// </summary>
        /// <param name="newActUIElement"></param>
        /// <param name="pomModelObject"></param>
        /// <param name="elementMatchedInPOM"></param>
        /// <returns></returns>
        public Act GetMappedElementFromPOMForAction(Act newActUIElement, Guid pomModelObject, ref bool elementMatchedInPOM)
        {
            try
            {
                elementMatchedInPOM = false;
                if (pomModelObject != default(Guid))
                {
                    ObservableList <ApplicationPOMModel> pomLst = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <ApplicationPOMModel>();
                    ApplicationPOMModel selectedPOM             = pomLst.Where(x => x.Guid == pomModelObject).SingleOrDefault();

                    ElementInfo elementInfo     = null;
                    string      locateValue     = Convert.ToString(newActUIElement.GetType().GetProperty(ActUIElementLocateValueField).GetValue(newActUIElement, null));
                    eLocateBy   elementLocateBy = GeteLocateByEnumItem(Convert.ToString(newActUIElement.GetType().GetProperty(ActUIElementElementLocateByField).GetValue(newActUIElement, null)));

                    var matchingExistingLocator = selectedPOM.MappedUIElements.Where(x => x.Locators.Any(y => y.LocateBy == elementLocateBy && y.LocateValue.ToLower().Trim().Equals(locateValue.ToLower().Trim())));
                    if (matchingExistingLocator != null)
                    {
                        elementInfo = matchingExistingLocator.FirstOrDefault();
                        if (elementInfo != null)
                        {
                            elementMatchedInPOM = true;
                            PropertyInfo pLocateBy = newActUIElement.GetType().GetProperty(ActUIElementElementLocateByField);
                            if (pLocateBy != null)
                            {
                                if (pLocateBy.PropertyType.IsEnum)
                                {
                                    pLocateBy.SetValue(newActUIElement, Enum.Parse(pLocateBy.PropertyType, "POMElement"));
                                }
                            }

                            PropertyInfo pLocateVal = newActUIElement.GetType().GetProperty(ActUIElementElementLocateValueField);
                            if (pLocateVal != null)
                            {
                                pLocateVal.SetValue(newActUIElement, string.Format("{0}_{1}", selectedPOM.Guid.ToString(), elementInfo.Guid.ToString()));
                            }

                            PropertyInfo pElementType = newActUIElement.GetType().GetProperty(ActUIElementElementTypeField);
                            if (pElementType != null && pElementType.PropertyType.IsEnum)
                            {
                                pElementType.SetValue(newActUIElement, Enum.Parse(pElementType.PropertyType, Convert.ToString(elementInfo.ElementTypeEnum)));
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Reporter.ToLog(eLogLevel.ERROR, "Error occurred while trying to Get Mapped Element From POM", ex);
            }
            return(newActUIElement);
        }
Esempio n. 14
0
        public IWebElement LocateElement(Act act, bool AlwaysReturn = false)
        {
            eLocateBy   LocatorType = act.LocateBy;
            string      LocValue    = act.LocateValueCalculated;
            IWebElement elem        = null;

            if (LocatorType == eLocateBy.ByID)
            {
                elem = Driver.FindElementById(LocValue);
            }
            if (LocatorType == eLocateBy.ByXPath)
            {
                elem = Driver.FindElementByXPath(LocValue);
            }
            return(elem);
        }
Esempio n. 15
0
        private void SetLocateValueFrame()
        {
            LocateValueEditFrame.Content = null;
            if (xValidationElementLocateByComboBox.ComboBox.SelectedItem == null)
            {
                return;
            }
            eLocateBy SelectedLocType = (eLocateBy)((ComboItem)xValidationElementLocateByComboBox.ComboBox.SelectedItem).Value;
            Page      p = GetLocateValueEditPage(SelectedLocType);

            LocateValueEditFrame.Content = p;
            if (SelectedLocType != eLocateBy.POMElement)
            {
                xValidationElementTypeComboBox.ComboBox.IsEnabled = true;
            }
        }
Esempio n. 16
0
        object IWindowExplorer.GetElementData(ElementInfo ElementInfo, eLocateBy elementLocateBy, string elementLocateValue)
        {
            object obj = null;

            if (ElementInfo.GetType().Equals(typeof(HTMLElementInfo)))
            {
                HTMLElementInfo EI = (HTMLElementInfo)ElementInfo;
                obj = mUIAutomationHelper.GetHTMLHelper();
                obj = EI.ElementObject;
            }
            else if (ElementInfo.GetType().Equals(typeof(UIAElementInfo)))
            {
                UIAElementInfo EI = (UIAElementInfo)ElementInfo;
                obj = mUIAutomationHelper.GetElementData(EI.ElementObject);
            }
            return(obj);
        }
Esempio n. 17
0
        private string GetDriverfindElem(eLocateBy locateBy, string locateValue)
        {
            //TODO: per loc by put the correct locator
            string lb = "";

            switch (locateBy)
            {
            case eLocateBy.ByID:
                lb = "By.id";
                break;

            case eLocateBy.ByClassName:
                lb = "By.className";
                break;

            case eLocateBy.ByCSS:
                lb = "By.cssSelector";
                break;

            case eLocateBy.ByXPath:
                lb = "By.xpath";
                break;

            case eLocateBy.ByName:
                lb = "By.name";
                break;

            case eLocateBy.ByLinkText:
                lb = "By.linkText";
                break;

            case eLocateBy.ByValue:
                string s1 = "driver.findElement(By.cssSelector(\"input[value='" + VE(locateValue) + "']\"))";
                return(s1);

            //TODO: add the rest

            default:
                lb = "By." + Missing + locateBy;
                break;
            }

            string s = "driver.findElement(" + lb + "(" + VE(locateValue) + "))";

            return(s);
        }
        private void SetLocateValueFrame()
        {
            LocateValueEditFrame.Content = null;
            if (ElementLocateByComboBox.SelectedItem == null)
            {
                return;
            }
            eLocateBy SelectedLocType = (eLocateBy)((ComboEnumItem)ElementLocateByComboBox.SelectedItem).Value;
            Page      p = GetLocateValueEditPage(SelectedLocType);

            LocateValueEditFrame.Content = p;
            UpdateActionInfo(mAction.ElementAction);
            //if (SelectedLocType != eLocateBy.POMElement)
            //{
            //    ElementTypeComboBox.IsEnabled = true;
            //}
        }
Esempio n. 19
0
        private Page GetLocateValueEditPage(eLocateBy SelectedLocType)
        {
            switch (SelectedLocType)
            {
            case eLocateBy.POMElement:
                ElementTypeComboBox.IsEnabled = false;
                LocateByPOMElementPage locateByPOMElementPage = new LocateByPOMElementPage(mAction);
                locateByPOMElementPage.ElementChangedPageEvent -= POMElementChanged;
                locateByPOMElementPage.ElementChangedPageEvent += POMElementChanged;
                return(locateByPOMElementPage);

            case eLocateBy.ByXY:
                return(new LocateByXYEditPage(mAction));

            default:
                return(new LocateValueEditPage(mAction));
            }
        }
        private Page GetLocateValueEditPage(eLocateBy SelectedLocType)
        {
            switch (SelectedLocType)
            {
            case eLocateBy.POMElement:
                //ElementTypeComboBox.IsEnabled = false;
                LocateByPOMElementPage locateByPOMElementPage = new LocateByPOMElementPage(Context.GetAsContext(mAction.Context), mAction, nameof(ActUIElement.ElementType), mAction, nameof(ActUIElement.ElementLocateValue));
                locateByPOMElementPage.ElementChangedPageEvent -= POMElementChanged;
                locateByPOMElementPage.ElementChangedPageEvent += POMElementChanged;
                return(locateByPOMElementPage);

            case eLocateBy.ByXY:
                return(new LocateByXYEditPage(mAction, mAction, ActUIElement.Fields.ElementLocateValue));

            default:
                return(new LocateValueEditPage(Context.GetAsContext(mAction.Context), mAction, ActUIElement.Fields.ElementLocateValue));
            }
        }
Esempio n. 21
0
        private Page GetLocateValueEditPage(eLocateBy SelectedLocType)
        {
            ActInputValue objValidationElementType         = mAct.GetOrCreateInputParam(ActUIElement.Fields.ValidationElement, string.Empty);
            ActInputValue objValidationElementLocatorValue = mAct.GetOrCreateInputParam(ActUIElement.Fields.ValidationElementLocatorValue, "");

            switch (SelectedLocType)
            {
            case eLocateBy.POMElement:
                xValidationElementTypeComboBox.IsEnabled = false;
                LocateByPOMElementPage locateByPOMElementPage = new LocateByPOMElementPage(Context.GetAsContext(mAct.Context), objValidationElementType, nameof(ActInputValue.Value), objValidationElementLocatorValue, nameof(ActInputValue.Value));
                return(locateByPOMElementPage);

            case eLocateBy.ByXY:
                return(new LocateByXYEditPage(mAct, objValidationElementLocatorValue, nameof(ActInputValue.Value)));

            default:
                return(new LocateValueEditPage(Context.GetAsContext(mAct.Context), objValidationElementLocatorValue, nameof(ActInputValue.Value)));
            }
        }
Esempio n. 22
0
        internal AutomationElement TryGetActElementByLocator(Act A, eLocateBy LocateBy, string LocateValue)
        {
            AutomationElement e = null;

            switch (LocateBy)
            {
            case eLocateBy.ByID:

                break;

            case eLocateBy.ByName:

                break;

            case eLocateBy.ByLinkText:

                break;

            case eLocateBy.ByValue:
                break;

            case eLocateBy.ByHref:
                break;

            case eLocateBy.ByCSS:

                return(null);

            //TODO:
            case eLocateBy.ByXPath:
                break;

            case eLocateBy.NA:
            case eLocateBy.Unknown:
                //Do nothing
                break;

            default:
                A.Error = "Locator Not implemented yet - " + LocateBy;
                break;
            }
            return(e);
        }
Esempio n. 23
0
        private Page GetLocateValueEditPage(eLocateBy SelectedLocType)
        {
            switch (SelectedLocType)
            {
            case eLocateBy.POMElement:
                LocateValueLable.Visibility   = Visibility.Collapsed;
                LocateValueEditFrame.Width    = 1035;
                ElementTypeComboBox.IsEnabled = false;
                return(new LocateByPOMElement(mAction));

            case eLocateBy.ByXY:
                LocateValueLable.Visibility = Visibility.Visible;
                LocateValueEditFrame.Width  = 254;
                return(new LocateByXYEditPage(mAction));

            default:
                LocateValueLable.Visibility = Visibility.Visible;
                LocateValueEditFrame.Width  = 254;
                return(new LocateValueEditPage(mAction));
            }
        }
 List <object> IXPath.GetAllElementsByLocator(eLocateBy LocatorType, string LocValue)
 {
     return(null);
 }
        /// <summary>
        /// This method will get the eLocateBy
        /// </summary>
        /// <returns></returns>
        private eLocateBy GeteLocateByEnumItem(string sEnum)
        {
            eLocateBy item = (eLocateBy)System.Enum.Parse(typeof(eLocateBy), sEnum);

            return(item);
        }
Esempio n. 26
0
        object IWindowExplorer.GetElementData(ElementInfo ElementInfo, eLocateBy elementLocateBy, string elementLocateValue)
        {
            UIAElementInfo EI = (UIAElementInfo)ElementInfo;

            return(mUIAutomationHelper.GetElementData(EI.ElementObject));
        }
Esempio n. 27
0
        public static BusinessFlow ConvertSeleniumScript(string FileName)
        {
            //TODO: move code from here to converter/import class
            var      doc    = new HtmlDocument();
            Activity result = new Activity()
            {
                Active = true
            };

            BusinessFlow  bf = new BusinessFlow("");
            ePlatformType actionsPlatform = ePlatformType.Web;

            try
            {
                //get the required platform for actions
                string selectedPlatform = "";
                if (InputBoxWindow.OpenDialog("Required Platform", "Required platform (set 'Web' or 'Mobile'):", ref selectedPlatform))
                {
                    if (selectedPlatform.Trim().ToUpper() == "MOBILE")
                    {
                        actionsPlatform = ePlatformType.Mobile;
                    }
                }

                doc.Load(FileName);

                result.ActivityName = doc.DocumentNode.Descendants("title").FirstOrDefault().InnerText;
                bf.Name             = doc.DocumentNode.Descendants("title").FirstOrDefault().InnerText;

                List <HtmlNode> rows = doc.DocumentNode.Descendants("tbody").FirstOrDefault().Descendants()
                                       .Where(o => o.Name.StartsWith("tr")).ToList();
                bf.Activities.Add(result);
                string action      = "";
                string locatevalue = "";
                string value       = "";
                // string locby = "";
                ActGenElement.eGenElementAction GenAction;
                eLocateBy locType = eLocateBy.ByXPath;

                foreach (HtmlNode row in rows)
                {
                    if (row.Descendants("title").Count() > 0)
                    {
                        if (bf != null)
                        {
                            WorkSpace.Instance.SolutionRepository.AddRepositoryItem(bf);
                        }
                        bf     = new BusinessFlow(row.Descendants("title").FirstOrDefault().InnerText);
                        result = new Activity()
                        {
                            Active = true
                        };
                        result.ActivityName = row.Descendants("title").FirstOrDefault().InnerText;
                        bf.Activities.Add(result);
                    }
                    else
                    {
                        action      = row.Descendants("td").ToList()[0].InnerText;
                        locatevalue = row.Descendants("td").ToList()[1].InnerText.Replace("&amp;", "&").Replace("&gt;", ">");
                        value       = row.Descendants("td").ToList()[2].InnerText;

                        if (locatevalue.Trim().IndexOf("id=", StringComparison.CurrentCultureIgnoreCase) == 0 ||
                            locatevalue.Trim().IndexOf("id:=", StringComparison.CurrentCultureIgnoreCase) == 0)
                        {
                            locType     = eLocateBy.ByID;
                            locatevalue = locatevalue.Replace("id=", "").Replace("id:=", "");;
                        }

                        if (locatevalue.Trim().IndexOf("link=", StringComparison.CurrentCultureIgnoreCase) == 0 ||
                            locatevalue.Trim().IndexOf("LinkText:=", StringComparison.CurrentCultureIgnoreCase) == 0)
                        {
                            locType     = eLocateBy.ByLinkText;
                            locatevalue = locatevalue.Replace("link=", "").Replace("LinkText:=", "");
                        }
                        if (locatevalue.Trim().IndexOf("css=", StringComparison.CurrentCultureIgnoreCase) == 0 ||
                            locatevalue.Trim().IndexOf("cssselector:=", StringComparison.CurrentCultureIgnoreCase) == 0)
                        {
                            locType     = eLocateBy.ByCSS;
                            locatevalue = locatevalue.Replace("css=", "").Replace("cssselector:=", "");
                        }
                        if (locatevalue.Trim().IndexOf("/") == 0 || locatevalue.Trim().IndexOf("xpath", StringComparison.CurrentCultureIgnoreCase) == 0)
                        {
                            locType     = eLocateBy.ByXPath;
                            locatevalue = locatevalue.Replace("xpath=", "").Replace("xpath:=", "").Replace("xpath:", "").Trim();
                        }

                        switch (action.ToUpper().Trim())
                        {
                        case "OPEN":
                            GenAction   = ActGenElement.eGenElementAction.GotoURL;
                            locType     = eLocateBy.NA;
                            locatevalue = "";
                            break;

                        case "FCOMMONLAUNCHENVIRONMENT":
                            GenAction   = ActGenElement.eGenElementAction.GotoURL;
                            locType     = eLocateBy.NA;
                            value       = locatevalue;
                            locatevalue = "";
                            break;

                        case "TYPE":
                        case "FCOMMONSETVALUEEDITBOX":
                            GenAction = ActGenElement.eGenElementAction.SetValue;
                            break;

                        case "SELECT":
                        case "FCOMMONSELECTIONOPTIONFROMLIST":
                            GenAction = ActGenElement.eGenElementAction.SelectFromDropDown;
                            break;

                        case "FCOMMONJAVASCRIPTCLICK":
                            GenAction = ActGenElement.eGenElementAction.Click;
                            break;

                        case "CLICKANDWAIT":
                        case "CLICK":
                        default:
                            GenAction = ActGenElement.eGenElementAction.Click;
                            break;
                        }

                        result.Acts.Add(new ActGenElement()
                        {
                            Active = true, Description = GenAction.ToString(), LocateBy = locType, LocateValue = locatevalue, GenElementAction = GenAction, Value = value, Platform = actionsPlatform
                        });
                    }
                }
                if (bf != null)
                {
                    return(bf);
                }
            }
            catch (Exception)
            {
                Reporter.ToUser(eUserMsgKey.ImportSeleniumScriptError);
            }
            return(null);
        }
        public LocateByPOMElementPage(Act Action)
        {
            InitializeComponent();
            DataContext = this;
            mAction     = Action;
            SetControlsGridView();

            if (mAction is ActUIElement)
            {
                mLocateBy    = ((ActUIElement)mAction).ElementLocateBy;
                mLocateValue = ((ActUIElement)mAction).ElementLocateValue;
            }
            else
            {
                mLocateBy    = mAction.LocateBy;
                mLocateValue = mAction.LocateValue;
            }

            if (mLocateBy == eLocateBy.POMElement)
            {
                if ((mLocateValue != null) && (mLocateValue != string.Empty))
                {
                    try
                    {
                        string[] pOMandElementGUIDs = mLocateValue.Split('_');
                        Guid     selectedPOMGUID    = new Guid(pOMandElementGUIDs[0]);
                        mSelectedPOM = WorkSpace.Instance.SolutionRepository.GetRepositoryItemByGuid <ApplicationPOMModel>(selectedPOMGUID);
                        if (mSelectedPOM == null)
                        {
                            Reporter.ToUser(eUserMsgKeys.POMSearchByGUIDFailed);
                            mLocateValue = string.Empty;
                            SelectPOM_Click(null, null);
                        }
                        else
                        {
                            SetPOMPathToShow();
                            Guid        selectedPOMElementGUID = new Guid(pOMandElementGUIDs[1]);
                            ElementInfo selectedPOMElement     = (ElementInfo)mSelectedPOM.MappedUIElements.Where(z => z.Guid == selectedPOMElementGUID).FirstOrDefault();
                            if (selectedPOMElement == null)
                            {
                                Reporter.ToUser(eUserMsgKeys.POMElementSearchByGUIDFailed);
                            }
                            else
                            {
                                xPOMElementsGrid.DataSourceList = GenerateElementsDataSourseList();

                                xPOMElementsGrid.Grid.SelectedItem = selectedPOMElement;
                                if (mAction is ActUIElement)
                                {
                                    ((ActUIElement)mAction).ElementType = selectedPOMElement.ElementTypeEnum;
                                }
                                xPOMElementTextBox.Text   = selectedPOMElement.ElementName;
                                HighlightButton.IsEnabled = true;
                            }
                        }
                    }
                    catch
                    {
                        Reporter.ToUser(eUserMsgKeys.POMSearchByGUIDFailed);
                        mLocateValue = string.Empty;
                        SelectPOM_Click(null, null);
                    }
                }
            }
        }
Esempio n. 29
0
 ObservableList <OptionalValue> IWindowExplorer.GetOptionalValuesList(ElementInfo ElementInfo, eLocateBy elementLocateBy, string elementLocateValue)
 {
     throw new NotImplementedException();
 }
Esempio n. 30
0
 object IWindowExplorer.GetElementData(ElementInfo ElementInfo, eLocateBy elementLocateBy, string elementLocateValue)
 {
     throw new System.NotImplementedException();
 }