Exemple #1
0
        private void RetreiveElementLocationButton_Click(object sender, RoutedEventArgs e)
        {
            string x = string.Empty;
            string y = string.Empty;

            try
            {
                //TODO: Make Generic support not only for web selenium
                string   xAndY        = ((SeleniumDriver)ElementInfo.WindowExplorer).GetXAndYpointsfromClickEvent(ElementInfo);
                string[] spliter      = new string[] { "," };
                string[] cordinations = xAndY.Split(spliter, StringSplitOptions.RemoveEmptyEntries);
                x = cordinations[0];
                y = cordinations[1];
            }
            catch
            {
                ((SeleniumDriver)ElementInfo.WindowExplorer).InjectGingerLiveSpyAndStartClickEvent(ElementInfo);
                Reporter.ToUser(eUserMsgKey.ClickElementAgain);
            }

            if (x == "undefined" || x == "undefined")
            {
                ((SeleniumDriver)ElementInfo.WindowExplorer).StartClickEvent(ElementInfo);
                Reporter.ToUser(eUserMsgKey.ClickElementAgain);
            }
            else
            {
                XOffset.Text = x;
                YOffset.Text = y;
                mAct.AddOrUpdateInputParamValue("XCoordinate", x);
                mAct.AddOrUpdateInputParamValue("YCoordinate", y);
            }
        }
        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)
                {
                    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;
                act = actUI;
            }
            else
            {
                //Set action locator
                act.LocateBy    = EL.LocateBy;
                act.LocateValue = EL.LocateValue;
            }
            return(act);
        }
        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);
        }