示例#1
0
        public static List <List <string> > GetContents(this Ranorex.Unknown container, bool bRemoveHeader)
        {
            if (container.Visible)
            {
                Ranorex.NativeWindow containerText = new Ranorex.NativeWindow(container);


                // gets all non-blank lines from container
                // if a container has blank lines in the middle, may cause problems, just remove option in call
                List <string> lsRows = containerText.WindowText.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries).ToList(); // split the string into an array of rows separated by new line characters

                // removes the container header line
                if (bRemoveHeader)
                {
                    lsRows.RemoveAt(0);
                }

                // split fields from each row
                List <List <string> > contents = new List <List <string> >(); // contents contains rows and columns

                foreach (string currentString in lsRows)
                {
                    contents.Add(currentString.Split(new char[] { '\t' }).ToList());     // split each row into cells separated by tabs
                }

                return(contents);
            }
            else
            {
                return(null);
            }
        }
示例#2
0
        //**********************************************************************
        /// <summary>
        /// After one case running, write additional info to the scripts file
        /// </summary>
        public void writeInfo()
        {
            opXls.writeCell(12, 2, Ranorex.Host.Local.RanorexVersion);
            opXls.writeCell(21, 2, Ranorex.Host.Local.OSEdition + "  " + Ranorex.Host.Local.OSVersion);
            opXls.writeCell(22, 2, Ranorex.Host.Local.RuntimeVersion);


            NformRepository repo = NformRepository.Instance;

            //Delay.Milliseconds(2000);
            if (!repo.NFormApp.NformG2Window.FormMain.HelpInfo.Exists())
            {
                return;
            }
            //Delay.Milliseconds(2000);

            repo.NFormApp.NformG2Window.FormMain.Help.Click();
            repo.NFormApp.NformG2Window.FormMain.About_Liebert_Nform.Click();
            Ranorex.NativeWindow nativeWnd = repo.NFormApp.Help.FormAbout_LiebertR_Nform.ViewerVerInfo.CreateAdapter <Ranorex.NativeWindow>(false);
            string viewVer = nativeWnd.WindowText;

            repo.NFormApp.Help.FormAbout_LiebertR_Nform.TabServer.Click();
            nativeWnd = repo.NFormApp.Help.FormAbout_LiebertR_Nform.ServerVerInfo.CreateAdapter <Ranorex.NativeWindow>(false);
            string severVer = nativeWnd.WindowText;

            repo.NFormApp.Help.FormAbout_LiebertR_Nform.TabDatabase.Click();
            nativeWnd = repo.NFormApp.Help.FormAbout_LiebertR_Nform.DbVersionInfo.CreateAdapter <Ranorex.NativeWindow>(false);
            string dbVer = nativeWnd.WindowText;

            nativeWnd = repo.NFormApp.Help.FormAbout_LiebertR_Nform.DbEditionInfo.CreateAdapter <Ranorex.NativeWindow>(false);
            string dbEdition = nativeWnd.WindowText;

            repo.NFormApp.Help.FormAbout_LiebertR_Nform.TabLicense.Click();
            // nativeWnd = repo.NFormApp.Help.FormAbout_LiebertR_Nform.LicenseDetailInfo.CreateAdapter<Ranorex.NativeWindow>(false);
            string licenseDetail = repo.NFormApp.Help.FormAbout_LiebertR_Nform.LicenseDetail.TextValue;            //nativeWnd.WindowText;

            repo.NFormApp.Help.FormAbout_LiebertR_Nform.TabRegistration.Click();
            nativeWnd = repo.NFormApp.Help.FormAbout_LiebertR_Nform.RegistInfoDscrInfo.CreateAdapter <Ranorex.NativeWindow>(false);
            string regist = nativeWnd.WindowText;

            repo.NFormApp.Help.FormAbout_LiebertR_Nform.OK.Click();

            opXls.writeCell(13, 2, viewVer);
            opXls.writeCell(14, 2, severVer);
            opXls.writeCell(15, 2, dbEdition);
            opXls.writeCell(16, 2, dbVer);
            opXls.writeCell(20, 2, regist);
        }
示例#3
0
        //**********************************************************************
        /// <summary>
        /// Form action: VerifyProperty equal, Contains, NotContains.
        /// </summary>
        public static void VerifyProperty(LxScriptItem item)
        {
            //MessageBox.Show(item.getComponent().ToString());
            // The component is lable
            string testtemp = item.getComponent().ToString();

            if (item.getComponent().ToString().IndexOf("Lbl") != -1)
            {
                Ranorex.NativeWindow nativeWnd = item.getComponentInfo().CreateAdapter <Ranorex.NativeWindow>(false);
                string lableText = nativeWnd.WindowText;

                if (item.getArg2Text() == "Equal")
                {
                    string abc = item.getArg3Text();
                    Validate.AreEqual(lableText, item.getArg3Text());
                }
                if (item.getArg2Text() == "Contains")
                {
                    int iFlag = lableText.IndexOf(item.getArg3Text());
                    Validate.IsTrue(iFlag != -1);
                }
                if (item.getArg2Text() == "NotContains")
                {
                    int iFlag = lableText.IndexOf(item.getArg3Text());
                    Validate.IsTrue(iFlag == -1);
                }
                return;
            }

            if (item.getArg2Text() == "Equal")
            {
                Validate.Attribute(item.getComponentInfo(), item.getArgText(), item.getArg3Text());
            }
            if (item.getArg2Text() == "Contains")
            {
                Validate.Attribute(item.getComponentInfo(), item.getArgText(), new Regex(Regex.Escape(item.getArg3Text())));
            }
            if (item.getArg2Text() == "NotContains")
            {
                Validate.Attribute(item.getComponentInfo(), item.getArgText(), new Regex("^((?!(" + Regex.Escape(item.getArg3Text()) + ")).)*$"));
            }

            if (item.getArg2Text() == "ListContains")
            {
                bool             Resultflag  = false;
                object           objComponet = item.getComponent();
                Ranorex.ComboBox myComboBox  = (Ranorex.ComboBox)(objComponet);
                Ranorex.Button   btn         = myComboBox.FindSingle("./button");
                btn.Click();
                List lst = "/list";
                foreach (ListItem lst_item in lst.FindChildren <ListItem>())
                {
                    if ((lst_item.Text).Equals(item.getArg3Text()))
                    {
                        Resultflag = true;
                        break;
                    }
                }
                btn.Click();
                Validate.AreEqual(Resultflag, true);
            }
        }