コード例 #1
0
        /// <summary>
        /// Adds a typing action to the action list
        /// </summary>
        /// <param name="windowName">window where it was performed</param>
        /// <param name="activeElement">element the click was performed on</param>
        /// <param name="url">current url for action</param>
        /// <returns>action created (mainly for testing)</returns>
        public ActionTypeText AddText(string windowName, IHTMLInputElement activeElement, string url)
        {
            var action = new ActionTypeText(_browsers[windowName], (IHTMLElement)activeElement, url);

            AddAction(action);
            return(action);
        }
コード例 #2
0
        private string WriteTextActionToFile()
        {
            const string filename = @"C:\Work\TestRecorder3\tests\output_typing.xml";
            var          action   = new ActionTypeText(new BrowserWindow("window"), GetInputElement("input"));

            SerializeActionHelper.SerializeActionListToFile(new List <ActionBase> {
                action
            }, filename);
            return(filename);
        }
コード例 #3
0
ファイル: ucTypeText.cs プロジェクト: cnboker/autorobo
        private void Setter(ActionTypeText action)
        {
            var text = action.FormatString;

            if (string.IsNullOrEmpty(text))
            {
                txtTextToType.Text = action.TextToType;
                return;
            }
            if (text[0] == '{' && text[text.Length - 1] == '}')
            {
                var arr = text.Substring(1, text.Length - 2).Split(":".ToCharArray());
                typeComboBox.SelectedIndex = Convert.ToInt16(arr[0]);
                lenNumericUpDown.Value     = Convert.ToInt16(arr[1]);
                randomCheckBox.Checked     = true;
            }
        }
コード例 #4
0
        public void WriteTypeTextOverwrite()
        {
            var generator = new WatiNCSharp(GetNUnitTemplate());
            var typing    = new ActionTypeText(new BrowserWindow("window"))
            {
                Overwrite    = true,
                TextToType   = "type this",
                ActionFinder = new FindAttributeCollection {
                    TagName = "TextField"
                }
            };

            typing.ActionFinder.AttributeList.Add(new FindAttribute("id", "txtType"));
            generator.ActionToCode(typing);

            Assert.AreEqual(1, generator.Properties.Count, "different than 1 property");
            Assert.IsNotNull(generator.Properties[0], "property is blank");
            Assert.That(generator.Properties[0].PropertyCode.Contains("_browser.TextField(Find"), "select code not working");

            Assert.AreEqual(1, generator.Code.Count, "different than 1 code line");
            Assert.That(generator.Code[0] == "textfieldTxttype = \"type this\";", "other than valid code");
        }
コード例 #5
0
        static public ActionBase Create(string ActionObjectString)
        {
            ActionBase output = null;

            try
            {
                output = Activator.CreateInstance("AutoRobo.Core", "AutoRobo.Core.Actions." + ActionObjectString).Unwrap() as ActionBase;
            }
            catch
            {
                //兼容老版本数据
                switch (ActionObjectString)
                {
                case "BrowserClick": output = new ActionClick(); break;

                case "Navigate": output = new ActionNavigate(); break;

                case "ScriptPart": output = new ActionScriptPart(); break;

                case "AlertHandler": output = new ActionAlertHandler(); break;

                case "ActionDoubleClick": output = new ActionDoubleClick(); break;

                case "ActionFireEvent": output = new ActionFireEvent(); break;

                case "ActionKey": output = new ActionKey(); break;

                case "Mouse": output = new ActionMouse(); break;

                case "RadioButton": output = new ActionRadio(); break;

                case "Checkbox": output = new ActionCheckbox(); break;

                case "SelectList": output = new ActionSelectList(); break;

                case "TypeText": output = new ActionTypeText(); break;

                case "DirectionKey": output = new ActionDirectionKey(); break;

                case "Sleep": output = new ActionSleep(); break;

                case "Wait": output = new ActionWait(); break;

                case "ValidateCode": output = new ActionValidateCode(); break;

                case "FileUpload": output = new ActionFileDialog(); break;

                case "ValidateImage": output = new ActionValidateImage(); break;

                case "JavascriptInterpreter": output = new ActionJavascriptInterpreter(); break;

                case "SubmitClick": output = new ActionSubmitClick(); break;

                case "CloseWindow": output = new ActionCloseWindow(); break;

                case "WindowBack": output = new ActionBack(); break;

                case "WindowForward": output = new ActionForward(); break;

                case "WindowOpen": output = new ActionOpenWindow(); break;

                case "WindowRefresh": output = new ActionRefresh(); break;

                case "SubElementFinder": output = new ActionSubElements(); break;

                case "CallFunction": output = new ActionCall(); break;

                case "ActionForeach": output = new ActionForeach(); break;

                case "ActionBrowser": output = new ActionBrowser(); break;

                case "ActionThread": output = new ActionThread(); break;
                    //case "AddChildrenToList": output = new AddChildrenToList(); break;
                }
            }
            //if (output == null)
            //{
            //    throw new ApplicationException(string.Format("{0}对应的活动未找到", ActionObjectString));
            //}

            return(output);
        }