Example #1
0
        //**********************************************************************
        /// <summary>
        /// Open excel file, verify content contains or not contains given string.
        /// </summary>
        public static void VerifyExcelfileValues(LxScriptItem item)
        {
            string strPath     = item.getArgText();
            string strFileName = strPath.Substring(strPath.LastIndexOf("/") + 1, strPath.Length - strPath.LastIndexOf("/") - 1);
            string mark        = item.getArg3Text();       // flag=true, contains; flag=false, not contains.

            System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
            startInfo.FileName  = "excel.exe";
            startInfo.Arguments = " " + strPath;
            System.Diagnostics.Process process = System.Diagnostics.Process.Start(startInfo);
            RepoItemInfo targetCellInfo        = new RepoItemInfo(repo.ExternalApp.FormExcel.TableEntityInfo.ParentFolder, "variableCell",
                                                                  repo.ExternalApp.FormExcel.TableEntityInfo.Path + "/row/cell[@text='" + item.getArg2Text() + "']",
                                                                  10000, null, System.Guid.NewGuid().ToString());


            Delay.Milliseconds(6000);
            bool bExists = targetCellInfo.Exists();

            process.Kill();
            if (mark.Equals("True"))
            {
                Validate.AreEqual(bExists, true);
            }
            else
            {
                Validate.AreEqual(bExists, false);
            }
        }
Example #2
0
        //**********************************************************************
        /// <summary>
        /// Send command to simulator, sent traps, change data OID values.
        /// </summary>
        public static void SendCommandToSimulator(LxScriptItem item)
        {
            string strDestination = item.getArgText();
            string IP             = "";
            string port           = "163";

            if (strDestination.IndexOf(":") != -1)
            {
                string[] spilt = strDestination.Split(':');
                //IP = strDestination.Substring(0,strDestination.IndexOf(":"));
                //port = strDestination.Substring(strDestination.IndexOf(":")+1,strDestination.Length - strDestination.IndexOf(":"));
                IP   = spilt[0];
                port = spilt[1];
            }
            else
            {
                IP = strDestination;
            }
            int    circle  = Convert.ToInt32(item.getArg2Text());
            string message = item.getArg3Text();

            IPAddress  GroupAddress = IPAddress.Parse(IP);
            int        GroupPort    = Convert.ToInt32(port);
            UdpClient  sender       = new UdpClient();
            IPEndPoint groupEP      = new IPEndPoint(GroupAddress, GroupPort);

            for (int i = 0; i < circle; i++)
            {
                byte[] bytes = StrToByteArray(message);
                sender.Send(bytes, bytes.Length, groupEP);
                Delay.Milliseconds(50);
            }

            sender.Close();
        }
Example #3
0
        //**********************************************************************
        /// <summary>
        /// Open txt file, verify content contains or not contains given string.
        /// </summary>
        public static void VerifyTxtfileValues(LxScriptItem item)
        {
            string strPath     = item.getArgText();
            string strFileName = strPath.Substring(strPath.LastIndexOf("/") + 1, strPath.Length - strPath.LastIndexOf("/") - 1);
            string flag        = item.getArg3Text();       // flag=true, contains; flag=false, not contains.

            System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
            //startInfo.CreateNoWindow = true;
            startInfo.FileName = "notepad.exe";
            //startInfo.UseShellExecute = false;
            //startInfo.RedirectStandardOutput = true;
            //startInfo.RedirectStandardInput = true;
            startInfo.Arguments = " " + strPath;
            System.Diagnostics.Process process = System.Diagnostics.Process.Start(startInfo);
            bool bContains = repo.ExternalApp.NotePad.MainContext.TextValue.IndexOf(item.getArg2Text()) == -1?false:true;

            Delay.Milliseconds(6000);
            process.Kill();
            if (flag.Equals("True"))
            {
                Validate.AreEqual(bContains, true);
            }
            else
            {
                Validate.AreEqual(bContains, false);
            }
        }
Example #4
0
        //**********************************************************************
        /// <summary>
        /// Form action: Add device.
        /// </summary>
        public static void Add_Device(LxScriptItem item)
        {
            repo.NFormApp.NformG2Window.FormMain.Configure.Click();
            repo.NFormApp.NformG2Window.FormMain.Devices.Click();
            repo.NFormApp.ManagedDevicesWindow.FormManaged_Devices.Add.Click();

            if (item.getArgText() == "SingleAuto")
            {
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Next.Click();
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Hostname_or_IP_address.PressKeys(item.getArg2Text());
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Obtain_setting_from_device.Check();
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Next.Click();
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Finish.Click();
                Delay.Milliseconds(5000);
                repo.NFormApp.AddDeviceWizard.FormAdd_Device_Results.OK.Click();
                repo.NFormApp.ManagedDevicesWindow.FormManaged_Devices.Close.Click();
            }
            if (item.getArgText() == "SingleManual")
            {
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Next.Click();
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Hostname_or_IP_address.PressKeys(item.getArg2Text());
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Obtain_setting_from_device.Uncheck();
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Next.Click();
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Name.PressKeys(item.getArg3Text());
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Description.PressKeys(item.getArg4Text());
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Device_type.SelectedItemText     = item.getArg5Text();
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Device_protocol.SelectedItemText = item.getArg6Text();
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Finish.Click();
                Delay.Milliseconds(5000);
                repo.NFormApp.AddDeviceWizard.FormAdd_Device_Results.OK.Click();
                repo.NFormApp.ManagedDevicesWindow.FormManaged_Devices.Close.Click();
            }

            if (item.getArgText() == "MultiSearch")
            {
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Discover_devices.Click();
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Next.Click();
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.DeleteRow.Click();
                while (repo.NFormApp.AddDeviceWizard.FormAdd_Device.DeleteRow.Enabled == true)
                {
                    repo.NFormApp.AddDeviceWizard.FormAdd_Device.DeleteRow.Click();
                }
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Search_device_table.Rows[1].Cells[0].Click();
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Search_device_table.Rows[1].Cells[1].Click();
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Search_device_table.Rows[1].Cells[1].Click();
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Search_device_table.Rows[1].Cells[1].PressKeys(item.getArg2Text() + "{TAB}{CONTROL down}{Akey}{CONTROL up}" + item.getArg3Text());
                Delay.Duration(1000);
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Next.Click();
                Delay.Duration(4000);
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Next.Click();
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Select_all.Click();
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Finish.Click();
                Delay.Duration(2000);
                repo.NFormApp.AddDeviceWizard.FormAdd_Device_Results.OK.Click();
                repo.NFormApp.ManagedDevicesWindow.FormManaged_Devices.Close.Click();
            }
        }
Example #5
0
        //**********************************************************************
        /// <summary>
        /// Input Cell by given index in the Table.
        /// </summary>
        public static void Input_Cell(LxScriptItem item)
        {
            object       objComponet     = item.getComponent();
            RepoItemInfo objComponetInfo = item.getComponentInfo();
            Type         objType         = objComponet.GetType();

            if (objType.Name.ToString() == "Table")
            {
                Ranorex.Table tb = (Ranorex.Table)objComponet;
                tb.Rows[Convert.ToInt32(item.getArgText())].Cells[Convert.ToInt32(item.getArg2Text())].DoubleClick();
                Keyboard.Press("{CONTROL down}{Akey}{CONTROL up}" + item.getArg3Text());
            }
        }
Example #6
0
 //**********************************************************************
 /// <summary>
 /// Form action: VerifyProperty equal, Contains, NotContains.
 /// </summary>
 public static void VerifyProperty(LxScriptItem item)
 {
     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()) + ")).)*$"));
     }
 }
Example #7
0
 //**********************************************************************
 /// <summary>
 /// Form action: VerifyProperty equal, Contains, NotContains.
 /// </summary>
 public static void VerifyProperty(LxScriptItem item)
 {
     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())+")).)*$"));
     }
 }
Example #8
0
        //**********************************************************************
        /// <summary>
        /// Form action: Add device.
        /// </summary>
        public static void Add_Device(LxScriptItem item)
        {
            repo.NFormApp.NformG2Window.FormMain.Configure.Click();
            repo.NFormApp.NformG2Window.FormMain.Devices.Click();
            repo.NFormApp.ManagedDevicesWindow.FormManaged_Devices.Add.Click();

            if(item.getArgText() == "SingleAuto")
            {
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Next.Click();
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Hostname_or_IP_address.PressKeys(item.getArg2Text());
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Obtain_setting_from_device.Check();
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Next.Click();
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Finish.Click();
                Delay.Milliseconds(5000);
                repo.NFormApp.AddDeviceWizard.FormAdd_Device_Results.OK.Click();
                repo.NFormApp.ManagedDevicesWindow.FormManaged_Devices.Close.Click();
            }
            if(item.getArgText() == "SingleManual")
            {
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Next.Click();
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Hostname_or_IP_address.PressKeys(item.getArg2Text());
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Obtain_setting_from_device.Uncheck();
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Next.Click();
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Name.PressKeys(item.getArg3Text());
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Description.PressKeys(item.getArg4Text());
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Device_type.SelectedItemText = item.getArg5Text();
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Device_protocol.SelectedItemText = item.getArg6Text();
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Finish.Click();
                Delay.Milliseconds(5000);
                repo.NFormApp.AddDeviceWizard.FormAdd_Device_Results.OK.Click();
                repo.NFormApp.ManagedDevicesWindow.FormManaged_Devices.Close.Click();
            }

            if(item.getArgText() == "MultiSearch")
            {
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Discover_devices.Click();
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Next.Click();
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.DeleteRow.Click();
                while(repo.NFormApp.AddDeviceWizard.FormAdd_Device.DeleteRow.Enabled==true)
                {
                    repo.NFormApp.AddDeviceWizard.FormAdd_Device.DeleteRow.Click();
                }
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Search_device_table.Rows[1].Cells[0].Click();
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Search_device_table.Rows[1].Cells[1].Click();
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Search_device_table.Rows[1].Cells[1].Click();
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Search_device_table.Rows[1].Cells[1].PressKeys(item.getArg2Text() + "{TAB}{CONTROL down}{Akey}{CONTROL up}" +item.getArg3Text());
                Delay.Duration(1000);
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Next.Click();
                Delay.Duration(4000);
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Next.Click();
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Select_all.Click();
                repo.NFormApp.AddDeviceWizard.FormAdd_Device.Finish.Click();
                Delay.Duration(2000);
                repo.NFormApp.AddDeviceWizard.FormAdd_Device_Results.OK.Click();
                repo.NFormApp.ManagedDevicesWindow.FormManaged_Devices.Close.Click();
            }
        }
Example #9
0
        //**********************************************************************
        /// <summary>
        /// Open txt file, verify content contains or not contains given string.
        /// </summary>
        public static void VerifyTxtfileValues(LxScriptItem item)
        {
            string strPath = item.getArgText();
            string strFileName = strPath.Substring(strPath.LastIndexOf("/") + 1,strPath.Length - strPath.LastIndexOf("/") -1);
            string flag = item.getArg3Text();  // flag=true, contains; flag=false, not contains.

            System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
               			//startInfo.CreateNoWindow = true;
               			startInfo.FileName = "notepad.exe";
            //startInfo.UseShellExecute = false;
            //startInfo.RedirectStandardOutput = true;
            //startInfo.RedirectStandardInput = true;
               			startInfo.Arguments = " " + strPath;
               			System.Diagnostics.Process process = System.Diagnostics.Process.Start(startInfo);
               			bool bContains = repo.ExternalApp.NotePad.MainContext.TextValue.IndexOf(item.getArg2Text())==-1?false:true;

               			Delay.Milliseconds(6000);
            process.Kill();
            if(flag.Equals("True"))
                Validate.AreEqual(bContains,true);
            else
                Validate.AreEqual(bContains,false);
        }
Example #10
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);
            }
        }
Example #11
0
        //**********************************************************************
        /// <summary>
        /// Input Cell by given index in the Table.
        /// </summary>
        public static void Input_Cell(LxScriptItem item)
        {
            object objComponet = item.getComponent();
            RepoItemInfo objComponetInfo = item.getComponentInfo();
            Type objType = objComponet.GetType();

            if(objType.Name.ToString() == "Table")
            {
                Ranorex.Table tb = (Ranorex.Table)objComponet;
                tb.Rows[Convert.ToInt32(item.getArgText())].Cells[Convert.ToInt32(item.getArg2Text())].DoubleClick();
                Keyboard.Press("{CONTROL down}{Akey}{CONTROL up}"+item.getArg3Text());
            }
        }
Example #12
0
 //**********************************************************************
 /// <summary>
 /// Form action: Login in.
 /// </summary>
 public static void Login(LxScriptItem item)
 {
     repo.NFormApp.LogintoLiebertNformWindow.FormLogin_to_LiebertR_Nform.Username.PressKeys(item.getArgText());
     repo.NFormApp.LogintoLiebertNformWindow.FormLogin_to_LiebertR_Nform.Password.PressKeys(item.getArg2Text());
     repo.NFormApp.LogintoLiebertNformWindow.FormLogin_to_LiebertR_Nform.ServerCombo.PressKeys(item.getArg3Text());
     repo.NFormApp.LogintoLiebertNformWindow.FormLogin_to_LiebertR_Nform.Login.Click();
     Delay.Milliseconds(3000);
     if (repo.NFormApp.LogintoLiebertNformWindow.FormEvaluation_Period_Expiration.OKInfo.Exists())
     {
         repo.NFormApp.LogintoLiebertNformWindow.FormEvaluation_Period_Expiration.OK.Click();
     }
 }
Example #13
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);

            }
        }
		/// <summary>
		/// Verify content contains or not contains Error in Server.log and Viewer.log
		/// </summary>
		/// <param name="item">item</param>
		public static void VerifyErrorInLog(LxScriptItem item)
		{
			string strPath = item.getArgText();
			string strFileName = strPath.Substring(strPath.LastIndexOf("/") + 1,strPath.Length - strPath.LastIndexOf("/") -1);
			string flag = item.getArg3Text();  // flag=true, contains; flag=false, not contains.
			
			
			//Add some constant strings in Server.log and Viewer.log
			//These three error infos are added when simulator devices are added, so we need to ignore these infos
			string strConstantError = "Error configuring web card for";
			string strConstantErrorCode = "ErrorCode=10061";
			string strConstantErrorPerforming = "Error performing the request";
			string strError = "Error";
			bool bContains = false;
			
			
			System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
   			startInfo.FileName = "notepad.exe";
   			startInfo.Arguments = " " + strPath;
   			System.Diagnostics.Process process = System.Diagnostics.Process.Start(startInfo); 
   			string strLogFile = repo.ExternalApp.NotePad.MainContext.TextValue;
   			if(strLogFile.LastIndexOf(strError)!=-1)
   			{
	   			string strLogOne = strLogFile.Substring(strLogFile.LastIndexOf(strError), strConstantError.Length);
	   			string strLogTwo = strLogFile.Substring(strLogFile.LastIndexOf(strError), strConstantErrorCode.Length);
	   			string strLogThree = strLogFile.Substring(strLogFile.LastIndexOf(strError), strConstantErrorPerforming.Length);
	   			
	   			if((strConstantError!=strLogOne)&&(strConstantErrorCode!=strLogTwo)&&(strConstantErrorPerforming!=strLogThree))
	   			   bContains = true;
   			}
   			   
   			Delay.Milliseconds(6000);
			process.Kill();
		
			if(flag.Equals("True"))
				Validate.AreEqual(bContains,true);
			else
				Validate.AreEqual(bContains,false);
		}
Example #15
0
 //**********************************************************************
 /// <summary>
 /// Form action: Login in.
 /// </summary>
 public static void Login(LxScriptItem item)
 {
     repo.NFormApp.LogintoLiebertNformWindow.FormLogin_to_LiebertR_Nform.Username.PressKeys(item.getArgText());
     repo.NFormApp.LogintoLiebertNformWindow.FormLogin_to_LiebertR_Nform.Password.PressKeys(item.getArg2Text());
     repo.NFormApp.LogintoLiebertNformWindow.FormLogin_to_LiebertR_Nform.ServerCombo.PressKeys(item.getArg3Text());
     repo.NFormApp.LogintoLiebertNformWindow.FormLogin_to_LiebertR_Nform.Login.Click();
     Delay.Milliseconds(3000);
     //	if(repo.NFormApp.LogintoLiebertNformWindow.FormEvaluation_Period_Expiration.OKInfo.Exists())
     //	{
     //		repo.NFormApp.LogintoLiebertNformWindow.FormEvaluation_Period_Expiration.OK.Click();
     //	}
     //	if(repo.NFormApp.LicensesWindow.FormReminder.RawTextNoInfo.Exists())
     //	{
     //		repo.NFormApp.LicensesWindow.FormReminder.RawTextNo.Click("53;10");
     //	}
 }
Example #16
0
        //**********************************************************************
        /// <summary>
        /// Send command to simulator, sent traps, change data OID values.
        /// </summary>
        public static void SendCommandToSimulator(LxScriptItem item)
        {
            string strDestination = item.getArgText();
            string IP = "";
            string port = "163";
            if(strDestination.IndexOf(":") != -1)
            {
                string[] spilt = strDestination.Split(':');
                //IP = strDestination.Substring(0,strDestination.IndexOf(":"));
                //port = strDestination.Substring(strDestination.IndexOf(":")+1,strDestination.Length - strDestination.IndexOf(":"));
                IP = spilt[0];
                port = spilt[1];
            }
            else
            {
                IP = strDestination;
            }
            int circle = Convert.ToInt32(item.getArg2Text());
            string message = item.getArg3Text();

            IPAddress GroupAddress = IPAddress.Parse(IP);
            int GroupPort = Convert.ToInt32(port);
            UdpClient sender = new UdpClient();
            IPEndPoint groupEP = new IPEndPoint(GroupAddress, GroupPort);
            for(int i = 0;i < circle; i++)
            {
                byte[] bytes = StrToByteArray(message);
                sender.Send(bytes, bytes.Length, groupEP);
                Delay.Milliseconds(50);
            }

            sender.Close();
        }
Example #17
0
        //**********************************************************************
        /// <summary>
        /// Click to given items in the comoponet like List, Table and Tree.
        /// </summary>
        public static void Select_Item(LxScriptItem item)
        {
            object objComponet = item.getComponent();
            RepoItemInfo objComponetInfo = item.getComponentInfo();
            Type objType = objComponet.GetType();

            //MessageBox.Show(objType.Name.ToString());

            if(objType.Name.ToString() == "List")
            {
                RepoItemInfo targetListItemInfo = new RepoItemInfo(objComponetInfo.ParentFolder, "variableListItem",
                                                                   objComponetInfo.Path + "/listitem[@accessiblename='"+ item.getArgText() +"']",
                                                                   10000, null, System.Guid.NewGuid().ToString());
                Ranorex.ListItem targetListItem = targetListItemInfo.CreateAdapter<Ranorex.ListItem>(true);
                targetListItem.Click();
            }

            if(objType.Name.ToString() == "Table")
            {
                RepoItemInfo targetCellInfo = new RepoItemInfo(objComponetInfo.ParentFolder, "variableCell",
                                                                   objComponetInfo.Path + "/row/cell[@text='"+ item.getArgText() +"']",
                                                                   10000, null, System.Guid.NewGuid().ToString());
                Ranorex.Cell targetCell = targetCellInfo.CreateAdapter<Ranorex.Cell>(true);
                targetCell.Click();
            }

            if(objType.Name.ToString() == "Tree")
            {

                String Xpos = " ";
                String Ypos = " ";
                String sPoint ="0;0";

                if((!(item.getArg3Text().Trim().Equals("")))&&(!(item.getArg4Text().Trim().Equals(""))))
                {
                    Xpos = item.getArg3Text();
                    Ypos = item.getArg4Text();
                    sPoint =Xpos+";"+Ypos;
                }

                int treeLevel = Convert.ToInt32(item.getArgText());
                string strTreelevel = "";
                string strTreelevelCkb = "";
                for(int i = 1 ; i <= treeLevel; i++)
                {
                    strTreelevel += "/treeitem";
                    strTreelevelCkb += "/checkbox";
                }

                RepoItemInfo targetTreeItemInfo = new RepoItemInfo(objComponetInfo.ParentFolder, "variableTreeItem",
                                                                   objComponetInfo.Path + strTreelevel +"[@accessiblename='"+ item.getArg2Text() +"']",
                                                                   10000, null, System.Guid.NewGuid().ToString());

                if(targetTreeItemInfo.Exists())
                {
                    Ranorex.TreeItem targetTreeItem = targetTreeItemInfo.CreateAdapter<Ranorex.TreeItem>(true);

                    targetTreeItem.Click(sPoint);
                }
                else
                {
                    targetTreeItemInfo = new RepoItemInfo(objComponetInfo.ParentFolder, "variableTreeItem1",
                                                                   objComponetInfo.Path + strTreelevelCkb +"[@accessiblename='"+ item.getArg2Text() +"']",
                                                                   10000, null, System.Guid.NewGuid().ToString());
                    Ranorex.CheckBox targetTreeItemCkb = targetTreeItemInfo.CreateAdapter<Ranorex.CheckBox>(true);
                    targetTreeItemCkb.Click(sPoint);
                }

            }
        }
Example #18
0
        //**********************************************************************
        /// <summary>
        /// Click to given items in the comoponet like List, Table and Tree.
        /// </summary>
        public static void Select_Item(LxScriptItem item)
        {
            object       objComponet     = item.getComponent();
            RepoItemInfo objComponetInfo = item.getComponentInfo();
            Type         objType         = objComponet.GetType();

            //MessageBox.Show(objType.Name.ToString());

            if (objType.Name.ToString() == "List")
            {
                RepoItemInfo targetListItemInfo = new RepoItemInfo(objComponetInfo.ParentFolder, "variableListItem",
                                                                   objComponetInfo.Path + "/listitem[@accessiblename='" + item.getArgText() + "']",
                                                                   10000, null, System.Guid.NewGuid().ToString());
                Ranorex.ListItem targetListItem = targetListItemInfo.CreateAdapter <Ranorex.ListItem>(true);
                targetListItem.Click();
            }

            if (objType.Name.ToString() == "Table")
            {
                RepoItemInfo targetCellInfo = new RepoItemInfo(objComponetInfo.ParentFolder, "variableCell",
                                                               objComponetInfo.Path + "/row/cell[@text='" + item.getArgText() + "']",
                                                               10000, null, System.Guid.NewGuid().ToString());
                Ranorex.Cell targetCell = targetCellInfo.CreateAdapter <Ranorex.Cell>(true);
                targetCell.Click();
            }

            if (objType.Name.ToString() == "Tree")
            {
                String Xpos   = " ";
                String Ypos   = " ";
                String sPoint = "0;0";

                if ((!(item.getArg3Text().Trim().Equals(""))) && (!(item.getArg4Text().Trim().Equals(""))))
                {
                    Xpos   = item.getArg3Text();
                    Ypos   = item.getArg4Text();
                    sPoint = Xpos + ";" + Ypos;
                }

                int    treeLevel       = Convert.ToInt32(item.getArgText());
                string strTreelevel    = "";
                string strTreelevelCkb = "";
                for (int i = 1; i <= treeLevel; i++)
                {
                    strTreelevel    += "/treeitem";
                    strTreelevelCkb += "/checkbox";
                }

                RepoItemInfo targetTreeItemInfo = new RepoItemInfo(objComponetInfo.ParentFolder, "variableTreeItem",
                                                                   objComponetInfo.Path + strTreelevel + "[@accessiblename='" + item.getArg2Text() + "']",
                                                                   10000, null, System.Guid.NewGuid().ToString());

                if (targetTreeItemInfo.Exists())
                {
                    Ranorex.TreeItem targetTreeItem = targetTreeItemInfo.CreateAdapter <Ranorex.TreeItem>(true);

                    targetTreeItem.Click(sPoint);
                }
                else
                {
                    targetTreeItemInfo = new RepoItemInfo(objComponetInfo.ParentFolder, "variableTreeItem1",
                                                          objComponetInfo.Path + strTreelevelCkb + "[@accessiblename='" + item.getArg2Text() + "']",
                                                          10000, null, System.Guid.NewGuid().ToString());
                    Ranorex.CheckBox targetTreeItemCkb = targetTreeItemInfo.CreateAdapter <Ranorex.CheckBox>(true);
                    targetTreeItemCkb.Click(sPoint);
                }
            }
        }
Example #19
0
        //**********************************************************************
        /// <summary>
        /// Open excel file, verify content contains or not contains given string.
        /// </summary>
        public static void VerifyExcelfileValues(LxScriptItem item)
        {
            string strPath = item.getArgText();
            string strFileName = strPath.Substring(strPath.LastIndexOf("/") + 1,strPath.Length - strPath.LastIndexOf("/") -1);
            string mark = item.getArg3Text();  // flag=true, contains; flag=false, not contains.

            System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
               			startInfo.FileName = "excel.exe";
               			startInfo.Arguments = " " + strPath;
               			System.Diagnostics.Process process = System.Diagnostics.Process.Start(startInfo);
               			RepoItemInfo targetCellInfo = new RepoItemInfo(repo.ExternalApp.FormExcel.TableEntityInfo.ParentFolder, "variableCell",
                                                                   repo.ExternalApp.FormExcel.TableEntityInfo.Path + "/row/cell[@text='"+ item.getArg2Text() +"']",
                                                                   10000, null, System.Guid.NewGuid().ToString());

               			Delay.Milliseconds(6000);
               			bool bExists = targetCellInfo.Exists();
            process.Kill();
            if(mark.Equals("True"))
                Validate.AreEqual(bExists,true);
            else
                Validate.AreEqual(bExists,false);
        }