Exemplo n.º 1
0
        IGingerWebElement GetValidationElement()
        {
            string            ValidationElementLocateBy     = (string)InputParams["ValidationElementLocateBy"];
            string            ValidationElementLocatorValue = (string)InputParams["ValidationElementLocatorValue"];
            string            mValidationElement            = (string)InputParams["ValidationElement"];
            eElementType      validationElementType         = (eElementType)Enum.Parse(typeof(eElementType), mValidationElement);
            IGingerWebElement ValidationElement             = WebPlatformActionHandler.LocateElement(ref validationElementType, ValidationElementLocateBy, ValidationElementLocatorValue, mPlatformService);

            return(ValidationElement);
        }
Exemplo n.º 2
0
        public void ExecuteAction(ref NodePlatformAction platformAction)
        {
            try
            {
                mPlatformAction = platformAction;

                InputParams = platformAction.InputParams;

                // convert the JArray to list of locators
                JObject Locators = (JObject)InputParams["Locators"];

                eElementType      ElementType = (eElementType)Enum.Parse(typeof(eElementType), (string)InputParams["ElementType"]);
                IGingerWebElement uiElement   = null;
                JArray            Frames      = null;
                if (InputParams.ContainsKey("Frames"))
                {
                    Frames = (JArray)InputParams["Frames"];

                    if (Frames != null && Frames.Children().Count() > 0)
                    {
                        mPlatformService.BrowserActions.SwitchToDefaultContent();
                        foreach (JToken jf in Frames.Children())
                        {
                            IGingerWebElement GWA = mPlatformService.LocateWebElement.LocateElementByXPath(eElementType.WebElement, jf.ToString());
                            mPlatformService.BrowserActions.SwitchToFrame(GWA);
                        }
                    }
                }

                foreach (JProperty locator in Locators.Children())
                {
                    uiElement = WebPlatformActionHandler.LocateElement(ref ElementType, locator.Name, locator.Value.ToString(), mPlatformService);
                    if (uiElement != null)
                    {
                        platformAction.exInfo += "UI Element Located using: " + locator.Name + "=" + locator.Value;
                        break;
                    }
                }
                if (uiElement == null)
                {
                    platformAction.error += "Element not found";

                    return;
                }

                ElementAction = (eElementAction)Enum.Parse(typeof(eElementAction), (string)platformAction.InputParams["ElementAction"]);



                RunActionOnUIElement(uiElement, ElementType);

                //TODO: remove  // update output values - TODO: do it directlyon platformAction !!!
                foreach (NodeActionOutputValue nodeActionOutputValue in AOVs)
                {
                    platformAction.Output.Add(nodeActionOutputValue.Param, (string)nodeActionOutputValue.Value); // TODO: add path !!!
                }
            }

            catch (Exception Ex)
            {
                Error         = Ex.Message;
                ExecutionInfo = Ex.StackTrace;  // DO not put stacktrace !!!!
            }
        }