Exemple #1
0
        /// <summary>
        /// Find a specified option in all the options contained within a Ranorex.SelectTag
        ///  and return that option's Ranorex.OptionTag.TagValue.
        /// </summary>
        /// <param name="selecttag">Ranorex.SelectTag containing options to search.</param>
        /// <param name="option">Option to find in the Ranorex.SelectTag.</param>
        /// <returns>If option is found, returns Ranorex.OptionTag.TagValue of the found option.
        /// If not found, throws a System.ArgumentException.ArgumentException.</returns>
        private static string FindSelectTagValueForOption(Ranorex.SelectTag selecttag, string option)
        {
            //Handle InnerText that contains white space. e.g.:
            //	InnerText="credit card" or
            //	InnerText="      credit card  " (where there is white space before and/or after)
            //and option = "credit card"
            //Regular expression covers white space before or after the option string
            string patternOptionWhiteSpace = String.Format(@"^\s*{0}\s*$", option);

            //Find TagValue for requested option
            string            tagValueToSelect = null;
            bool              tagOptionInList  = false;
            IList <OptionTag> tagOptions       = selecttag.Options;

            foreach (OptionTag optionTag in tagOptions)
            {
                if (Regex.IsMatch(optionTag.InnerText, patternOptionWhiteSpace))
                {
                    tagValueToSelect = optionTag.TagValue;
                    tagOptionInList  = true;
                    break;
                }
            }
            if (!tagOptionInList)
            {
                throw new ArgumentException(string.Format("None of the SelectTag {0} OptionTags have InnerText of {1}", selecttag.Name, option), "option");
            }
            return(tagValueToSelect);
        }
Exemple #2
0
        public static void selectValue(Ranorex.SelectTag element, string strValue, string ControlName)
        {
            try
            {
                for (int i = 0; i < 3; i++)
                {
                    OptionTag optTag = element.FindSingle(".//option[@innertext='" + strValue + "']");
//		            optTag.Focus();
//		            optTag.EnsureVisible();
//		            element.Click();
//		            Delay.Seconds(1);
//		            optTag.Click();
                    optTag.Selected = true;

//					if(element.Options.IndexOf(strValue).ToString().Equals(element.InnerText.ToString()))
//						break;
                }
                Report.Info(strValue + " is selected in " + ControlName);
                Delay.Milliseconds(300);
            }
            catch (Exception ex)
            {
                Report.Screenshot();
                Report.Failure(strValue + " is not selected due to " + ex.Message);
            }
        }
        public void Wireless_Mode_Selection_5GHz(string argument1)
        {
            Delay.Seconds(5);
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";

            Report.Info("Wireless Mode(argument1) : " + argument1);
            //Ranorex.SelectTag protocolTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//select[#'Channel50']");
            //Ranorex.SelectTag protocolTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//select[#'WiFi50ChannelBW']");
            Ranorex.SelectTag protocolTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//select[#'WirelessMode50']");
            Report.Info(protocolTag.GetInnerHtml().ToString());
            foreach (Ranorex.OptionTag optTag in protocolTag.Find(".//option"))
            {
                Report.Info(optTag.InnerText);
                if (optTag.InnerText.Trim() == argument1.Trim())
                {
                    Report.Info("5GHz Matching-True", argument1);
                    optTag.Selected = true;
                    optTag.Click();
                    optTag.PerformClick();
                    break;
                }
            }
//          TableTag table_2GHz = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'WirelessFrequency50GHz']/table");
//          Report.Screenshot("Wireless_5GHz",table_2GHz.Element,false);
            Report.Screenshot();
        }
        public void Update_Combo_Boxes_For_IPv4_Filter_Range(string argument1, string argument2, string argument3)
        {
            //select combo box values
            //argument1 - protocol, argument2-Source IP Grp, argument3 - Dest IP Grp
            Delay.Seconds(10);
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";

            Ranorex.SelectTag protocolTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//select[#'IPv4ProtocolGrp']");
            //Report.Info(protocolTag.GetInnerHtml().ToString());
            foreach (Ranorex.OptionTag optTag in protocolTag.Find(".//option"))
            {                   //TO SELECT THE PROTOCOL
                //Console.WriteLine(optTag.InnerText);
                //Report.Info(optTag.InnerText);
                if (optTag.InnerText == argument1)
                {
                    //Report.Info("argument1 matching:: "+argument1 );
                    // OptionTag option = "//rxpath/to/option";
                    //option.Selected = true;
                    optTag.Selected = true;
                    break;
                }
            }                           //end of for-loop for Protocol

            //Report.Info("Source IP Group : "+argument2);
            Ranorex.SelectTag IPv4SrcIPGrpTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//select[#'IPv4SrcIPGrp']");
            //Ranorex.SelectTag enableTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'tr_Enabled']/select[@id='Enabled']");
            //Report.Info(IPv4SrcIPGrpTag.GetInnerHtml().ToString());
            foreach (Ranorex.OptionTag optTag in IPv4SrcIPGrpTag.Find(".//option"))
            {                           //TO enable/disable  PORT TRIGGER RULE
                //Console.WriteLine(optTag.InnerText);
                //Report.Info(optTag.InnerText);
                if (optTag.InnerText == argument2)
                {
                    //Report.Info("argument2 matching:: "+argument2 );
                    Delay.Seconds(1);
                    optTag.Selected = true;
                    break;
                }
            }                           //end of for-loop for  Source IP Group

            //Report.Info("Destination IP Category : "+argument3);
            Ranorex.SelectTag IPv4DestIPGrpTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//select[#'IPv4DestIPGrp']");
            //Ranorex.SelectTag enableTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'tr_Enabled']/select[@id='Enabled']");
            //Report.Info(IPv4DestIPGrpTag.GetInnerHtml().ToString());
            foreach (Ranorex.OptionTag optTag in IPv4DestIPGrpTag.Find(".//option"))
            {                           //TO enable/disable  PORT TRIGGER RULE
                //Console.WriteLine(optTag.InnerText);
                //Report.Info(optTag.InnerText);
                if (optTag.InnerText == argument3)
                {
                    //Report.Info("argument3 matching:: "+argument3 );
                    optTag.Selected = true;
                    break;
                }
            }
        }
Exemple #5
0
        /// <summary>
        /// Selects a select tag option by pressing the DOWN key until the option is selected, starting at the top of the options.
        /// </summary>
        /// <param name="selecttag">Ranorex.SelectTag containing the option to select.</param>
        /// <param name="tagValueToSelect">Value of the option in the Ranorex.SelectTag.</param>
        private static void SelectTagValueWithKeyboard(Ranorex.SelectTag selecttag, string tagValueToSelect)
        {
            if (selecttag.TagValue == tagValueToSelect)
            {
                //Current tag value is already the value to select.
                return;
            }
            //Press Down key until current option is requested option, starting at the top option.
            Duration previousDefaultKeyPressTime = Keyboard.DefaultKeyPressTime;

            Keyboard.DefaultKeyPressTime = 10;
            selecttag.Focus();
            Keyboard.Press("{HOME}");
            IList <OptionTag> tagOptions = selecttag.Options;
            string            lastSelectTagOptionValue = tagOptions[tagOptions.Count - 1].TagValue;
            bool tagOptionSelected = false;

            while (!tagOptionSelected)
            {
                if (selecttag.TagValue == tagValueToSelect)
                {
                    tagOptionSelected = true;
                }
                else
                {
                    if (selecttag.TagValue == lastSelectTagOptionValue)
                    {
                        //On last option so tag value not found.
                        break;
                    }
                    //Give selecttag.TagValue time to update after changing the select tag option using the keyboard.
                    const int timeOutMilliseconds          = 5000;
                    int       timeOutRemainingMilliseconds = timeOutMilliseconds;
                    int       delayMilliseconds            = 100;
                    string    previousTagValue             = selecttag.TagValue;
                    Keyboard.Press("{DOWN}");
                    while (selecttag.TagValue == previousTagValue)
                    {
                        Ranorex.Delay.Milliseconds(delayMilliseconds);
                        timeOutRemainingMilliseconds -= delayMilliseconds;
                        if (timeOutRemainingMilliseconds <= 0)
                        {
                            throw new Exception(string.Format("SelectTag {0} tag value did not change within {1} milliseconds after pressing DOWN key. Current selecttag.TagValue:{2}", selecttag.Name, timeOutMilliseconds.ToString(), selecttag.TagValue));
                        }
                    }
                }
            }
            if (!tagOptionSelected)
            {
                throw new ArgumentException(string.Format("None of the selected SelectTag {0} options had a TagValue of {1}", selecttag.Name, tagValueToSelect), "tagValueToSelect");
            }
            Keyboard.DefaultKeyPressTime = previousDefaultKeyPressTime;
        }
Exemple #6
0
        public void Validate_SecurityMode_5GHz_Primary(string argument1)
        {
            //Validate_SecurityMode_5GHz_Primary
            if (argument1 == "")
            {
                argument1 = "WPA-PSK/WPA2-PSK";
            }
            Delay.Seconds(15);
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";

            //Ranorex.SelectTag securityTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'tr_SecurityModeGrp']/select[#'SecurityModeGrp']");
            Ranorex.SelectTag securityTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'tr_SecurityModeGrp50']/select[#'SecurityModeGrp50']");
//	         Ranorex.SelectTag securityTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'tr_SecurityMode50']/select[#'SecurityMode50']");
//	        Ranorex.SelectTag securityTag = webDocument.FindSingle("dom[@domain='192.168.0.1']//select[#'SecurityMode50']");

            Report.Info(securityTag.GetInnerHtml().ToString());


            foreach (Ranorex.OptionTag optTag in securityTag.Find(".//option"))
            {                   //TO SELECT THE SecurityMode
                //Console.WriteLine(optTag.InnerText);
                Report.Info(optTag.InnerText);
                //get the currently selected item name and check if it is Disable

                /*
                 * Report.Info(optTag.Element.GetAttributeValueText("selected"));
                 * if(optTag.Element.GetAttributeValueText("selected").Equals("Disable")){
                 *      Report.Info("security mode cannot be Disable ");
                 * }
                 */
                if (optTag.Element.GetAttributeValueText("selected").Equals("Disable"))
                {
                    // security mode cannot be Disable, so need to change the mode
                    OptionTag optionTag = argument1;
                    optionTag.Selected = true;
                }
                else if (optTag.InnerText == argument1)
                {
                    Report.Info("argument2 matching:: " + argument1);
                    // OptionTag option = "//rxpath/to/option";
                    //option.Selected = true;
                    optTag.Selected = true;
                    Report.Success("Security Mode changed successfully !");
//	                    Report.Screenshot("Security Mode",securityTag.Element,true);
                    Report.Screenshot();
                    break;
                }
            }                   // end of for-loop
            Report.Screenshot();
        }
Exemple #7
0
        /// <summary>
        /// Clicks or sets a web page select tag option.
        /// </summary>
        /// <param name="pathToDOM">Ranorex.Core.Repository.RepoGenBaseFolder.BaseBath of a web page DOM.</param>
        /// <param name="selecttag">Ranorex.SelectTag of a web page select tag.</param>
        /// <param name="option">option to select in select tag.</param>
        public static void ChooseSelectTagOption(string pathToDOM, Ranorex.SelectTag selecttag, string option)
        {
            WebDocument domWebDocument = pathToDOM;

            string selectTagValueForOption = null;

            switch (domWebDocument.BrowserName)
            {
            case "Chrome":
            case "Safari":
            case "Mozilla":
                //Using Chrome and Safari select tag with mouse problematic. So select using keyboard.
                //For Mozilla, OptionTag.Visible does not return the correct value for an option tag that is not visible. So select using keyboard.
                selectTagValueForOption = FindSelectTagValueForOption(selecttag, option);
                SelectTagValueWithKeyboard(selecttag, selectTagValueForOption);
                break;

            case "IE":
                //Click option if visible after clicking select tag.
                String itemToClickRxPath = String.Format("/container[@caption='selectbox']/listitem[@accessiblename='{0}']", option);

                selecttag.Focus();
                selecttag.Click();

                ListItem itemToClick;
                try
                {
                    itemToClick = itemToClickRxPath;
                }
                catch (Exception e)
                {
                    throw new ArgumentException(string.Format("Unable to find option {0} in SelectTag {1}. Exception:{2}", option, selecttag.Name, e), "option");
                }

                if (itemToClick.Visible)
                {
                    itemToClick.Click();
                    break;
                }
                //If not visible, select using keyboard.
                selectTagValueForOption = FindSelectTagValueForOption(selecttag, option);
                //Close Select Tag box.
                selecttag.Click();
                SelectTagValueWithKeyboard(selecttag, selectTagValueForOption);
                break;

            default:
                throw new Exception(String.Format("Browser not supported: {0}", domWebDocument.BrowserName));
            }
        }
Exemple #8
0
        /// <summary>
        /// Gets the current text shown in a web page select tag.
        /// </summary>
        /// <param name="selectTag">Ranorex.SelectTag of a web page select tag.</param>
        /// <returns>The text shown in the select tag.</returns>
        public static string GetSelectTagCurrentText(Ranorex.SelectTag selectTag)
        {
            //Select tag's current value, e.g. -1 = "select one...", 17 = "California"
            String tagValue = selectTag.TagValue;
            //Option tags contained within the select tag
            IList <OptionTag> tagOptions = selectTag.Options;

            //Get InnerText of tag's currently selected option tag
            foreach (OptionTag optionTag in tagOptions)
            {
                if (optionTag.Value == tagValue)
                {
                    return(optionTag.InnerText);
                }
            }
            throw new ArgumentException("SelectTag's current value does not have a corresponding OptionTag", "selectTag");
        }
Exemple #9
0
        public void New_Port_Triggering_Rule(string argument1, string argument2)
        {
            // argument1 - protocol

            Report.Info("Protocol :" + argument1);
            //Report.Info(" Inside Populate_Port_Triggering_Combo_Boxes  " + "proto : "+argument1 + ": Enabled?:"+argument2);

            WebDocument webDocument = "/dom[@domain='192.168.0.1']";

            Ranorex.SelectTag protocolTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//select[#'Protocol']");
            // Report.Info(protocolTag.GetInnerHtml().ToString());
            foreach (Ranorex.OptionTag optTag in protocolTag.Find(".//option"))
            {           //TO SELECT THE PROTOCOL
                //Console.WriteLine(optTag.InnerText);
                Report.Info(optTag.InnerText);
                if (optTag.InnerText == argument1)
                {
                    Report.Info("argument1 matching:: " + argument1);
                    // OptionTag option = "//rxpath/to/option";
                    //option.Selected = true;
                    optTag.Selected = true;
                    break;
                }
            }

            // argument2 - Enabled or Disabled
            Report.Info("RuleStatus : " + argument2);
            //Ranorex.SelectTag enableTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//select[#'Enabled']");
            Ranorex.SelectTag enableTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'tr_Enabled']/select[@id='Enabled']");
            //Report.Info(enableTag.GetInnerHtml().ToString());
            foreach (Ranorex.OptionTag optTag in enableTag.Find(".//option"))
            {                           //TO enable/disable  PORT TRIGGER RULE
                //Console.WriteLine(optTag.InnerText);
                Report.Info(optTag.InnerText);
                if (optTag.InnerText == argument2)
                {
                    //Report.Info("argument2 matching:: "+argument2 );
                    optTag.Selected = true;
                    break;
                }
            }
        }
        public void update_the_values_for_add_forward_rule(string argument1, string argument2)
        {
            //argument1 - Protocol
            //argument2 - Enable?
            //update the protocol and EnableDisable fields

            //Report.Info("inside pdate_the_values_for_add_forward_rule--- argument1 :" + argument1 + " argument2 : " + argument2);
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";

            // Report.Info("Protocol : "+argument1);
            Ranorex.SelectTag protocolTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//select[#'Protocol']");
            //Report.Info(protocolTag.GetInnerHtml().ToString());
            foreach (Ranorex.OptionTag optTag in protocolTag.Find(".//option"))
            {           //TO SELECT THE PROTOCOL
                //Console.WriteLine(optTag.InnerText);
                //Report.Info(optTag.InnerText);
                if (optTag.InnerText == argument1)
                {
                    //Report.Info("argument1 matching:: "+argument1 );
                    // OptionTag option = "//rxpath/to/option";
                    //option.Selected = true;
                    optTag.Selected = true;
                    break;
                }
            }                   //end of for-loop for Protocol

            // Report.Info("enable/disable Status : "+argument2);
            //Ranorex.SelectTag enableTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//select[#'Enabled']");
            Ranorex.SelectTag enableTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'tr_Enabled']/select[@id='Enabled']");
            //Report.Info(enableTag.GetInnerHtml().ToString());
            foreach (Ranorex.OptionTag optTag in enableTag.Find(".//option"))
            {                   //TO enable/disable  PORT TRIGGER RULE
                //Console.WriteLine(optTag.InnerText);
                //Report.Info(optTag.InnerText);
                if (optTag.InnerText == argument2)
                {
                    //Report.Info("argument2 matching:: "+argument2 );
                    optTag.Selected = true;
                    break;
                }
            }                   //end of for-loop for  enable /disable
        }
        public void Choose_Manual_Channel_2GHz(string argument1)
        {
            Report.Info("Channel Number(2GHz) : " + argument1);
            int channelNumber = Int32.Parse(argument1.Trim());

            if (channelNumber < 52)
            {
                Delay.Seconds(5);
                WebDocument webDocument = "/dom[@domain='192.168.0.1']";
                //Ranorex.SelectTag protocolTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//select[#'IPv4ProtocolGrp']");
                //Ranorex.SelectTag protocolTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//select[#'WirelessMode50']");
                //Ranorex.SelectTag protocolTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//select[#'WirelessMode24']");
                //Ranorex.SelectTag protocolTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//select[#'Channel50']");
                Ranorex.SelectTag protocolTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//select[#'Channel24']");
                //dom[@domain='192.168.0.1']//select[#'WiFi24ChannelBW']
                //dom[@domain='192.168.0.1']//select[#'WiFi50ChannelBW']
                foreach (Ranorex.OptionTag optTag in protocolTag.Find(".//option"))
                {
                    Report.Info(optTag.InnerText);
                    string tempChannel = " Channel " + argument1.Trim();
                    Report.Info("tempChannel : " + tempChannel);
//					if(optTag.InnerText.Trim() == argument1.Trim()){
                    if (optTag.InnerText.Trim() == tempChannel.Trim())
                    {
                        Report.Info("2GHz Matching-True");
                        optTag.Selected = true;
                        break;
                    }
                }
                //captute screen shot
                //TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'ipv4FilterTable']");
                TableTag table_2GHz = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'WirelessFrequency24GHz']/table");
                Report.Screenshot("Wireless_2.4GHz", table_2GHz.Element, false);
            }
            else
            {
                Report.Info("DFS channel value is >= 52");
                //call another module deal with this
            }
        }
Exemple #12
0
        public void Choose_Channel_Width_2GHz(string argument1)
        {
            Delay.Seconds(5);
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";

            Report.Info("Protocol(argument1) : " + argument1);
            //Ranorex.SelectTag protocolTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//select[#'Channel24']");
            Ranorex.SelectTag protocolTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//select[#'WiFi24ChannelBW']");
            foreach (Ranorex.OptionTag optTag in protocolTag.Find(".//option"))
            {
                Report.Info(optTag.InnerText);
                if (optTag.InnerText.Trim() == argument1.Trim())
                {
                    Report.Info("2_4GHz Matching-True");
                    optTag.Selected = true;
                    break;
                }
            }
            TableTag table_2GHz = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'WirelessFrequency24GHz']/table");

            Report.Screenshot("Wireless_2.4GHz", table_2GHz.Element, false);
        }
        public void Populate_Port_Triggering_Combo_Boxes(string argument1, string argument2)
        {
            // argument1 - protocol
            // argument2 - Enabled or Disabled
            //Report.Info("Protocol :"+argument1);
            //Report.Info(" Inside Populate_Port_Triggering_Combo_Boxes  " + "proto : "+argument1 + ": Enabled?:"+argument2);

            //	/dom[@domain='192.168.0.1']//div[#'fmSel-Protocol']//cite[@innertext='UDP']

            WebDocument webDocument = "/dom[@domain='192.168.0.1']";

            //DivTag myDiv = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'fmSel-Protocol']");
            //DivTag myDiv = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'tr_Protocol']");

            // var divTagMydiv = repo.WebDocument.YourElement;
            // String pureInnerText;
            // pureInnerText= Regex.Replace(divTagMydiv.GetInnerHtml(), "<.*?>", string.Empty);
            //pureInnerText = myDiv.GetInnerHtml();
            //pureInnerText= Regex.Replace(myDiv.GetInnerHtml(), "<.*?>", string.Empty);
            //Report.Info("PureInnerText: "+pureInnerText);

            // Ranorex.SelectTag selectTag = Host.Local.FindSingle("/dom[@page='test.html']/body/select");
            Ranorex.SelectTag selectTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//select[#'Protocol']");
            foreach (Ranorex.OptionTag optTag in selectTag.Find(".//option"))
            {
                //Console.WriteLine(optTag.InnerText);
                Report.Info(optTag.InnerText);
                if (optTag.InnerText == argument1)
                {
                    Report.Info("argument matching:: " + argument1);
                    // OptionTag option = "//rxpath/to/option";
                    //option.Selected = true;
                    optTag.Selected = true;
                }
            }

            if (argument1 == "UDP")
            {
                //Report.Info("UDP.....Protocol :"+argument1);
                TestSuite.Current.GetTestCase("Choose_Port_Trigger_Protocol_UDP").Checked       = false;  //true - to enable the test cases
                TestSuite.Current.GetTestCase("Choose_Port_Trigger_Protocol_TCP").Checked       = false;
                TestSuite.Current.GetTestCase("Choose_Port_Trigger_Protocol_UDPandTCP").Checked = false;
            }
            if (argument1 == "TCP")
            {
                //Report.Info("TCP....Protocol :"+argument1);
                TestSuite.Current.GetTestCase("Choose_Port_Trigger_Protocol_TCP").Checked       = false;
                TestSuite.Current.GetTestCase("Choose_Port_Trigger_Protocol_UDP").Checked       = false;
                TestSuite.Current.GetTestCase("Choose_Port_Trigger_Protocol_UDPandTCP").Checked = false;
            }
            else if (argument1 == "UDP and TCP")
            {
                //Report.Info("UDP and TCP ....Protocol :"+argument1);
                TestSuite.Current.GetTestCase("Choose_Port_Trigger_Protocol_UDPandTCP").Checked = false;
                TestSuite.Current.GetTestCase("Choose_Port_Trigger_Protocol_UDP").Checked       = false;
                TestSuite.Current.GetTestCase("Choose_Port_Trigger_Protocol_TCP").Checked       = false;
            }

            //Report.Info("RuleStatus : "+argument2);

            // Ranorex.SelectTag selectTag1 = webDocument.FindSingle("/dom[@domain='192.168.0.1']//select[#'Enabled']");
            Ranorex.SelectTag enableTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'tr_Enabled']/select[@id='Enabled']");
            foreach (Ranorex.OptionTag optTag in enableTag.Find(".//option"))
            {
                //Console.WriteLine(optTag.InnerText);
                Report.Info(optTag.InnerText);
                if (optTag.InnerText == argument2)
                {
                    Report.Info("argument matching:: " + argument2);
                    optTag.Selected = true;
                }
            }

            if (argument2 == "On")
            {
                //Report.Info("On RuleStatus : "+argument2);
                TestSuite.Current.GetTestCase("Choose_Port_Trigger_Enabled").Checked  = false;       // true - to enable the test cases
                TestSuite.Current.GetTestCase("Choose_Port_Trigger_Disabled").Checked = false;
            }
            else if (argument2 == "Off")
            {
                //Report.Info("Off RuleStatus : "+argument2);
                TestSuite.Current.GetTestCase("Choose_Port_Trigger_Disabled").Checked = false;
                TestSuite.Current.GetTestCase("Choose_Port_Trigger_Enabled").Checked  = false;
            }
        }
        public void Choose_Manual_Channel_5GHz(string argument1)
        {
            Report.Info("Channel Number(5GHz) : " + argument1);
            //          int channelNumber = Int32.Parse(argument1);
            int channelNumber = Int32.Parse(argument1.Trim());

            /*	//initialize Channel_5GHz
             * WebDocument webDocument1 = "/dom[@domain='192.168.0.1']";
             * Ranorex.SelectTag protocolTag1 = webDocument1.FindSingle("/dom[@domain='192.168.0.1']//select[#'Channel50']");
             * int i=1;
             * foreach(Ranorex.OptionTag optTag in protocolTag1.Find(".//option"))
             * {
             *      Report.Info(optTag.InnerText);
             *      if(i==1){
             *              optTag.Selected = true;
             *              break;
             *      }
             * }
             */
            if (channelNumber < 52)
            {
                Report.Info("DFS channel value is < 52");
                Delay.Seconds(5);
                WebDocument webDocument = "/dom[@domain='192.168.0.1']";
//				Report.Info("Protocol(argument1) : "+argument1);
                //Ranorex.SelectTag protocolTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//select[#'IPv4ProtocolGrp']");
                Ranorex.SelectTag protocolTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//select[#'Channel50']");
                //Ranorex.SelectTag protocolTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//select[#'WirelessMode50']");
                foreach (Ranorex.OptionTag optTag in protocolTag.Find(".//option"))
                {
                    Report.Info(optTag.InnerText);
                    string tempChannel = " Channel " + argument1.Trim();
                    Report.Info("tempChannel : " + tempChannel);
//					if(optTag.InnerText.Trim() == argument1.Trim()){
                    if (optTag.InnerText.Trim() == tempChannel.Trim())
                    {
                        Report.Info("5GHz Matching-True");
                        optTag.Selected = true;
                        optTag.Click();
                        break;
                    }
                }
                TableTag table_2GHz = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'WirelessFrequency50GHz']/table");
                Report.Screenshot("Wireless_5GHz", table_2GHz.Element, false);
            }
            else
            {
                Report.Info("DFS channel value is >= 52");
                //call another module deal with this
                Delay.Seconds(5);
                WebDocument       webDocument = "/dom[@domain='192.168.0.1']";
                Ranorex.SelectTag protocolTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//select[#'Channel50']");
                foreach (Ranorex.OptionTag optTag in protocolTag.Find(".//option"))
                {
                    Report.Info(optTag.InnerText);
                    string tempChannel = " Channel " + argument1.Trim();
                    Report.Info("tempChannel : " + tempChannel);
                    if (optTag.InnerText.Trim() == tempChannel.Trim())
                    {
                        Report.Info("5GHz Matching-True");
                        optTag.Selected = true;
                        break;
                    }
                }
                Ack_DFS_Channel_Selection.Start();
                TableTag table_2GHz = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'WirelessFrequency50GHz']/table");
                Report.Screenshot("Wireless_5GHz", table_2GHz.Element, false);
            }
            Report.Screenshot();
        }
Exemple #15
0
        public void Validate_SecurityMode(string argument1)
        {
            //validate and find the selected item name
            // Report.Log(ReportLevel.Info, "Validation", "Validating AttributeEqual (Text='yourtext') on item 'WebDocument19216801.FmSelSecurityModeGrp.SomeSpanTag4'.", repo.WebDocument19216801.FmSelSecurityModeGrp.SomeSpanTag4Info);
            // Validate.Attribute(repo.WebDocument19216801.FmSelSecurityModeGrp.SomeSpanTag4Info, "Text", "yourtext");

            /*
             * bool boolVal = Validate.IsTrue(repo.WebDocument19216801.FmSelSecurityModeGrp.SomeSpanTag4Info, "Text","Disable");
             *  if(boolVal == true){
             *  //string rstStr = "The Password : "******" : is : " + repo.WebDocument19216801.PasstextWifi.InnerText ;
             *            Report.Log(ReportLevel.Info, "Validation","Disable");
             * }else{
             *       // string rstStr = "The Password : "******" : is : " + repo.WebDocument19216801.PasstextWifi.InnerText ;
             *            Report.Log(ReportLevel.Info, "Validation","other than Disable");
             * }
             */

            //  Report.Log(ReportLevel.Info,repo.WebDocument19216801.FmSelSecurityModeGrp);

            Report.Info(" Inside Validate_SecurityMode  " + "argument1 : " + argument1);
            if (argument1 == "")
            {
                argument1 = "WPA-PSK/WPA2-PSK";
                Report.Info(" argument1 is blank so assigned the security mode - WPA-PSK/WPA2-PSK");
            }
            Delay.Seconds(60);
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";

            webDocument.WaitForDocumentLoaded();
            // Ranorex.SelectTag securityTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//select[#'Protocol']");
            // Ranorex.SelectTag enableTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'tr_Enabled']/select[@id='Enabled']");

//	         Ranorex.SelectTag securityTag = webDocument.FindSingle("dom[@domain='192.168.0.1']//select[#'SecurityModeGrp']");
            Ranorex.SelectTag securityTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'tr_SecurityModeGrp']/select[#'SecurityModeGrp']");


            Report.Info(securityTag.GetInnerHtml().ToString());

            foreach (Ranorex.OptionTag optTag in securityTag.Find(".//option"))
            {                   //TO SELECT THE SecurityMode
                //Console.WriteLine(optTag.InnerText);
                Report.Info(optTag.InnerText);
                //get the currently selected item name and check if it is Disable

                /*
                 * Report.Info(optTag.Element.GetAttributeValueText("selected"));
                 * if(optTag.Element.GetAttributeValueText("selected").Equals("Disable")){
                 *      Report.Info("security mode cannot be Disable ");
                 * }
                 */
                if (optTag.Element.GetAttributeValueText("selected").Equals("Disable"))
                {
                    // security mode cannot be Disable, so need to change the mode
                    OptionTag optionTag = argument1;
                    optionTag.Selected = true;
                }
                else if (optTag.InnerText == argument1)
                {
                    Report.Info("argument2 matching:: " + argument1);
                    // OptionTag option = "//rxpath/to/option";
                    //option.Selected = true;
                    optTag.Selected = true;
                    Report.Success("Security Mode changed successfully !");
                    //Delay.Seconds(1);
                    //Report.Screenshot("Security Mode",securityTag.Element,false);	//FmSelSecurityModeGrp
                    //Report.Screenshot("Security Mode",repo.WebDocument19216801.SecurityMode.Element,true);
                    Delay.Seconds(1);
                    Report.Screenshot();
                    break;
                }
            }                   // end of for-loop
            Report.Screenshot();
        }
Exemple #16
0
        public void Choose_IPv6_Port_Filter_Protocol_SourceIP_DestIPCategory(string argument1, string argument2, string argument3)
        {
            //select combo box values for protocol, sourceIP, Dest IP
            //argument1 - protocol,
            //argument2 - SourceIP group category
            //argument3 - DestinationIP group category

//          Report.Info("------------Inside Update_Combo_Boxes_For_IPv6Filtering_Rule------------- ");
            Report.Info("------------ Inside Choose_IPv6_Port_Filter_Protocol_SourceIP_DestIPCategory  ------------ ");
            Report.Info("Protocol(argument1) : " + argument1);
//          Report.Info("Source IP Group(argument2) : "+argument2);
//			Report.Info("Destination IP Category(argument3) : "+argument3);

            Delay.Seconds(5);
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";

            //choose protocol
            Ranorex.SelectTag IPv4protocolTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//select[#'IPv6ProtocolGrp']");
            Report.Info(IPv4protocolTag.GetInnerHtml().ToString());
            foreach (Ranorex.OptionTag optTag in IPv4protocolTag.Find(".//option"))
            {                   //TO SELECT THE PROTOCOL
                if (optTag.InnerText == argument1)
                {
                    optTag.Selected = true;
                    //Delay.Seconds(1);
                    break;
                }
            }
            Report.Info("Source IP Group(argument2) : " + argument2);
            //choose source IP group
            Ranorex.SelectTag IPv6SrcIPGrpTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//select[#'IPv6SrcIPGrp']");
            Report.Info(IPv6SrcIPGrpTag.GetInnerHtml().ToString());
            foreach (Ranorex.OptionTag optTag in IPv6SrcIPGrpTag.Find(".//option"))
            {                           //TO enable/disable  PORT TRIGGER RULE
                if (optTag.InnerText == argument2)
                {
                    optTag.Selected = true;
                    //Delay.Seconds(1);
                    //check Source IP Group
                    if ((argument2 == "single") || (argument2 == "Single"))                     // if it is single source Source IP
                    {
                        TestSuite.Current.GetTestCase("Input_Single_SourceIPv6").Checked = true;
                        TestSuite.Current.GetTestCase("Input_Range_SourceIPv6").Checked  = false;
                    }
                    else if ((argument2 == "range") || (argument2 == "Range"))                  //if it is  range source IP
                    {
                        TestSuite.Current.GetTestCase("Input_Range_SourceIPv6").Checked  = true;
                        TestSuite.Current.GetTestCase("Input_Single_SourceIPv6").Checked = false;
                    }
                    break;
                }
            }
            Report.Info("Destination IP Category(argument3) : " + argument3);
            //choose destination Ip group
            Ranorex.SelectTag IPv6DestIPGrpTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//select[#'IPv6DestIPGrp']");
            Report.Info(IPv6DestIPGrpTag.GetInnerHtml().ToString());
            foreach (Ranorex.OptionTag optTag in IPv6DestIPGrpTag.Find(".//option"))
            {                           //TO enable/disable  PORT TRIGGER RULE
                if (optTag.InnerText == argument3)
                {
                    optTag.Selected = true;
                    //Delay.Seconds(1);
                    //check Source IP Group
                    if ((argument3 == "single") || (argument3 == "Single"))                     // if it is single source Source IP
                    {
                        TestSuite.Current.GetTestCase("Input_Single_DestIPv6").Checked = true;
                        TestSuite.Current.GetTestCase("Input_Range_DestIPv6").Checked  = false;
                    }
                    else if ((argument3 == "range") || (argument3 == "Range"))                          //if it is  range source IP
                    {
                        TestSuite.Current.GetTestCase("Input_Range_DestIPv6").Checked  = true;
                        TestSuite.Current.GetTestCase("Input_Single_DestIPv6").Checked = false;
                    }
                    break;
                }
            }
            Report.Screenshot();
        }
        public void Accept_IPv4_Port_Filter_Protocol_SourceIPCat_DestIPCat(string argument1, string argument2, string argument3)
        {
            //select combo box values
            //argument1 - protocol,
            //argument2 - Source IP group category
            //argument3 - Destination IP group category

            //Report.Info("------------Inside Update_Combo_Boxes_For_IPv4Filtering_Rule------------- ");
            Delay.Seconds(5);
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";

            Report.Info("Protocol(argument1) : " + argument1);
            Ranorex.SelectTag protocolTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//select[#'IPv4ProtocolGrp']");
            //Report.Info(protocolTag.GetInnerHtml().ToString());
            foreach (Ranorex.OptionTag optTag in protocolTag.Find(".//option"))
            {                   //TO SELECT THE PROTOCOL
                //Console.WriteLine(optTag.InnerText);
                //Report.Info(optTag.InnerText);
                if (optTag.InnerText == argument1)
                {
                    //Report.Info("argument1 matching:: "+argument1 );
                    // OptionTag option = "//rxpath/to/option";
                    //option.Selected = true;
                    optTag.Selected = true;
                    //Delay.Seconds(1);
                    break;
                }
            }                           //end of for-loop for Protocol

            Report.Info("Source IP Group(argument2) : " + argument2);
            Ranorex.SelectTag IPv4SrcIPGrpTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//select[#'IPv4SrcIPGrp']");
            //Ranorex.SelectTag enableTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'tr_Enabled']/select[@id='Enabled']");
            //Report.Info(IPv4SrcIPGrpTag.GetInnerHtml().ToString());
            foreach (Ranorex.OptionTag optTag in IPv4SrcIPGrpTag.Find(".//option"))
            {                           //TO enable/disable  PORT TRIGGER RULE
                //Console.WriteLine(optTag.InnerText);
                //Report.Info(optTag.InnerText);
                if (optTag.InnerText == argument2)
                {
                    //Report.Info("argument2 matching:: "+argument2 );
                    //Delay.Seconds(1);
                    optTag.Selected = true;
                    //Delay.Seconds(1);
                    //check Source IP Group
                    if (argument2 == "single")                          // if it is single source Source IP
                    {
                        TestSuite.Current.GetTestCase("Input_Single_SourceIP1").Checked = true;
                        TestSuite.Current.GetTestCase("Input_Range_SourceIP1").Checked  = false;
                    }
                    else if (argument2 == "range")                      //if it is  range source IP

                    {
                        TestSuite.Current.GetTestCase("Input_Range_SourceIP1").Checked  = true;
                        TestSuite.Current.GetTestCase("Input_Single_SourceIP1").Checked = false;
                    }
                    break;
                }
            }                           //end of for-loop for  Source IP Group

            Report.Info("Destination IP Category(argument3) : " + argument3);
            Ranorex.SelectTag IPv4DestIPGrpTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//select[#'IPv4DestIPGrp']");
            //Ranorex.SelectTag enableTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'tr_Enabled']/select[@id='Enabled']");
            //Report.Info(IPv4DestIPGrpTag.GetInnerHtml().ToString());
            foreach (Ranorex.OptionTag optTag in IPv4DestIPGrpTag.Find(".//option"))
            {                           //TO enable/disable  PORT TRIGGER RULE
                //Console.WriteLine(optTag.InnerText);
                //Report.Info(optTag.InnerText);
                if (optTag.InnerText == argument3)
                {
                    //Report.Info("argument3 matching:: "+argument3 );
                    //Delay.Seconds(1);
                    optTag.Selected = true;
                    //Delay.Seconds(1);
                    //check Destination IP Category
                    if (argument3 == "single")                          // if it is single destination Source IP
                    {
                        TestSuite.Current.GetTestCase("Input_Single_DestIP1").Checked = true;
                        TestSuite.Current.GetTestCase("Input_Range_DestIP1").Checked  = false;
                    }
                    else if (argument3 == "range")                      //if it range destination IP

                    {
                        TestSuite.Current.GetTestCase("Input_Range_DestIP1").Checked  = true;
                        TestSuite.Current.GetTestCase("Input_Single_DestIP1").Checked = false;
                    }
                    break;
                }
            }                           //end of for-loop for  Destination IP Group
        }