public void Mouse_Click_Button7()
        {
            //repo.WebDocument19216801.Button7.Click("102;30");

            //use path and click

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

            Ranorex.InputTag applyChangesButton = "/dom[@domain='192.168.0.1']//div[#'mainpage']/div/div[3]/?/?/input[@type='button']";
            applyChangesButton.DoubleClick();
            applyChangesButton.PerformClick();
        }
Example #2
0
        public static void enterValue(Ranorex.InputTag element, string strText, string strContrlName)
        {
            try
            {
                element.EnsureVisible();
                element.Focus();
                element.TagValue = strText;
                Delay.Seconds(0.5);
                Report.Info(strText + " is entered in " + strContrlName);
            }

            catch (Exception ex)
            {
                Report.Failure(strText + " is not entered in " + strContrlName + ex.Message);
            }
        }
Example #3
0
 public static void selectRadiobutton(Ranorex.InputTag element, string strValue, string ControlName)
 {
     try
     {
         element.EnsureVisible();
         element.Focus();
         Mouse.MoveTo(element);
         Delay.Seconds(1);
         element.Click();
         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);
     }
 }
Example #4
0
        public void Choose_Devices_AccessMode(string argument1)
        {
            //argument7 - Access Mode

            Delay.Seconds(30);          // to load the pages
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";

            //Report.Info(webDocument.GetHtml());
            Report.Info("argument1", argument1);
            // choose the Access Mode   //BssAccessModeGrp
            //Radio Button Options --> 1-DisableWMACFilter, 2-AllowAllDevices,3-DenyAllDevices
            String AccessModeGrpPath = "";

            if (argument1 == "Disable")
            {
                Report.Info("It is DISABLE");
                AccessModeGrpPath = "/dom[@domain='192.168.0.1']//input[@name='BssAccessModeGrp' and @type='radio' and @value='1']";        // Disable
                Ranorex.InputTag BssAccessModeGrpTag = AccessModeGrpPath;
                Delay.Seconds(1);
                BssAccessModeGrpTag.PerformClick();
                Delay.Seconds(1);
            }
            else if (argument1 == "Allow")
            {
                Report.Info("It is ALLOW");
                AccessModeGrpPath = "/dom[@domain='192.168.0.1']//input[@name='BssAccessModeGrp' and @type='radio' and @value='2']";                // Allow
                Ranorex.InputTag BssAccessModeGrpTag = AccessModeGrpPath;
                Delay.Seconds(1);
                BssAccessModeGrpTag.PerformClick();
                Delay.Seconds(1);
            }
            else if (argument1 == "Deny")
            {
                Report.Info("It is DENY");
                AccessModeGrpPath = "/dom[@domain='192.168.0.1']//input[@name='BssAccessModeGrp' and @type='radio' and @value='3']";                // Deny
                Ranorex.InputTag BssAccessModeGrpTag = AccessModeGrpPath;
                Delay.Seconds(1);
                BssAccessModeGrpTag.PerformClick();
                Delay.Seconds(1);
            }
            Report.Screenshot();
        }
        public void Choose_Attached_DHCP_Device_To_Reserved_List(string argument1, string argument2, string argument3, string argument4, string argument5, string argument6, string argument7)
        {
            ////choose device from the attached list
            ///
            //This method is to select any MAC filter rules to delete
            //argument1 - MAC Address0, argument2- MAC Address1
            //argument3 - MAC Address2, argument4 - MAC Address3
            //argument5 - MAC Address4, argument6 - MAC Address5
            //argument7 - Device Name

            Delay.Seconds(30);          // to load the pages
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";

            webDocument.WaitForDocumentLoaded();
            //Report.Info(webDocument.GetHtml());

            //DHCP lease table

            TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'AttachedDevicesTable']");
            //Count the total no of IPv4 port Filter rules (rows)
            IList <TrTag> totalDHCPClients  = myTable.Find <TrTag>("./tbody//tr");      //Row
            int           rulesCount        = totalDHCPClients.Count;
            string        totalDHCPAttached = "Total Rules : " + rulesCount.ToString();

            Report.Info("Active Attached Devices ", totalDHCPAttached);

            if (rulesCount == 0)
            {
                //Mouse.ScrollWheel(150);
                Report.Failure("DHCP List", "There are no devices to add !!");
                return;
            }
            else
            {
                //if there any rules? then choose appropriate radio button
                Report.Info(" There are " + rulesCount.ToString() + " devices attached to this router  !!! ");
                int rowNum = 1;
                //int addCheck = 1;
                Boolean isMatch = false;
                string  macAddress = "", macAddress1 = "", IPAddress = "", devName = "", Wifi_Freq = "";
                macAddress = argument1 + ":" + argument2 + ":" + argument3 + ":" + argument4 + ":" + argument5 + ":" + argument6;

                foreach (var row in totalDHCPClients)
                {
                    //Report.Info("Row: " + rowNum);
                    //Report.Info(row.GetInnerHtml().ToString());
                    IList <TdTag> cols = row.Find <TdTag>("./td");              //column
                    //Report.Info(" Total Columns in the Row : ",cols.Count.ToString());
                    int    colNum          = 1;
                    String radiobuttonPath = "";
                    foreach (TdTag MacCol in cols)
                    {
                        //1- Radiobutton, 2-Device name,3-MAC address,4-IP Address,5-Lease time,6-Connected to
                        Report.Info("MacCol: " + colNum);
                        Report.Info("MacCol Info: " + MacCol.InnerText);
                        //Report.Info(MacCol.GetInnerHtml().ToString());
                        if (colNum == 1)
                        {
                            //radio button
                            radiobuttonPath = MacCol.GetPath().ToString();
                            //Report.Info(MacCol.GetInnerHtml().ToString());
                            //Report.Info(radiobuttonPath);
                            Report.Info("Radio button Path:", radiobuttonPath);
                        }
                        else if (colNum == 2)
                        {
                            //device name

                            /*
                             * IList<SpanTag> spanVals = MacCol.Find<SpanTag>("./span");
                             * foreach(SpanTag spanVal in spanVals){
                             *      devName = spanVal.InnerText;
                             * }
                             */
                            devName = MacCol.InnerText;
                        }
                        else if (colNum == 3)
                        {
                            //MAC Address
                            //Report.Info(MacCol.InnerText);
                            //Report.Info(MacCol.GetInnerHtml().ToString());
                            //macAddress1 = MacCol.InnerText;
                            IList <SpanTag> spanVals = MacCol.Find <SpanTag>("./span");
                            //Report.Info("span count :  "+spanVals.Count);
                            foreach (SpanTag spanVal in spanVals)
                            {
                                macAddress1 = spanVal.InnerText;

                                //Report.Info("devName : ", devName);
                                //Report.Info("MAC Address to Add : " + macAddress);
                                //Report.Info("MAC Address1 : " + macAddress1);

                                if (macAddress == macAddress1)
                                {
                                    Report.Info("//--------------- MAC address  exist in attached device list------//");
                                    Report.Info("//---------------  Wifi_Freq -----", Wifi_Freq);
                                    macAddress1 = spanVal.InnerText;

                                    Report.Info("Device Name ", devName);
                                    Report.Info("MAC Address to Add ", macAddress);
                                    //Report.Info("MAC Address1 : " + macAddress1);

                                    isMatch = true;
                                    String newPath = "";
                                    Report.Info("radiobuttonPath : ", radiobuttonPath.ToString());

                                    //newPath = radiobuttonPath + "/input[#'attachedDevicesGroup']";

                                    //newPath = "/dom[@domain='192.168.0.1']//tbody[#'AttachedDevicesTable_body']//input[@name='attachedDevicesGroup']";
                                    //newPath = radiobuttonPath + "/input[@name='attachedDevicesGroup' and @type='radio' and @value='2' ]";
                                    int radVal = rowNum - 1;
                                    newPath = radiobuttonPath + "/input[@name='attachedDevicesGroup' and @type='radio' and @value='" + radVal + "']";

                                    // newPath ="/dom[@domain='192.168.0.1']//input[#'ipv4FilterTable-Enabled-"+delCheck+"']";

                                    Ranorex.InputTag MACFilterAttachedDeviceTag = newPath;

                                    Delay.Seconds(1);
                                    //MACFilterAttachedDeviceTag.Checked = "True";
                                    MACFilterAttachedDeviceTag.PerformClick();
                                    //MACFilterAttachedDeviceTag.TagValue ="2";
                                    Delay.Seconds(1);

                                    /*
                                     * if (MACFilterTableDeleteTag.Checked.ToString() == "False"){
                                     *      Delay.Seconds(1);
                                     *      MACFilterTableDeleteTag.PerformClick();
                                     * }else{
                                     *              Report.Info(" MACFilterTableDeleteTag is already Enabled ");
                                     *      }
                                     */
                                    string rst = "The following DHCP Client is added to the reserved list !!!";
                                    Report.Success(rst);
                                    //Report.Screenshot("MACFilter_Filtering",MacCol.Element,true);
                                    Report.Screenshot("DHCP_Reserved_List", row.Element, true);
                                    break;
                                }
                            }                           //end of SpanTag for-loop
                        }
                        else if (colNum == 4)
                        {
                            //Ip Address
                            IPAddress = MacCol.InnerText;
                        }
                        else if (colNum == 6)
                        {
                            // frequency connected to
                            IList <SpanTag> spanVals = MacCol.Find <SpanTag>("./span");
                            foreach (SpanTag spanVal in spanVals)
                            {
                                Wifi_Freq = spanVal.InnerText;
                            }
                        }
                        colNum++;
                    }                   //TdTag for-end loop

                    if (isMatch)
                    {
                        Report.Info("Wifi_Freq", Wifi_Freq);
                        if (Wifi_Freq.Trim() == " WI-FI 2.4G")
                        {
                            Report.Info("This device is connected to  WI-FI 2.4G");
                            //choose the device  and click radio button
                            break;
                        }
                        else
                        {
                            Report.Info("This device is NOT connected to  WI-FI 2.4G");
                            break;
                        }
                        //break;
                    }
                    rowNum++;
                    //addCheck++;	//counter to select add checkbox
                }                 //ROW for-end loop

                //Report.Info("rowNum :: ",rowNum.ToString());
                if (!isMatch)
                {
                    //Report.Info(" Device does not  exist in the attached list ");

                    //Report.Info("devName : ", devName);
                    //Report.Info("MAC Address to Add : " + macAddress);

                    string rst = "The device : " + devName + "(" + macAddress + ")" + " does not  exist in the attached list ";
                    //Report.Failure("DHCP_Reserved_List"," This device does not  exist in the attached list ");

                    Report.Failure("DHCP_Reserved_List", rst);
                    TestSuite.Current.GetTestCase("Add_Device_To_DHCP_Reserved_List").Checked = false;                          //Add_Device_To_DHCP_Reserved_List
                }
                else
                {
                    TestSuite.Current.GetTestCase("Add_Device_To_DHCP_Reserved_List").Checked = true; //Add_Device_To_DHCP_Reserved_List
                }
            }                                                                                         //end of if-else
        }
Example #6
0
        void disable_all_trigger_rules()
        {
            //implemented based on R2.4.2(9.1.88S)
            //identify the rules to disable
            //Report.Info( "--------Inside Disable_All_Port_Trigger_Rule -------");
            //string triggerRangeStartPort="",triggerRangeEndPort="",targetRangeStartPort="",targetRangeEndPort="";
            Delay.Seconds(40);
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";

            webDocument.WaitForDocumentLoaded();
            TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'portTriggeringTable']");

            //count the rows
            IList <TrTag> rows    = myTable.Find <TrTag>("./tbody//tr");
            int           rowsCnt = rows.Count;
            //Report.Info("Total rowsCnt",rowsCnt.ToString());
            // Report.Info("Total Rules",rowsCnt.ToString());
            bool isRules = false;

            if (rowsCnt > 0)
            {
                int rowNum = 1;
                //int c=0;
                foreach (var row in rows)
                {
                    var cells  = row.FindDescendants <TdTag>();
                    int colNum = 1;
                    //int enableCheck = 0;
                    string triggerStart = "", triggerEnd = "", targetStart = "", targetEnd = "";
                    //Report.Info("Cell[0]: " + cells[0].InnerText);//No Trigger rules
                    //Report.Info(""+cells.Count.ToString());
                    foreach (var cell in cells)
                    {
                        //Report.Info("Cell: " + cell.InnerText);  //No triggering rule!
                        if (cells.Count == 1 && cell.InnerText.StartsWith("No triggering rule"))
                        {
                            Report.Failure("There are no active PortTriggerRule to disable !!!");
                            Report.Screenshot("PortTriggerRule", myTable.Element, true);
                            isRules = true;
                            TestSuite.Current.GetTestCase("Apply_Port_Triggering_Changes").Checked = false;
                            break;
                            //return;
                        }
                        else
                        {
                            if (colNum == 1)
                            {
                                //triggerRangeStartPort
                                triggerStart = cell.InnerText;
                            }
                            else if (colNum == 2)
                            {
                                //triggerRangeEndPort
                                triggerEnd = cell.InnerText;
                            }
                            else if (colNum == 3)
                            {
                                //targetRangeStartPort
                                targetStart = cell.InnerText;
                            }
                            else if (colNum == 4)
                            {
                                //targetRangeEndPort
                                targetEnd = cell.InnerText;
                            }
                            else if (colNum == 5)
                            {
                                //	enabled of disabled?	//
                                //Report.Info(cell.GetInnerHtml().ToString());
                                //Report.Info("colNum",colNum.ToString());
                                //Report.Info(cells[5].GetInnerHtml().ToString());

                                //WebElement webElement = cells[5].Element;
                                //webElement.Click();
                                //cells[5].Click();
                                //Report.Info("Width:  " + cells[5]);
                                //Delay.Seconds(2);

                                IList <InputTag> inputVals = cells[5].Find <InputTag>("./input");
                                //Report.Info("input count :  "+inputVals.Count);
                                foreach (InputTag inputVal in inputVals)
                                {
                                    Ranorex.InputTag testTag = inputVal;
                                    //Report.Info(inputVal.GetPath().ToString());
                                    if (testTag.Checked.ToString() == "True")
                                    {
                                        //Report.Info(" portTriggeringTableEnabledTag is currently enabled ");
                                        inputVal.Checked = "False";
                                        Delay.Seconds(5);
                                        Report.Log(ReportLevel.Success, "The following port triggering rule is disabled now...");
                                        Report.Screenshot("PortTriggerRule", row.Element, true);
                                    }
                                    else
                                    {
                                        //Report.Info(" portTriggeringTableEnabledTag is currently disabled ");

                                        /*
                                         * inputVal.PerformClick();
                                         * Delay.Seconds(5);
                                         */
                                        Report.Log(ReportLevel.Success, "The following port triggering rule is already disabled !!!");
                                        Report.Screenshot("PortTriggerRule", row.Element, true);
                                    }
                                }                                                        //end of for-loop

                                /*
                                 * String newPath = "";
                                 * newPath ="/dom[@domain='192.168.0.1']//input[#'portTriggeringTable-Enabled-"+enableCheck+"']";
                                 * Ranorex.InputTag portTriggringTableEnabledTag = newPath;
                                 *      if(portTriggringTableEnabledTag.Checked.ToString() == "True"){
                                 *              // portTriggeringTableEnabledTag is already Enabled
                                 *              Report.Info("-----------------portTriggeringTableEnabledTag  is checked---");
                                 *              Delay.Seconds(1);
                                 *              portTriggringTableEnabledTag.Checked="";	//uncheck the checkbox to disable
                                 *              portTriggringTableEnabledTag.Checked="False";
                                 *              portTriggringTableEnabledTag.PerformClick();
                                 *      }else{
                                 *      Report.Info("-----------------portTriggeringTableEnabledTag  is unchecked---");
                                 *              //portTriggeringTableEnabledTag is already disabled
                                 *              Report.Info(" portTriggeringTableEnabledTag is already disabled ");
                                 *              Delay.Seconds(1);
                                 *              portTriggringTableEnabledTag.Checked="checked";
                                 *              portTriggringTableEnabledTag.Checked="True";
                                 *              portTriggringTableEnabledTag.PerformClick();
                                 *      }
                                 */
                                //Report.Info("<---This port triggering rule is disabled --->");
                            }
                            else if (colNum == 6)
                            {
                                //delete button
                                //Report.Info("colNum",colNum.ToString());
                                //Report.Info(cells[6].GetInnerHtml().ToString());
                            }
                            colNum++;

                            //cell.click();
                        }                                        //end of if-else "No triggering rule"
                        cell.MoveTo();
                    }                                            //end of for-loop : cell
                    //enableCheck++;
                    rowNum++;
                    //Report.Info("rowNum:"+rowNum);
                    if (isRules)
                    {
                        break;
                        //return;
                    }
                }         //end of for-loop : row
                if (!isRules)
                {
                    Report.Log(ReportLevel.Success, "The following port triggering rule(s) are disabled/enabled");
                    Delay.Seconds(1);
                    Report.Screenshot("PortTriggerRule", myTable.Element, false);
                    //Report.Screenshot();
                }
            }
            else
            {
                Report.Failure("There are no active PortTriggerRule to disable !!!");
                Delay.Seconds(1);
                Report.Screenshot("PortTriggerRule", myTable.Element, false);
            }
        }
Example #7
0
        public void Choose_Attached_Devices_To_Deny_Add_5GHz_Primary(string argument1, string argument2, string argument3, string argument4, string argument5, string argument6, string argument7)
        {
            ////choose device from the attached list
            //This method is to select any MAC filter rules to delete
            //argument1 - MAC Address0, argument2- MAC Address1
            //argument3 - MAC Address2, argument4 - MAC Address3
            //argument5 - MAC Address4, argument6 - MAC Address5
            //argument7 - Access Mode

            Delay.Seconds(30);          // to load the pages
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";
            //Report.Info(webDocument.GetHtml());

            // choose the Access Mode   //BssAccessModeGrp
            //Radio Button Options --> 1-DisableWMACFilter, 2-AllowAllDevices,3-DenyAllDevices
            String AccessModeGrpPath = "";

            if (argument7 == "Disable")
            {
                Report.Info("It is DISABLE");
                AccessModeGrpPath = "/dom[@domain='192.168.0.1']//input[@name='BssAccessModeGrp' and @type='radio' and @value='1']";        // Disable
                Ranorex.InputTag BssAccessModeGrpTag = AccessModeGrpPath;
                Delay.Seconds(1);
                BssAccessModeGrpTag.PerformClick();
                Delay.Seconds(1);
            }
            else if (argument7 == "Allow")
            {
                Report.Info("It is ALLOW");
                AccessModeGrpPath = "/dom[@domain='192.168.0.1']//input[@name='BssAccessModeGrp' and @type='radio' and @value='2']";                // Allow
                Ranorex.InputTag BssAccessModeGrpTag = AccessModeGrpPath;
                Delay.Seconds(1);
                BssAccessModeGrpTag.PerformClick();
                Delay.Seconds(1);
            }
            else if (argument7 == "Deny")
            {
                Report.Info("It is DENY");
                AccessModeGrpPath = "/dom[@domain='192.168.0.1']//input[@name='BssAccessModeGrp' and @type='radio' and @value='3']";                // Deny
                Ranorex.InputTag BssAccessModeGrpTag = AccessModeGrpPath;
                Delay.Seconds(1);
                BssAccessModeGrpTag.PerformClick();
                Delay.Seconds(1);
            }

            //

            TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'AttachedDevicesTable']");
            //Count the total no of IPv4 port Filter rules (rows)
            IList <TrTag> totalMACRules       = myTable.Find <TrTag>("./tbody//tr");
            int           rulesCount          = totalMACRules.Count;
            string        totalMACFilterRules = "Total Rules : " + rulesCount.ToString();

            Report.Info("Active Attached Devices ", totalMACFilterRules);

            if (rulesCount == 0)
            {
                //Mouse.ScrollWheel(150);
                Report.Failure("MAC Filter ", "There are no devices to add !!");
                //TestSuite.Current.GetTestCase("Delete_Any_MAC_Filtering_Rules").Checked = false;
                return;
            }
            else
            {
                //if there any rules? then choose appropriate radio button
                Report.Info(" There are " + rulesCount.ToString() + " devices attached to this router  !!! ");
                int rowNum = 1;
                //int addCheck = 1;
                Boolean isMatch = false;
                string  macAddress = "", macAddress1 = "", devName = "", Wifi_Freq = "";
                macAddress = argument1 + ":" + argument2 + ":" + argument3 + ":" + argument4 + ":" + argument5 + ":" + argument6;
                Report.Info("Inpute MAC ADDRESS : ", macAddress);
                foreach (var row in totalMACRules)
                {
                    //Report.Info("Row: " + rowNum);
                    //Report.Info(row.GetInnerHtml().ToString());
                    IList <TdTag> cols = row.Find <TdTag>("./td");
                    //Report.Info(" Total Columns in the Row : ",cols.Count.ToString());
                    int    colNum          = 1;
                    String radiobuttonPath = "";
                    foreach (TdTag MacCol in cols)
                    {
                        Report.Info("MacCol: " + colNum);
                        //Report.Info("MacCol Info: "+MacCol.InnerText);
                        //Report.Info(MacCol.GetInnerHtml().ToString());
                        if (colNum == 1)
                        {
                            //radio button
                            radiobuttonPath = MacCol.GetPath().ToString();
                            //Report.Info(MacCol.GetInnerHtml().ToString());
                            //Report.Info(radiobuttonPath);
                            //Report.Info("Radio button Path:",radiobuttonPath);
                        }
                        else if (colNum == 2)
                        {
                            IList <SpanTag> spanVals = MacCol.Find <SpanTag>("./span");
                            foreach (SpanTag spanVal in spanVals)
                            {
                                devName = spanVal.InnerText;
                            }
                            Report.Info("devName", devName);
                        }
                        else if (colNum == 3)
                        {
                            //Report.Info(MacCol.InnerText);
                            //Report.Info(MacCol.GetInnerHtml().ToString());
                            //macAddress1 = MacCol.InnerText;
                            IList <SpanTag> spanVals = MacCol.Find <SpanTag>("./span");
                            //Report.Info("span count :  "+spanVals.Count);
                            foreach (SpanTag spanVal in spanVals)
                            {
                                macAddress1 = spanVal.InnerText;

                                //Report.Info("devName : ", devName);
                                //Report.Info("MAC Address to Add : " + macAddress);
                                //Report.Info("MAC Address1 : " + macAddress1);

                                if (macAddress == macAddress1)
                                {
                                    Report.Info("//--------------- MAC address  exist in attached device list------//");
                                    Report.Info("//--------------- Wifi_Freq---------------", Wifi_Freq);
                                    macAddress1 = spanVal.InnerText;

                                    Report.Info("Device Name ", devName);
                                    Report.Info("MAC Address to Add ", macAddress);
                                    Report.Info("Wifi_Freq " + Wifi_Freq);

                                    isMatch = true;
                                    String newPath = "";
                                    //Report.Info("radiobuttonPath : ",radiobuttonPath.ToString());

                                    //newPath = radiobuttonPath + "/input[#'attachedDevicesGroup']";

                                    //newPath = "/dom[@domain='192.168.0.1']//tbody[#'AttachedDevicesTable_body']//input[@name='attachedDevicesGroup']";
                                    //newPath = radiobuttonPath + "/input[@name='attachedDevicesGroup' and @type='radio' and @value='2' ]";
                                    int radVal = rowNum - 1;
                                    newPath = radiobuttonPath + "/input[@name='attachedDevicesGroup' and @type='radio' and @value='" + radVal + "']";

                                    // newPath ="/dom[@domain='192.168.0.1']//input[#'ipv4FilterTable-Enabled-"+delCheck+"']";

                                    Ranorex.InputTag MACFilterAttachedDeviceTag = newPath;

                                    Delay.Seconds(1);
                                    //MACFilterAttachedDeviceTag.Checked = "True";
                                    MACFilterAttachedDeviceTag.PerformClick();
                                    //MACFilterAttachedDeviceTag.TagValue ="2";
                                    Delay.Seconds(1);

                                    /*
                                     * if (MACFilterTableDeleteTag.Checked.ToString() == "False"){
                                     *      Delay.Seconds(1);
                                     *      MACFilterTableDeleteTag.PerformClick();
                                     * }else{
                                     *              Report.Info(" MACFilterTableDeleteTag is already Enabled ");
                                     *      }
                                     */
                                    string rst = "The following device is currently attached to this router !!!";
                                    Report.Success(rst);
                                    //Report.Screenshot("MACFilter_Filtering",MacCol.Element,true);
                                    Report.Screenshot("MAC Filter_List", row.Element, true);
                                    break;
                                }
                            }                           //end of SpanTag for-loop
                        }
                        else if (colNum == 4)
                        {
                            IList <SpanTag> spanVals = MacCol.Find <SpanTag>("./span");
                            foreach (SpanTag spanVal in spanVals)
                            {
                                Wifi_Freq = spanVal.InnerText;
                            }
                            Report.Info("Wifi_Freq", Wifi_Freq);
                        }
                        colNum++;
                    }                   //TdTag for-end loop

                    if (isMatch)
                    {
                        break;
                    }
                    rowNum++;
                    //addCheck++;	//counter to select add checkbox
                }                 //ROW for-end loop

                //Report.Info("rowNum :: ",rowNum.ToString());
                if (!isMatch)
                {
                    //Report.Info(" Device does not  exist in the attached list ");

                    //Report.Info("devName : ", devName);
                    //Report.Info("MAC Address to Add : " + macAddress);

                    string rst = "The device : " + devName + "(" + macAddress + ")" + " does not  exist in the attached list ";
                    //Report.Failure("MAC Filter List"," This device does not  exist in the attached list ");

                    Report.Failure("MAC Filter List", rst);
                    TestSuite.Current.GetTestCase("Add_Deny_Device_To_MAC_Address_List1").Checked = false;                      //Add_Deny_Device_To_MAC_Address_List1
                }
                else
                {
                    TestSuite.Current.GetTestCase("Add_Deny_Device_To_MAC_Address_List1").Checked = true; //Add_Deny_Device_To_MAC_Address_List1
                }
            }                                                                                             //end of if-else
        }
        public void Choose_Any_PortTriggering_Rule_To_Enable(string argument1, string argument2, string argument3, string argument4, string argument5, string argument6)
        {
            //Implemented based on R2.4.2 (9.1.88S)
            //argument1-Trigger range start port, argument2-Trigger range end port,argument3-Target range start port,argument4-,argument5-Target range end port,argument6-Protocol


            //choose rules to enable //
            Delay.Seconds(20);
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";

            webDocument.WaitForDocumentLoaded();
            TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'portTriggeringTable']");

            //count the rows
            IList <TrTag> rows        = myTable.Find <TrTag>("./tbody//tr");
            int           rowsCnt     = rows.Count;
            bool          isRuleExist = false;

            //Report.Info("Total rowsCnt",rowsCnt.ToString());
            Report.Info("Total Rules", rowsCnt.ToString());
            Report.Info("Trigger range start port : ", argument1);
            Report.Info("Trigger range end port : ", argument2);
            Report.Info("Target range start port : ", argument3);
            Report.Info("Target range end port : ", argument4);
            Report.Info("TProtocol : ", argument5);
            Report.Info("Enable/Disable : ", argument6);

            if (rowsCnt > 0)     //if there are any rules exist ?
            {
                int rowNum = 1;
                //int c=0;
                //int enableCheck = 0;
                foreach (var row in rows)
                {
                    var    cells = row.FindDescendants <TdTag>();
                    int    colNum = 1;
                    string triggerStart = "", triggerEnd = "", targetStart = "", targetEnd = "";
                    //Report.Info("cells count",cells.Count.ToString());//count columns in a row
                    //Report.Info("Cell[0]: " + cells[c].InnerText);
                    foreach (var cell in cells)
                    {
                        //Report.Info("Cell: " + cell.InnerText);
                        if (cells.Count == 1 && cell.InnerText.StartsWith("No triggering rule"))
                        {
                            Report.Failure("There are no active PortTriggerRule to enable !!!");
                            Report.Screenshot("PortTriggerRule", myTable.Element, true);
                            TestSuite.Current.GetTestCase("Apply_Any_Enable_PortTrigger_Changes").Checked = false;
                            break;
                        }
                        else
                        {
                            if (colNum == 1)
                            {
                                //triggerRangeStartPort
                                triggerStart = cell.InnerText;
                            }
                            else if (colNum == 2)
                            {
                                //triggerRangeEndPort
                                triggerEnd = cell.InnerText;
                            }
                            else if (colNum == 3)
                            {
                                //targetRangeStartPort
                                targetStart = cell.InnerText;
                            }
                            else if (colNum == 4)
                            {
                                //targetRangeEndPort
                                targetEnd = cell.InnerText;
                            }
                            else if (colNum == 5)
                            {
                                //enabled of disabled?
                            }
                            colNum++;
                            //cell.click();
                        }
                        //cell.MoveTo();
                    }                                    //end of for-loop column
                    if (triggerStart == argument1 && triggerEnd == argument2 && targetStart == argument3 && targetEnd == argument4)
                    {
                        //Report.Info(cells[5].GetInnerHtml().ToString());
                        IList <InputTag> inputVals = cells[5].Find <InputTag>("./input");
                        //Report.Info("input count :  "+inputVals.Count);
                        foreach (InputTag inputVal in inputVals)
                        {
                            Ranorex.InputTag testTag = inputVal;
                            //Report.Info(inputVal.GetPath().ToString());
                            if (testTag.Checked.ToString() == "False")
                            {
                                //False - Currently DISABLED
                                Report.Info(" portTriggeringTableEnabledTag is currently disabled and it will be enabled soon..! ");
                                inputVal.PerformClick();
                                //inputVal.Checked="True";
                                Delay.Seconds(5);
                                Report.Log(ReportLevel.Success, "This port triggering rule is enabled !!!");
                                Report.Screenshot("PortTriggerRule", row.Element, true);
                            }
                            else
                            {
                                //True - Currently ENABLED
                                Report.Info(" portTriggeringTableEnabledTag is already enabled !!! ");

                                /*
                                 * //inputVal.DoubleClick();
                                 * inputVal.Checked="False";
                                 * Delay.Seconds(5);
                                 * Report.Log(ReportLevel.Success,"This port triggering rule is disabled");
                                 */
                                Report.Screenshot("PortTriggerRule", row.Element, true);
                            }
                        }                                        //end of  InputTag : for-loop

                        //Report.Info(cells[5].GetInnerHtml().ToString());
                        isRuleExist = true;
                        Report.Success("PortTriggerRule", "This port triggering rule is enabled from the list");
                        Report.Screenshot("PortTriggerRule", row.Element, true);
                        break;
                    }
                    else
                    {
                        isRuleExist = false;
                    }   //end of IF-ELSE condition
                    rowNum++;
                }       //end of for-loop ROWS
            }
            else        //if there are NO active rules
            {
                Report.Failure("There are no active port triggering rules to enable !!!");
                Report.Screenshot("PortTriggerRule", myTable.Element, false);
            }//end of IF-ELSE rowcount

            if (!isRuleExist)
            {
                //argument1-Trigger range start port, argument2-Trigger range end port,argument3-Target range start port,argument4-,argument5-Target range end port,argument6-Protocol
                Report.Failure("The given Port Triggering Rule does not exist in the PortTrigger Table");
                //TestSuite.Current.GetTestCase("Apply_Any_Enable_PortTrigger_Changes").Checked=false;
            }
            else
            {
                Report.Info("// The following port triggering rule(s) are Enabled from the list //");
                Report.Screenshot("PortTriggerRule", myTable.Element, false);
                //TestSuite.Current.GetTestCase("Apply_Any_Enable_PortTrigger_Changes").Checked=true;
                //Report.Screenshot();
            }
        }
Example #9
0
        void disable_all_port_trigger_rules()
        {
            //implemented based on R3.5(9.1.116J) and latesr versions
            Delay.Seconds(45);
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";

            webDocument.WaitForDocumentLoaded();
            TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'portTriggeringTable']");

            //count the rows
            IList <TrTag> rows    = myTable.Find <TrTag>("./tbody//tr");
            int           rowsCnt = rows.Count;
            //Report.Info("Total rowsCnt",rowsCnt.ToString());
            // Report.Info("Total Rules",rowsCnt.ToString());
            bool isRules = false;

            if (rowsCnt > 0)
            {
                int rowNum = 1;
                //int c=0;
                foreach (var row in rows)
                {
                    var cells  = row.FindDescendants <TdTag>();
                    int colNum = 1;
                    //int enableCheck = 0;
                    //string triggerStart="" , triggerEnd="", targetStart="", targetEnd="";
                    //Report.Info("Cell[0]: " + cells[0].InnerText);//No Trigger rules
                    //Report.Info(""+cells.Count.ToString());
                    foreach (var cell in cells)
                    {
                        //Report.Info("Cell: " + cell.InnerText);  //No triggering rule!
                        if (cells.Count == 1 && cell.InnerText.StartsWith("No triggering rule"))
                        {
                            Report.Failure("There are no active PortTriggerRule to disable !!!");
                            Report.Screenshot("PortTriggerRule", myTable.Element, true);
                            isRules = true;
                            TestSuite.Current.GetTestCase("Apply_Port_Triggering_Changes").Checked = false;
                            break;
                            //return;
                        }
                        else
                        {
                            if (colNum == 1)
                            {
                                //triggerRangeStartEndPort
                                //triggerStart = cell.InnerText;
                                //triggerEnd= cell.InnerText;
                            }
                            else if (colNum == 2)
                            {
                                //targetRangeStartEndPort
                                //targetStart = cell.InnerText;
                                //targetEnd = cell.InnerText;
                            }
                            else if (colNum == 4)
                            {
                                //	enabled of disabled?	//
                                //Report.Info(cell.GetInnerHtml().ToString());
                                //Report.Info("colNum",colNum.ToString());
                                //Report.Info(cells[5].GetInnerHtml().ToString());

                                IList <InputTag> inputVals = cells[3].Find <InputTag>("./input");
                                //Report.Info("input count :  "+inputVals.Count);
                                foreach (InputTag inputVal in inputVals)
                                {
                                    Ranorex.InputTag testTag = inputVal;
                                    //Report.Info(inputVal.GetPath().ToString());
                                    if (testTag.Checked.ToString() == "True")
                                    {
                                        //Report.Info(" portTriggeringTableEnabledTag is currently enabled ");
                                        inputVal.Checked = "False";
                                        Delay.Seconds(5);
                                        Report.Log(ReportLevel.Success, "The following port triggering rule is disabled now...");
                                        Report.Screenshot("PortTriggerRule", row.Element, true);
                                    }
                                    else
                                    {
                                        //Report.Info(" portTriggeringTableEnabledTag is currently disabled ");

                                        Report.Log(ReportLevel.Success, "The following port triggering rule is already disabled !!!");
                                        Report.Screenshot("PortTriggerRule", row.Element, true);
                                    }
                                }                                                        //end of for-loop

                                //Report.Info("<---This port triggering rule is disabled --->");
                            }
                            colNum++;

                            //cell.click();
                        }                                        //end of if-else "No triggering rule"
                        cell.MoveTo();
                    }                                            //end of for-loop : cell
                    //enableCheck++;
                    rowNum++;
                    //Report.Info("rowNum:"+rowNum);
                    if (isRules)
                    {
                        break;
                        //return;
                    }
                }         //end of for-loop : row
                if (!isRules)
                {
                    Report.Log(ReportLevel.Success, "The following port triggering rule(s) are disabled/enabled");
                    Delay.Seconds(10);
                    Report.Screenshot("PortTriggerRule", myTable.Element, false);
                    //Report.Screenshot();
                }
            }
            else
            {
                Report.Failure("There are no active PortTriggerRule to disable !!!");
                Delay.Seconds(1);
                Report.Screenshot("PortTriggerRule", myTable.Element, false);
            }
        }
        public void Choose_A_Port_Forwd_Rule_To_Enable(string argument1, string argument2, string argument3, string argument4, string argument5)
        {
            string localIP = "", localStartPort = "", localEndPort = "", externalStartPort = "", externalEndPort = "";

            Delay.Seconds(20);
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";
            TableTag    myTable     = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'PortForwardingTable']"); //R 3.11.1
            //TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'portTriggeringTable']");  //As per R3.5 (9.1.116J)
            IList <TrTag> totalRules = myTable.Find <TrTag>("./tbody//tr");                                                 //count the rows
            int           rulesCount = totalRules.Count;

            if (rulesCount == 0)
            {
                Report.Failure("Port Forwarding ", "There are no active Port Forwarding rules to Enable !!");
                TestSuite.Current.GetTestCase("Enable_Any_Port_Forward_Rule").Checked = false;
                return;
            }
            else
            {
                //walkthrough the column values
                IList <TdTag> cols = myTable.Find <TdTag>("./tbody//td");
                int           j = 1, colsCount = cols.Count;
                Report.Info("Total colsCount", colsCount.ToString());
                bool   isRuleExist = false;
                String portFwdRule = "";

                foreach (TdTag col in cols)
                {
                    //Report.Info(j.ToString());
                    Report.Info(col.InnerText);
                    if (j == 1)
                    {
                        //Ip Address
                        localIP = col.InnerText;
                        j++;
                    }
                    else if (j == 2)
                    {
                        //Local start port
                        localStartPort = col.InnerText;
                        j++;
                    }
                    else if (j == 3)
                    {
                        //Local end port
                        localEndPort = col.InnerText;
                        j++;
                    }
                    else if (j == 4)
                    {
                        //External start port
                        externalStartPort = col.InnerText;
                        j++;
                    }
                    else if (j == 5)
                    {
                        //External end port
                        externalEndPort = col.InnerText;
                        j++;
                    }
                    else if (j == 6)
                    {
                        //protocol
                        j++;
                    }
                    else if (j == 7)
                    {
                        //check if IP, ports are matching
                        if ((localIP == argument1) && (localStartPort == argument2) && (localEndPort == argument3) && (externalStartPort == argument4) && (externalEndPort == argument5))
                        {
                            portFwdRule = "localIP :: " + localIP + "||" + "localStartPort :: " + localStartPort + "||" + "localEndPort :: " + localEndPort + "||" + "externalStartPort :: " + externalStartPort + "||" + "externalEndPort :: " + externalEndPort;
                            Report.Log(ReportLevel.Success, "portFwdRule", portFwdRule);
                            Report.Log(ReportLevel.Success, "portFwdRule", "This port forwarding rule is Enabled from the list");

                            //click the disable checkbox

                            /*
                             * WebElement webElement = col.Element;
                             * webElement.Click();*/
                            /*
                             * Report.Info("Path : " + webElement.GetPath().ToString());
                             * //string EnabledPath = webElement.GetPath().ToString() + "/input[@name='Enabled']";
                             * string EnabledPath = webElement.GetPath().ToString() + "/input[#'Enabled']";
                             * //string EnabledPath = webElement.GetPath().ToString();
                             * Report.Info("EnabledPath : " + EnabledPath);
                             * Ranorex.InputTag EnabledTag = EnabledPath;
                             * EnabledTag.PerformClick();
                             */

                            /*
                             * Ranorex.InputTag checkbox;
                             * webDocument.TryFindSingle(EnabledPath,out checkbox);
                             * checkbox.PerformClick();
                             * checkbox.Checked = "true";
                             */
                            IList <InputTag> inputVals = col.Find <InputTag>("./input");
                            Report.Info("input count :  " + inputVals.Count);
                            foreach (InputTag inputVal in inputVals)
                            {
                                Ranorex.InputTag testTag = inputVal;
                                //Report.Info(inputVal.GetPath().ToString());
                                if (testTag.Checked.ToString() == "False")
                                {
                                    //False - Currently DISABLED
                                    Report.Info(" portForwardingTableEnabledTag is currently disabled and it will be enabled soon..! ");
                                    inputVal.PerformClick();
                                    //inputVal.Checked="True";
                                    Delay.Seconds(2);
                                    Report.Log(ReportLevel.Success, "This port forwarding rule is enabled !!!");
                                    Report.Screenshot("PortForwardingRule", col.Element, true);
                                }
                                else
                                {
                                    //True - Currently ENABLED
                                    Report.Info(" portForwardingTableEnabledTag is already enabled !!! ");

                                    /*
                                     *      //inputVal.DoubleClick();
                                     *      inputVal.Checked="False";
                                     *      Delay.Seconds(5);
                                     *      Report.Log(ReportLevel.Success,"This port forwarding rule is disabled");
                                     */
                                    Delay.Seconds(2);
                                    Report.Screenshot("PortForwardingRule", col.Element, true);
                                }
                            }                            //end of  InputTag : for-loop

                            isRuleExist = true;
                            break;
                        }                               //end of if-else

                        j++;
                    }
                    else if (j == 8)
                    {
                        //delete
                        j = 1;
                    }
                }                       //end of for-loop : TdTag
                if (!isRuleExist)
                {
                    portFwdRule = "localIP :: " + argument1 + "||" + "localStartPort :: " + argument2 + "||" + "localEndPort :: " + argument3 + "||" + "externalStartPort :: " + argument4 + "||" + "externalEndPort :: " + argument5;
                    Report.Log(ReportLevel.Failure, "portFwdRule", portFwdRule);
                    Report.Log(ReportLevel.Failure, "portFwdRule", "This port forwarding rule does not exist to enable");
                }

                /*
                 * if(j > colsCount){
                 *      Report.Log(ReportLevel.Success,"The following port forwarding rule(s) are enabled successfully");
                 *      Report.Screenshot("portFwdRule",myTable.Element,true);
                 * }*/
            }   //end of if-else :rulesCount
        }
Example #11
0
        public void Select_All_Port_Forwarding_Rules()
        {
            //implemented based on R3.5(9.1.116J)
            //Delay.Seconds(15);
            if (TotalRows < 10)
            {
                Delay.Seconds(20);
            }
            else if (TotalRows > 10 && TotalRows < 20)
            {
                Delay.Seconds(30);
            }
            else if (TotalRows > 20 && TotalRows < 30)
            {
                Delay.Seconds(40);
            }
            else if (TotalRows > 30)
            {
                Delay.Seconds(50);
            }
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";
            TableTag    myTable     = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'PortForwardingTable']"); //As per R 3,11.1
            // TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'portTriggeringTable']");  //As per R3.5 (9.1.116J)

            //Count the total no of port forwarding rules (rows)
            IList <TrTag> totalRules = myTable.Find <TrTag>("./tbody//tr");
            int           rulesCount = totalRules.Count;
            //Report.Info("Total Rules",rulesCount.ToString());
            string totalPortRules = "Total Rules : " + rulesCount.ToString();

            //Report.Info("Port Forwarding ",totalPortRules);

            if (rulesCount > 0)
            {
                Report.Info("Total Rules", totalPortRules);
                // is there are any active rules ??
                //walkthrough the column values
                IList <TdTag> cols      = myTable.Find <TdTag>("./tbody//td");
                int           colsCount = cols.Count;
                int           j         = 1;
                //Report.Info("Total colsCount",colsCount.ToString());

                foreach (TdTag col in cols)
                {
                    //Report.Info("Column #",j.ToString());
                    //Report.Info("Column Value",col.InnerText);
                    if (j == 5)
                    {
                        //enable or disable ?

                        //Report.Info("Enable or Disable ?");

                        IList <InputTag> inputVals = col.Find <InputTag>("./input");
                        //Report.Info("input count :  "+inputVals.Count);
                        foreach (InputTag inputVal in inputVals)
                        {
                            Ranorex.InputTag testTag = inputVal;
                            Report.Info(inputVal.GetPath().ToString());
                            if (testTag.Checked.ToString() == "False")
                            {
                                Report.Info(" portForwardingTableEnabledTag is currently  disabled");
                                //inputVal.Checked="True";
                                inputVal.PerformClick();
                                Delay.Seconds(5);
                                Report.Log(ReportLevel.Success, "This port forwarding rule is  enabled now...");
                                Report.Screenshot("PortForwardingRule", col.Element, true);
                            }
                            else
                            {
                                //Report.Info(" portForwardingTableEnabledTag is currently enabled ");
                                //inputVal.PerformClick();
                                Delay.Seconds(5);
                                Report.Log(ReportLevel.Success, "This port forwarding rule is already enabled !!!");
                                Report.Screenshot("PortForwardingRule", col.Element, true);
                            }
                        }                //end of for-loop : InputTag
                        j++;             //increment the column
                    }
                    else if (j == 6)
                    {
                        //delete box
                        //Report.Info("delete ?");
                        j = 1;
                    }
                    else
                    {
                        j++;
                    }
                }                // end of FOR-LOOP :TdTag
                Report.Log(ReportLevel.Success, "The following port forwarding rule(s) are Enabled");
                Delay.Seconds(1);
                //Report.Screenshot();
                Report.Screenshot("PortForwardingRule", myTable.Element, true);
            }
            else
            {
                Report.Failure("Port Forwarding ", "There are no active Port Forwarding rules to Enable !!");
                TestSuite.Current.GetTestCase("Apply_Port_Forward_Changes_Enable_All").Checked = false;
                return;
            }    // end of if-else
        }
        public void Disable_Any_Port_Trigger_Rule(string argument1, string argument2, string argument3, string argument4)
        {
            //Implemented based on R2.4.2 (9.1.88S)
            //identify the rules to disable
            //Report.Info( "--------Inside Disable_Any_Port_Trigger_Rule -------");
            //string triggerRangeStartPort="",triggerRangeEndPort="",targetRangeStartPort="",targetRangeEndPort="";
            Delay.Seconds(20);
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";

            webDocument.WaitForDocumentLoaded();
            TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'portTriggeringTable']");

            //count the rows
            IList <TrTag> rows        = myTable.Find <TrTag>("./tbody//tr");
            int           rowsCnt     = rows.Count;
            bool          isRuleExist = false;

            //Report.Info("Total rowsCnt",rowsCnt.ToString());
            Report.Info("Total Rules", rowsCnt.ToString());

            Report.Info("Trigger range start port : ", argument1);
            Report.Info("Trigger range end port : ", argument2);
            Report.Info("Target range start port : ", argument3);
            Report.Info("Target range end port : ", argument4);
            //Report.Info("TProtocol : ",argument5);
            //Report.Info("Enable/Disable : ",argument6);
            if (rowsCnt > 0)     //if there are any rules exist ?
            {
                int rowNum = 1;
                //int c=0;
                //int enableCheck = 0;

                foreach (var row in rows)
                {
                    var    cells = row.FindDescendants <TdTag>();
                    int    colNum = 1;
                    string triggerStart = "", triggerEnd = "", targetStart = "", targetEnd = "";
                    //Report.Info("cells count",cells.Count.ToString());//count columns in a row
                    //Report.Info("Cell[0]: " + cells[c].InnerText);
                    foreach (var cell in cells)
                    {
                        //Report.Info("Cell: " + cell.InnerText);
                        if (cells.Count == 1 && cell.InnerText.StartsWith("No triggering rule"))
                        {
                            Report.Failure("There are no active PortTriggerRule to disable !!!");
                            Report.Screenshot("PortTriggerRule", myTable.Element, true);
                            TestSuite.Current.GetTestCase("Apply_Port_Triggering_Changes").Checked = false;
                            break;
                        }
                        else
                        {
                            if (colNum == 1)
                            {
                                //triggerRangeStartPort
                                triggerStart = cell.InnerText;
                            }
                            else if (colNum == 2)
                            {
                                //triggerRangeEndPort
                                triggerEnd = cell.InnerText;
                            }
                            else if (colNum == 3)
                            {
                                //targetRangeStartPort
                                targetStart = cell.InnerText;
                            }
                            else if (colNum == 4)
                            {
                                //targetRangeEndPort
                                targetEnd = cell.InnerText;
                            }
                            else if (colNum == 5)
                            {
                                //enabled of disabled?
                            }
                            colNum++;
                            //cell.click();
                        }
                    }                                    //end of for-loop column
                    if (triggerStart == argument1 && triggerEnd == argument2 && targetStart == argument3 && targetEnd == argument4)
                    {
                        //Report.Info(cells[5].GetInnerHtml().ToString());

                        //cells[5].Click();
                        //Delay.Seconds(2);

                        //String newPath = "";
                        //newPath ="/dom[@domain='192.168.0.1']//input[#'portTriggeringTable-Enabled-"+enableCheck+"']";
                        //Report.Info("Cells path : " , cells[5].GetPath().ToString());

                        //newPath = cells[5].GetPath() + "/input[#'portTriggeringTable-Enabled-"+enableCheck+"']";
                        //Report.Info("newPath : " , newPath);
                        //Ranorex.InputTag portTriggringTableEnabledTag = Host.Local.FindSingle<Ranorex.InputTag>(newPath);
                        //Ranorex.InputTag portTriggringTableEnabledTag = Host.Local.FindSingle<Ranorex.InputTag>(cells[5].GetPath().ToString());

                        //Ranorex.InputTag portTriggringTableEnabledTag = newPath;

                        //Report.Info(portTriggringTableEnabledTag.Name.ToString());
                        //Report.Info(portTriggringTableEnabledTag.Id.ToString());


                        IList <InputTag> inputVals = cells[5].Find <InputTag>("./input");
                        //Report.Info("input count :  "+inputVals.Count);
                        foreach (InputTag inputVal in inputVals)
                        {
                            Ranorex.InputTag testTag = inputVal;
                            //Report.Info(inputVal.GetPath().ToString());
                            if (testTag.Checked.ToString() == "True")
                            {
                                Report.Info(" portTriggeringTableEnabledTag is currently enabled ");
                                //inputVal.DoubleClick();
                                inputVal.Checked = "False";
                                Delay.Seconds(5);
                                Report.Log(ReportLevel.Success, "This port triggering rule is disabled");
                                Report.Screenshot("PortTriggerRule", row.Element, true);
                            }
                            else
                            {
                                Report.Info(" portTriggeringTableEnabledTag is currently disabled ");
                                inputVal.PerformClick();
                                Delay.Seconds(5);
                                Report.Log(ReportLevel.Success, "This port triggering rule is disabled");
                                Report.Screenshot("PortTriggerRule", row.Element, true);
                            }
                        }                                               //end of for loop: InputTag

                        /*
                         *      if(portTriggringTableEnabledTag.Checked.ToString() == "True"){
                         *              // portTriggeringTableEnabledTag is already Enabled
                         *              Report.Info("-----------------portTriggeringTableEnabledTag  is checked---");
                         *              //Delay.Seconds(1);
                         *              //portTriggringTableEnabledTag.Checked = " ";	//uncheck the checkbox to disable
                         *              //portTriggringTableEnabledTag.Checked ="False";
                         *
                         *              portTriggringTableEnabledTag.Focus();
                         *              portTriggringTableEnabledTag.DoubleClick();
                         *              //cells[5].Click();
                         *              //Delay.Seconds(1);
                         *              //Report.Info(portTriggringTableEnabledTag.GetInnerHtml().ToString());
                         *      }else{
                         *      Report.Info("-----------------portTriggeringTableEnabledTag  is unchecked---");
                         *              //portTriggeringTableEnabledTag is already disabled
                         *              Report.Info(" portTriggeringTableEnabledTag is already disabled ");
                         *              //portTriggringTableEnabledTag.Focus();
                         *              //portTriggringTableEnabledTag.Checked ="checked";
                         *              //portTriggringTableEnabledTag.Checked="true";
                         *              //Report.Info(portTriggringTableEnabledTag.HasFocus.ToString());
                         *              //Report.Info(portTriggringTableEnabledTag.Element.GetInnerHtml().ToString());
                         *              //portTriggringTableEnabledTag.Click();
                         *              //portTriggringTableEnabledTag.PerformClick();
                         *
                         *              //Ranorex.CheckBox testCheckBox = cells[5].GetPath() + "/input[#'fmChbx-portTriggeringTable-Enabled-"+enableCheck+"']";
                         *              //Ranorex.CheckBox testCheckBox = "/dom[@domain='192.168.0.1']//b[#'fmChbx-portTriggeringTable-Enabled-"+enableCheck+"']";
                         *              //testCheckBox.Focus();
                         *              //Report.Info(testCheckBox.CheckState.ToString());
                         *              //testCheckBox.Click();
                         *      }
                         */
                        isRuleExist = true;
                        //Report.Info(cells[5].GetInnerHtml().ToString());
                        Report.Success("PortTriggerRule", "This port triggering rule is disabled from the list");
                        Report.Screenshot("PortTriggerRule", row.Element, true);
                        break;
                    }
                    else
                    {
                        isRuleExist = false;
                    }
                    rowNum++;
                    //enableCheck++;
                }                  //end of for-loop ROWS
            }
            else
            {
                Report.Failure("There are no active port triggering rules to disable !!!");
                Report.Screenshot("PortTriggerRule", myTable.Element, true);
            }
            if (!isRuleExist)
            {
                Report.Failure("The given Port Triggering Rule does not exist in the PortTrigger Table");
                //TestSuite.Current.GetTestCase("Apply_Disable_Any_Port_Trigger_Rule").Checked=false;
            }

            /**
             * //walkthrough the column values//
             * IList<TdTag> cols = myTable.Find<TdTag>("./tbody//td");
             * int colsCount = cols.Count;
             * Report.Info("Total colsCount",colsCount.ToString());
             * int j=1;
             * bool isRuleExist=false;
             * String portTriggerRule ="";
             * foreach(TdTag col in cols)
             * {
             *      //Report.Info(col.InnerText);
             *      if(j==1 && (!(col.InnerText.Equals("No triggering rule!")))){	//if there are port trigger rules
             *              //triggerRangeStartPort
             *              triggerRangeStartPort = col.InnerText;
             *      }else if(j==2){
             *              //triggerRangeEndPort
             *              triggerRangeEndPort = col.InnerText;
             *      }else if(j==3){
             *              //targetRangeStartPort
             *              targetRangeStartPort = col.InnerText;
             *      }else if(j==4){
             *              //targetRangeEndPort
             *              targetRangeEndPort = col.InnerText;
             *      }
             *
             *      if (j ==7){
             *              //perfrom validation
             *              if((triggerRangeStartPort==argument1) && (triggerRangeEndPort== argument2)&& (targetRangeStartPort == argument3)&& (targetRangeEndPort == argument4) ){
             *
             *                      //Delay.Seconds(5);
             *                      //click the delete checkbox
             *                      WebElement webElement = col.Element;
             *                      webElement.Click();
             *                      Delay.Seconds(3);
             *              //Report.Info("Clicked");
             *              //portTriggerRule = "triggerRangeStartPort :: "+ triggerRangeStartPort + "||"+"triggerRangeEndPort :: "+triggerRangeEndPort+"||"+"targetRangeStartPort :: "+targetRangeStartPort+ "||"+"targetRangeEndPort :: "+targetRangeEndPort;
             *                      portTriggerRule = "triggerRangeStartPort :: "+ argument1 + "||"+"triggerRangeEndPort :: "+argument2+"||"+"targetRangeStartPort :: "+argument3+ "||"+"targetRangeEndPort :: "+argument4 ;
             *              Report.Log(ReportLevel.Success,"PortTriggerRule",portTriggerRule);
             *                      //Report.Info("<---This port forwarding rule is deleted from the list--->");
             *                      Report.Log(ReportLevel.Success,"PortTriggerRule","This port triggering rule is deleted from the list");
             *                      //Report.Snapshot(myTable);
             *                      //Report.Snapshot("PortTriggerRule",myTable);
             *                      //Report.Screenshot("PortTriggerRule",myTable,true);
             *                      //Report.Screenshot("PortTriggerRule",webElement,true);
             *
             *                      int rowNum = 1;
             *                  foreach (var row in rows)
             *                  {
             *                      var cells = row.FindDescendants<TdTag>();
             *                      int colNum=1;
             *                      string triggerStart="" , triggerEnd="", targetStart="", targetEnd="";
             *                      foreach (var cell in cells)
             *                      {
             *                         // Report.Info("Cell: " + cell.InnerText);
             *                          if(colNum==1){
             *                              //triggerRangeStartPort
             *                              triggerStart = cell.InnerText;
             *                          }else if(colNum==2){
             *                              //triggerRangeEndPort
             *                              triggerEnd= cell.InnerText;
             *                          }else if(colNum==3){
             *                              //targetRangeStartPort
             *                              targetStart = cell.InnerText;
             *                          }else if(colNum==4){
             *                              //targetRangeEndPort
             *                              targetEnd = cell.InnerText;
             *                          }
             *                          colNum++;
             *                      }
             *                      if(triggerStart == triggerRangeStartPort && triggerEnd == triggerRangeEndPort && targetStart == targetRangeStartPort && targetEnd == targetRangeEndPort ){
             *                              Report.Screenshot("PortTriggerRule",row.Element,true);
             *                              break;
             *                      }
             *                      rowNum++;
             *                  }
             *
             *              isRuleExist = true;
             *              break;
             *              }
             *              j=0;
             *      }
             *      j++;
             * }	//end of foreach
             * if(!isRuleExist){
             *      portTriggerRule = "triggerRangeStartPort :: "+ argument1 + "||"+"triggerRangeEndPort :: "+argument2+"||"+"targetRangeStartPort :: "+argument3+ "||"+"targetRangeEndPort :: "+argument4 ;
             *      Report.Log(ReportLevel.Failure,"PortTriggerRule",portTriggerRule);
             *      Report.Log(ReportLevel.Failure,"PortTriggerRule","This port triggering rule does not exist");
             * }
             **/
        }
        public void Choose_Any_5GHz_Wireless_MAC_Filtering_Device_To_Delete(string argument1, string argument2, string argument3, string argument4, string argument5, string argument6, string argument7)
        {
            //choose  any device to delete based on Device name and MAC addresses
            //argument7 - device name, argument1- MAC 0  ....and argument6-MAC5
//          Delay.Seconds(30);
            if (TotalRows1 <= 5 || TotalRows2 <= 5)
            {
                Delay.Seconds(5);               // to load the pages
            }
            else if ((TotalRows1 > 5 && TotalRows1 <= 10) || (TotalRows2 > 5 && TotalRows2 <= 10))
            {
                Delay.Seconds(10);              // to load the pages
            }
            else if ((TotalRows1 > 10 && TotalRows1 <= 20) || (TotalRows2 > 10 && TotalRows2 <= 20))
            {
                Delay.Seconds(20);              // to load the pages
            }
            else
            {
                Delay.Seconds(30);              // to load the pages
            }

            Report.Info("DeviceName: " + argument7 + " - " + " MAC: " + argument1 + " : " + argument2 + " : " + argument3 + " : " + argument4 + " : " + argument5 + " : " + argument6);

            WebDocument webDocument = "/dom[@domain='192.168.0.1']";
            //Report.Info(webDocument.GetHtml());
            TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'macAddressFilterTable']");
            //Count the total no of IPv4 port Filter rules (rows)
            IList <TrTag> totalMACRules       = myTable.Find <TrTag>("./tbody//tr");
            int           rulesCount          = totalMACRules.Count;
            string        totalMACFilterRules = "Total Rules : " + rulesCount.ToString();

            Report.Info("Active MAC  Filter Rules ", totalMACFilterRules);

            if (rulesCount == 0)
            {
                //Mouse.ScrollWheel(150);
                Report.Failure("MAC Filter ", "There are no active rules to delete !!");
                TestSuite.Current.GetTestCase("Delete_Any_MAC_Filtering_Rules").Checked = false;
                return;
            }
            else if (rulesCount == 1)           // if there is only one row
            //walkthrough the column values
            {
                IList <TdTag> cols      = myTable.Find <TdTag>("./tbody//td");
                int           colsCount = cols.Count;
                if (colsCount > 1)                      // if there is  only one row, many columns
                {
                    Report.Info(" Total column : " + colsCount.ToString());
                    Report.Info(" There is  " + totalMACFilterRules + " Wireless Filter Rule to delete !!! ");
                    int     colNum = 1;
                    int     delCheck = 0;
                    Boolean isMatch = false;
                    string  macAddress = "", macAddress1 = "";
                    macAddress = argument1 + ":" + argument2 + ":" + argument3 + ":" + argument4 + ":" + argument5 + ":" + argument6;
                    Report.Info("MAC Address : " + macAddress);

                    foreach (TdTag col in cols)
                    {
                        Report.Info("col: " + colNum);
                        if (colNum == 2)
                        {
                            //Report.Info(MacCol.InnerText);
                            macAddress1 = col.InnerText;
                            Report.Info("MAC Address1 : " + macAddress1);
                        }
                        else if (colNum == 3)
                        {
                            if (macAddress == macAddress1)
                            {
                                isMatch = true;
                                Report.Info("----------------- Rules Matches !!! ------");
                                String newPath = "";
                                newPath = col.GetPath() + "/input[#'macAddressFilterTable-Delete-" + delCheck + "']";                           //fmChbx-macAddressFilterTable-Delete-0, macAddressFilterTable-Delete-0
                                Ranorex.InputTag MACFilterTableDeleteTag = newPath;
                                if (MACFilterTableDeleteTag.Checked.ToString() == "False")
                                {
                                    Report.Info("----------------- MACFilterTableDeleteTag was False ---");
                                    Delay.Seconds(5);
                                    MACFilterTableDeleteTag.PerformClick();
                                }
                                else
                                {
                                    Report.Info(" MACFilterTableDeleteTag is already Enabled ");
                                }
                                string rst = "The following MACFilter_Filtering rule is deleted permanently !!!";
                                Report.Success(rst);
                                Report.Screenshot("MACFilter_Filtering", myTable.Element, true);
                            }
                        }
                        colNum++;
                    }                   //end of for loop-col
                }
                else                    // if there is only one row, one column
                {
                    Report.Info(" Total column : " + colsCount.ToString());
                    foreach (TdTag col in cols)
                    {
                        string noFilterStr = col.InnerText.ToString();
                        Report.Info(noFilterStr);
//						if(noFilterStr.StartsWith("No filtering")){	//No filtering device!
                        if (noFilterStr.StartsWith("You have not selected a device to filter"))                         //You have not selected a device to filter
                        {
                            Report.Failure("MAC Filter Devices ", "There are no devie to delete !!");
                            TestSuite.Current.GetTestCase("Delete_Any_5GHz_Wireless_MAC_Filter_Device").Checked = false;
                            return;
                        }
                        else
                        {
                            Report.Info(" There are " + rulesCount.ToString() + " MAC Filter Rule to delete  !!! ");
                            //check if the rule is matching the condition
                        }
                    }
                }
            }
            else      // if there are many rows
                      //Report.Info(" There are " + totalMACFilterRules + " MAC Filter Rules to delete !!! ");
            {
                Report.Info(" There are " + rulesCount.ToString() + " MAC Filter Rule(s) to delete !!! ");
                int     rowNum = 1;
                int     delCheck = 0;
                Boolean isMatch = false;
                string  macAddress = "", macAddress1 = "";
                macAddress = argument1 + ":" + argument2 + ":" + argument3 + ":" + argument4 + ":" + argument5 + ":" + argument6;
                Report.Info("MAC Address : " + macAddress);
                foreach (var row in totalMACRules)
                {
                    // Report.Info("Row: " + rowNum);
                    //Report.Info(row.GetInnerHtml().ToString());
                    IList <TdTag> cols   = row.Find <TdTag>("./td");
                    int           colNum = 1;

                    foreach (TdTag MacCol in cols)
                    {
                        //Report.Info("MacCol: " + colNum);
                        //Report.Info("MacCol Info: "+MacCol.InnerText);
                        if (colNum == 2)
                        {
                            //Report.Info(MacCol.InnerText);
                            macAddress1 = MacCol.InnerText;
                            Report.Info("MAC Address1 : " + macAddress1);
                        }
                        else if (colNum == 3)
                        {
                            // check if Mac address is matching
                            //Report.Info("----------------- click delete checkbox ------");
                            if (macAddress == macAddress1)
                            {
                                isMatch = true;
                                Report.Info("----------------- Rule Exist !!! ------");
                                String newPath = "";
                                newPath = MacCol.GetPath() + "/input[#'macAddressFilterTable-Delete-" + delCheck + "']";
                                //fmChbx-macAddressFilterTable-Delete-0, macAddressFilterTable-Delete-0
                                //dom[@domain='192.168.0.1']//b[#'fmChbx-macAddressFilterTable-Delete-1']
//			                    Report.Info("newPath :" + newPath);

                                Report.Info("--------- newPath orginal ---->> " + newPath);

//			                    newPath = "/dom[@page='' and @path='/' and @browsername='IE' and @pageurl='http://192.168.100.1/?wifi_settings&mid=WirelessPrimary']//tbody[#'macAddressFilterTable_body']/tr[1]/td[3]/" + "/input[#'macAddressFilterTable-Delete-"+delCheck+"']";
//			                    newPath = "/dom[@page='' and @path='/' and @browsername='IE' and @pageurl='http://192.168.0.1/?wifi_settings&mid=WirelessPrimary']/"+ "/input[#'macAddressFilterTable-Delete-"+delCheck+"']";   //original working statement

//			                    newPath = "/dom[@caption='Hub 3.0' and @page='' and @path='/' and @browsername='IE' and @pageurl='http://192.168.0.1/?wifi_settings&mid=WirelessSecurity']//input[#'macAddressFilterTable-Delete-31']";		//added on 17/10/17 for code -116.400
                                newPath = "/dom[@caption='Hub 3.0' and @page='' and @path='/' and @browsername='IE' and @pageurl='http://192.168.0.1/?wifi_settings&mid=WirelessSecurity']//input[#'macAddressFilterTable-Delete-" + delCheck + "']";                           //added on 17/10/17 for code -116.400

                                Report.Info("--------- newPath modified ---->> " + newPath);
                                // The above code is added to test on Windows10 platform - 23Feb2017

                                Ranorex.InputTag MACFilterTableDeleteTag = newPath;
                                if (MACFilterTableDeleteTag.Checked.ToString() == "False")
                                {
                                    Report.Info("----------------- MACFilterTableDeleteTag was False ---");
                                    Delay.Seconds(5);
                                    MACFilterTableDeleteTag.PerformClick();
                                    Delay.Seconds(3);
                                }
                                else
                                {
                                    Report.Info(" MACFilterTableDeleteTag is already Enabled ");
                                }
                                string rst = "The following MACFilter_Filtering rule is deleted permanently !!!";
                                Report.Success(rst);
                                Report.Screenshot("MACFilter_Filtering", row.Element, true);
                            }
                        }
                        colNum++;
                    }                   // end of for-loop (column)
                    if (isMatch)
                    {
                        break;
                    }
                    rowNum++;
                    delCheck++;                             //counter to select delete checkbox
                }                                           //end of for-loop (row)
                if ((rowNum - 1) == rulesCount && !isMatch) //if rule does not exist
                {
                    TestSuite.Current.GetTestCase("Delete_Any_5GHz_Wireless_MAC_Filter_Device").Checked = false;
                    Report.Info(" ===== This Rule does not exist =====");
                    Delay.Seconds(1);
                    Report.Screenshot("MAC_Filtering_Devices", myTable.Element, true);
                }
            }
        }
        public void Choose_All_MAC_Filter_Rules_To_Delete()
        {
            //This method is to select all the filter rules to delete
            Delay.Seconds(40);
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";
            //Report.Info(webDocument.GetHtml());
            TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'macFilterTable']");
            //Count the total no of IPv4 port Filter rules (rows)
            IList <TrTag> totalMACRules       = myTable.Find <TrTag>("./tbody//tr");
            int           rulesCount          = totalMACRules.Count;
            string        totalMACFilterRules = "Total Rules : " + rulesCount.ToString();

            Report.Info("Active MAC  Filter Rules ", totalMACFilterRules);

            if (rulesCount == 0)
            {
                //Mouse.ScrollWheel(150);
                Report.Failure("MAC Filter ", "There are no active rules to delete !!");
                TestSuite.Current.GetTestCase("Delete_All_MAC_Filtering_Rules").Checked      = false;
                TestSuite.Current.GetTestCase("Activate_MAC_Filtering_Rule_Always1").Checked = true;
                return;
            }
            else
            {
                //Report.Info(" There is/are " + rulesCount.ToString() + " row exists in MAC Filter table !!! ");
                Report.Info(" No. of rows exists in MAC Filter table : " + rulesCount.ToString());
                //walkthrough the column values

                IList <TdTag> cols      = myTable.Find <TdTag>("./tbody//td");
                int           colsCount = cols.Count;
                Report.Info("Total colsCount", colsCount.ToString());
                int j        = 1;
                int delCount = 0;
                int delCheck = 0;

                foreach (TdTag MacCol in cols)
                {
                    Report.Info(j.ToString());
                    Report.Info(MacCol.InnerText);
                    TdTag macAddress = null;
                    //if(j==1 && (MacCol.InnerText.ToString().StartsWith("No MAC filtering"))){
                    if (j == 1 && (MacCol.InnerText.ToString().StartsWith("No MAC filtering rule!")))                    //No MAC filtering rule!
                    //Report.Info("No MAC filtering rule exists !!!");
                    {
                        Report.Failure("MAC Filter ", "There are No MAC filtering  rules to delete !!");
                        TestSuite.Current.GetTestCase("Delete_All_MAC_Filtering_Rules").Checked      = false;
                        TestSuite.Current.GetTestCase("Activate_MAC_Filtering_Rule_Always1").Checked = false;
                        Delay.Seconds(1);
                        Report.Screenshot("MAC_Filtering", myTable.Element, true);
                        return;
                    }
                    else if (j == 2)
                    {
                        //Report.Info(MacCol.InnerText);
                        macAddress = MacCol;
                    }
                    else if (j == 4)
                    {
                        //Report.Info("---Checked  delete box ---");

                        /*
                         * WebElement webElement = MacCol.Element;
                         * Delay.Seconds(2);
                         * webElement.Click();
                         * Report.Screenshot("Delete MACFilter",webElement,true);
                         */
                        //Report.Info(MacCol.GetInnerHtml().ToString());
                        Report.Info("MacCol path: " + MacCol.GetPath().ToString());

                        String newPath = "";
                        //newPath = col.GetPath() + "/input[#'ipv4FilterTable-Delete-"+delCheck+"']";
//				        newPath = MacCol.GetPath() + "/input[#'fmChbx-macFilterTable-Delete-"+delCheck+"']";
                        newPath = MacCol.GetPath() + "/input[#'macFilterTable-Delete-" + delCheck + "']";

                        /*
                         * /dom[@caption='Hub 3.0' and @page='' and @path='/' and @browsername='IE' and @pageurl='http://192.168.0.1/?macfilter&mid=MACFiltering']//tbody[#'macFilterTable_body']/tr[1]/td[3]
                         *      /dom[@caption='Hub 3.0' and @page='' and @path='/' and @browsername='IE' and @pageurl='http://192.168.0.1/?macfilter&mid=MACFiltering']//input[#'macFilterTable-Delete-0']
                         * /dom[@caption='Hub 3.0' and @page='' and @path='/' and @browsername='IE' and @pageurl='http://192.168.0.1/?macfilter&mid=MACFiltering']//b[#'fmChbx-macFilterTable-Delete-0']
                         */

                        Report.Info("macFilterTable-Delete checkbox ");
                        Report.Info("newPath : " + newPath);

                        Ranorex.InputTag MACFilterTableDeleteTag = newPath;
//				        Report.Info("MACFilterTableDeleteTag(Default) : " + MACFilterTableDeleteTag.Checked.ToString());
                        if (MACFilterTableDeleteTag.Checked.ToString() == "False")
                        {
                            //Report.Info("----------------- MACFilterTableDeleteTag was False ---");
                            Delay.Seconds(1);
                            MACFilterTableDeleteTag.PerformClick();
                        }
                        else
                        {
                            Report.Info(" MACFilterTableDeleteTag is already Enabled ");
                        }
                        string rst = "The following MACFilter_Filtering rule is deleted permanently !!!";
                        Report.Success(rst);
                        Delay.Seconds(1);
                        //Report.Screenshot("MACFilter_Filtering",macAddress.Element,true);
                        Report.Screenshot("MACFilter_Filtering", myTable.Element, true);
                        Delay.Seconds(1);
                        j = 0;
                        delCount++;
                        delCheck++;
                    }
                    j++;
                }                       //end of for-loop

                if (delCount == rulesCount)
                {
                    // to check whether it selected all rows for deletion
                    string rst = "The following " + rulesCount.ToString() + " MAC Filtering rules are deleted permanently !!!";
                    Report.Success(rst);
                    Report.Screenshot("MAC_Filtering", myTable.Element, true);
                    Delay.Seconds(1);
                    TestSuite.Current.GetTestCase("Activate_MAC_Filtering_Rule_Always1").Checked = true;
                }
                else
                {
                    Report.Info(" All rows are not deleted !!! ");
                    TestSuite.Current.GetTestCase("Activate_MAC_Filtering_Rule_Always1").Checked = false;
                }
            }
        }
        public void Disable_Any_Port_Triggering_Rule(string argument1, string argument2, string argument3, string argument4)
        {
            //Implemented based on R3.5 (9.1.116J),R3.7 (9.1.116S) and later version
            Report.Info("//--------Inside Disable_Any_Port_Triggering_Rule -------//");
            string triggerRangeStartPort = "", triggerRangeEndPort = "", targetRangeStartPort = "", targetRangeEndPort = "";
            string triggerRangePort = "", targetRangePort = "";

            Delay.Seconds(45);
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";
            TableTag    myTable     = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'portTriggeringTable']");

            //count the rows
            IList <TrTag> rows    = myTable.Find <TrTag>("./tbody//tr");
            int           rowsCnt = rows.Count;

            //Report.Info("Total rowsCnt",rowsCnt.ToString());
            Report.Info("Total Rules", rowsCnt.ToString());
            if (rowsCnt == 0)
            {
                //Mouse.ScrollWheel(150);
                Report.Failure("Port Triggering ", "There are no active port triggering rules to disable !!");
                //TestSuite.Current.GetTestCase("Delete_All_Port_Trigger_Rules").Checked = false;
                return;
            }
            else
            {
                //walkthrough the column values
                IList <TdTag> cols      = myTable.Find <TdTag>("./tbody//td");
                int           colsCount = cols.Count;
                Report.Info("Total colsCount", colsCount.ToString());
                int    j = 1;
                bool   isRuleExist = false;
                String portTriggerRule = "";
                int    index = 0, strLen = 0;
                foreach (TdTag col in cols)
                {
                    //Report.Info("J value ",j.ToString());
                    if (j == 1 && (!(col.InnerText.Equals("No triggering rule!"))))                     //if there are port trigger rules
                    {
                        triggerRangePort = col.InnerText;
                        //Report.Info("TriRangePort",triggerRangePort.ToString());
                        index = triggerRangePort.IndexOf("-");
                        //Report.Info("TriRangePort-index",index.ToString());
                        triggerRangeStartPort = triggerRangePort.Substring(0, index);
                        //Report.Info("TriRangeStartPort",triggerRangeStartPort.ToString());
                        strLen = triggerRangePort.Length;
                        //Report.Info("TriRangePort-strLen",strLen.ToString());
                        triggerRangeEndPort = triggerRangePort.Substring(index + 1);
                        //Report.Info("TriRangeEndPort",triggerRangeEndPort.ToString());
                        //j++;
                    }
                    else if (j == 2)
                    {
                        targetRangePort = col.InnerText;
                        //Report.Info("TarRangePort",targetRangePort.ToString());
                        index = targetRangePort.IndexOf("-");
                        //Report.Info("tarRangePort-index",index.ToString());
                        targetRangeStartPort = targetRangePort.Substring(0, index);
                        //Report.Info("tarRangeStartPort",targetRangeStartPort.ToString());
                        targetRangeEndPort = targetRangePort.Substring(index + 1);
                        //Report.Info("tarRangeEndPort",targetRangeEndPort.ToString());
                        //j++;
                    }
                    else if (j == 3)
                    {
                        //j++;	//protocol
                    }
                    else if (j == 4)
                    {
                        if ((triggerRangeStartPort == argument1) && (triggerRangeEndPort == argument2) && (targetRangeStartPort == argument3) && (targetRangeEndPort == argument4))
                        {
                            portTriggerRule = "triggerRangeStartPort :: " + argument1 + "||" + "triggerRangeEndPort :: " + argument2 + "||" + "targetRangeStartPort :: " + argument3 + "||" + "targetRangeEndPort :: " + argument4;
                            Report.Log(ReportLevel.Success, "PortTrigger", portTriggerRule);
                            Report.Log(ReportLevel.Success, "PortTrigger", "This port triggering rule will be disabled from the list");

                            IList <InputTag> inputVals = col.Find <InputTag>("./input");
                            //Report.Info("input count :  "+inputVals.Count);
                            foreach (InputTag inputVal in inputVals)
                            {
                                Ranorex.InputTag testTag = inputVal;
                                //Report.Info(inputVal.GetPath().ToString());
                                if (testTag.Checked.ToString() == "True")
                                {
                                    Report.Info(" portTriggeringTableEnabledTag is currently enabled ");
                                    //inputVal.DoubleClick();
                                    inputVal.Checked = "False";
                                    Delay.Seconds(5);
                                    Report.Log(ReportLevel.Success, "This port triggering rule is disabled");
                                    Report.Screenshot("PortTrigger", col.Element, true);
                                }
                                else
                                {
                                    Report.Info(" portTriggeringTableEnabledTag is already disabled ");
                                    //inputVal.PerformClick();
                                    //Delay.Seconds(5);
                                    //Report.Log(ReportLevel.Success,"This port triggering rule is disabled");
                                    Report.Screenshot("PortTrigger", col.Element, true);
                                }
                            }                           //end of for loop: InputTag
                            isRuleExist = true;
                            break;
                        }
                        else
                        {
                            isRuleExist = false;
                        }                        //end of port comparision IF-ELSE
                                                 //j=0;
                    }
                    else if (j == 5)
                    {
                        //j++;	//delete
                        j = 0;
                    }
                    j++;
                }                //end of for-loop : TdTag

                if (!isRuleExist)
                {
                    portTriggerRule = "triggerRangeStartPort :: " + argument1 + "||" + "triggerRangeEndPort :: " + argument2 + "||" + "targetRangeStartPort :: " + argument3 + "||" + "targetRangeEndPort :: " + argument4;
                    Report.Log(ReportLevel.Failure, "PortTrigger", portTriggerRule);
                    Report.Log(ReportLevel.Failure, "PortTrigger", "This port triggering rule does not exist");
                }
            } //end of if-else
        }     //end of method
        public void Validate_Firewall_Page_Default_Settings()
        {
            //Validate firewall fields

            //IPv4 firewall protection - Enable
            //Block fragmented IP packets - Enable
            //Port scan detection - Disable
            //IP flood detection - Enable

            bool FirewallProtect = false, BlockFragment = false, PortScan = false, PFloodDetect = false;

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

            webDocument.WaitForDocumentLoaded();

            Ranorex.InputTag IPv4FirewallProtectTag = "/dom[@domain='192.168.0.1']//div[#'tr_EnableFirewall']/input[#'EnableFirewall']";
            Ranorex.InputTag BlockFragmentTag       = "/dom[@domain='192.168.0.1']//div[#'tr_EnableBlockFramentedPkts']/input[#'EnableBlockFramentedPkts']";
            Ranorex.InputTag PortScanTag            = "/dom[@domain='192.168.0.1']//div[#'tr_EnablePortScanDetection']/input[#'EnablePortScanDetection']";
            Ranorex.InputTag IPFloodDetectTag       = "/dom[@domain='192.168.0.1']//div[#'tr_EnableIPFloodDetection']/input[#'EnableIPFloodDetection']";

            //Report.Info("FirewallProtectTag(Default) : "+IPv4FirewallProtectTag.Checked.ToString());
            if (IPv4FirewallProtectTag.Checked.ToString() == "True")
            {
                FirewallProtect = true;
            }
            else
            {
                FirewallProtect = false;
            }
            //Report.Info("BlockFragmentTag(Default) : "+BlockFragmentTag.Checked.ToString());
            if (BlockFragmentTag.Checked.ToString() == "True")
            {
                BlockFragment = true;
            }
            else
            {
                BlockFragment = false;
            }
            //Report.Info("PortScanTag(Default) : " + PortScanTag.Checked.ToString());
            if (PortScanTag.Checked.ToString() == "True")
            {
                PortScan = true;
            }
            else
            {
                PortScan = false;
            }
            //Report.Info("IPFloodDetectTag(Default) : " + IPFloodDetectTag.Checked.ToString());
            if (IPFloodDetectTag.Checked.ToString() == "True")
            {
                PFloodDetect = true;
            }
            else
            {
                PFloodDetect = false;
            }

            if (FirewallProtect && !BlockFragment && PortScan && PFloodDetect)
            {
                Report.Success(" All default settings are valid  and it is as expected ");
            }
            else
            {
                Report.Failure("Some of Firewall_Page_Default_Settings are wrong ");
            }
            Ranorex.DivTag FirewallTag = "/dom[@domain='192.168.0.1']//div[#'IPv4Firewall']";
            Report.Screenshot("Firewall_Page_Default_Settings", FirewallTag.Element);
            Report.Screenshot();

            //Validate.ContainsImage(repo.WebDocument19216801.FmChbxEnableFirewallInfo, FmChbxEnableFirewall_Screenshot1, FmChbxEnableFirewall_Screenshot1_Options);
            Delay.Milliseconds(2);
        }
        public void Choose_IP_Port_Filter_Rules_to_Delete(string argument1, string argument2, string argument3, string argument4, string argument5, string argument6, string argument7, string argument8)
        {
            //This method is to find the rows to delete

            //argument1 - src start IP, argument2-src end IP
            //argument3 - Dest start IP, argument4 - Dest end IP
            //argument5 - src start port, argument6 - src end port
            //argument7 - Dest start port, argument8 - Dest end port

            //Report.Info("---inside Choose_IP_Port_Filter_Rules_to_Delete --- ");
            Delay.Seconds(30);

            WebDocument webDocument = "/dom[@domain='192.168.0.1']";
            //Report.Info(webDocument.GetHtml());

            TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'ipv4FilterTable']");
            //Count the total no of IPv4 port Filter rules (rows)
            IList <TrTag> totalIPv4Rules     = myTable.Find <TrTag>("./tbody//tr");
            int           rulesCount         = totalIPv4Rules.Count;
            string        totalIPv4PortRules = "Total Rules : " + rulesCount.ToString();

            Report.Info("Active IPv4 Port Filter ", totalIPv4PortRules);

            if (rulesCount == 0)
            {
                //Mouse.ScrollWheel(150);
                Report.Failure("IPv4 Port Filter ", "There are no active rules to delete !!");
                TestSuite.Current.GetTestCase("Delete_All_IPv4Port_Filtering_Rules").Checked = false;
                return;
            }
            else
            {
                Report.Info(" IPv4 Port_filter Rules are there to delete !!! ");
                //walkthrough the column values

                /**
                 * IList<TdTag> cols = myTable.Find<TdTag>("./tbody//td");
                 * int colsCount = cols.Count;
                 * Report.Info("Total colsCount",colsCount.ToString());
                 **/
                int     rowNum   = 1;
                int     delCheck = 0;
                Boolean isMatch  = false;
                foreach (var row in totalIPv4Rules)
                {
                    //Report.Info("===========================");
                    //Report.Info("Row: " + rowNum);
                    //Report.Info(row.GetInnerHtml().ToString());
                    IList <TdTag> cols = row.Find <TdTag>("./td");
                    //int colsCount = cols.Count;
                    int    colNum = 1;
                    String newPath = "";
                    String sourceIP = "", destIP = "", sourceStartIP = "", sourceEndIP = "", destStartIP = "", destEndIP = "", protocol = "", srcStartPort = "", srcEndPort = "", destStartPort = "", destEndPort = "", srcportRange = "";
                    foreach (TdTag col in cols)
                    {
                        //Report.Info("Col: " + colNum);
                        //Report.Info("Col Info: "+col.InnerText);
                        if (colNum == 1)
                        {
                            //Report.Info("----------------- Source IP ------ ");
                            //Report.Info(col.GetInnerHtml().ToString());
                            IList <SpanTag> spanVals = col.Find <SpanTag>("./span");
                            //Report.Info("span count :  "+spanVals.Count);

                            foreach (SpanTag spanVal in spanVals)
                            {
                                sourceIP = spanVal.InnerText;
                                //Report.Info("Source IP : " + sourceIP);
                            }

                            int i = sourceIP.IndexOf('-');
                            if (i > 0)
                            {
                                sourceStartIP = sourceIP.Substring(0, i);
                                sourceEndIP   = sourceIP.Substring(i + 1);
                            }
                            else
                            {
                                sourceStartIP = "All";
                                sourceEndIP   = "All";
                            }
                            //Report.Info("-----------------sourceStartIP,sourceEndIP"+sourceStartIP + ";"+sourceEndIP);
                        }
                        else if (colNum == 2)
                        {
                            //Report.Info("----------------- Destination IP ------ ");
                            //Report.Info(col.GetInnerHtml().ToString());
                            IList <SpanTag> spanVals = col.Find <SpanTag>("./span");
                            foreach (SpanTag spanVal in spanVals)
                            {
                                destIP = spanVal.InnerText;
                                //Report.Info("Dest IP : " + destIP);
                            }
                            int i = destIP.IndexOf('-');
                            if (i > 0)
                            {
                                destStartIP = destIP.Substring(0, i);
                                destEndIP   = destIP.Substring(i + 1);
                            }
                            else
                            {
                                destStartIP = "All";
                                destEndIP   = "All";
                            }
                            //Report.Info("-----------------destStartIP,destEndIP"+destStartIP+";"+destEndIP);
                        }
                        else if (colNum == 3)
                        {
                            //Protocol
                            protocol = col.InnerText.ToString();
                            //Report.Info("----------------- Protocol");
                        }
                        else if (colNum == 4)
                        {
                            //source port range - start , end
                            IList <SpanTag> spanVals = col.Find <SpanTag>("./span");
                            foreach (SpanTag spanVal in spanVals)
                            {
                                srcportRange = col.InnerText;
                                Report.Info(srcportRange);
                            }
                            //Report.Info(srcportRange);
                            int i = srcportRange.IndexOf(':');
                            Report.Info("----------------- " + i.ToString());
                            if (i > 0)
                            {
                                srcStartPort = srcportRange.Substring(0, i);
                                srcEndPort   = srcportRange.Substring(i + 1);
                            }
                            else
                            {
                                srcStartPort = "All";
                                srcEndPort   = "All";
                            }
                            //Report.Info("-----------------source port range- start, end"+srcStartPort +";"+srcEndPort );
                        }
                        else if (colNum == 5)
                        {
                            //desinatin port range - start, end
                            String destportRange = col.InnerText.ToString();
                            int    i             = destportRange.IndexOf(':');
                            //Report.Info("----------------- "+i.ToString());
                            if (i > 0)
                            {
                                destStartPort = destportRange.Substring(0, i);
                                destEndPort   = destportRange.Substring(i + 1);
                            }
                            else
                            {
                                destStartPort = "All";
                                destEndPort   = "All";
                            }
                            //Report.Info("-----------------desinatin port range - start, end" + destStartPort + ";"+destEndPort);
                        }
                        else if (colNum == 6)
                        {
                            //enabled or disabled
                            //Report.Info("-----------------enabled or disabled");
                        }
                        else if (colNum == 7)
                        {
                            // check if source ,dest IP addresses and port numbers are matching;if true check the delete box
                            //Report.Info("----------------- click delete checkbox ------");
                            //Report.Info(argument1 + ";"+ argument2 + ";"+argument3 + ";"+argument4 + ";"+argument5 + ";"+argument6 + ";"+argument7 + ";"+argument8);
                            if (sourceStartIP == argument1 && sourceEndIP == argument2 && destStartIP == argument3 && destEndIP == argument4 && srcStartPort == argument5 && srcEndPort == argument6 && destStartPort == argument7 && destEndPort == argument8)
                            {
                                //checking the source ,dest IP addresses and port numbers are matching
                                isMatch = true;
                                Report.Info("=================== match,rule exist ===========");
                                //Report.Info(col.GetInnerHtml().ToString());
                                //Report.Info("Col path: "+col.GetPath().ToString());
                                //	/input[#'ipv4FilterTable-Delete-0']

                                newPath = col.GetPath() + "/input[#'ipv4FilterTable-Delete-" + delCheck + "']";
                                //Report.Info("newPath : "+ newPath);

                                Ranorex.InputTag ipv4FilterTableDeleteTag = newPath;
                                //Report.Info("ipv4FilterTableDeleteTag(Default) : " + ipv4FilterTableDeleteTag.Checked.ToString());

                                if (ipv4FilterTableDeleteTag.Checked.ToString() == "False")
                                {
                                    //Report.Info("----------------- ipv4FilterTableDeleteTag was False ---");
                                    Delay.Seconds(1);
                                    //ipv4FilterTableDeleteTag.Checked = "True";
                                    ipv4FilterTableDeleteTag.PerformClick();
                                }
                                else
                                {
                                    Report.Info(" ipv4FilterTableDeleteTag is already Enabled ");
                                }
                                string rst = "The following IPv4Port_Filtering rule is deleted permanently !!!";
                                Report.Success(rst);
                                Report.Screenshot("IPv4Port_Filtering", row.Element, true);
                            }

                            /*else{
                             *      Report.Info(" ===== This Rule does not exist =====");
                             *      Report.Screenshot("IPv4Port_Filtering",myTable.Element,true);
                             * }*/
                        }

                        colNum++;
                    }                    //end of for-loop: column
                    if (isMatch)
                    {
                        break;
                    }
                    rowNum++;
                    delCheck++;                             //counter to select delete checkbox
                }                                           //end of for-loop: row
                //Report.Info(rowNum + ";"+ rulesCount);
                if ((rowNum - 1) == rulesCount && !isMatch) //if rule does not exist
                {
                    Report.Info(" ===== This Rule does not exist =====");
                    Delay.Seconds(1);
                    Report.Screenshot("IPv4Port_Filtering", myTable.Element, true);
                }

                /*else if((rowNum-1) == rulesCount  && isMatch){
                 *       Report.Info(" ===== This Rule deleted successfully =====");
                 * }*/
            }
        }
        public void Choose_Connected_Device_To_Add_Duplicate_IPAddress(string argument1, string argument2, string argument3, string argument4, string argument5, string argument6)
        {
            ////choose device from the attached list

            //This method is to select any MAC filter rules to delete
            //argument1 - MAC Address0, argument2- MAC Address1
            //argument3 - MAC Address2, argument4 - MAC Address3
            //argument5 - MAC Address4, argument6 - MAC Address5

            Delay.Seconds(30);                  // to load the pages
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";

            webDocument.WaitForDocumentLoaded();
            //Report.Info(webDocument.GetHtml());

            //DHCP lease table

            TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'AttachedDevicesTable']");
            //Count the total no of IPv4 port Filter rules (rows)
            IList <TrTag> totalDHCPClients  = myTable.Find <TrTag>("./tbody//tr");      //Row
            int           rulesCount        = totalDHCPClients.Count;
            string        totalDHCPAttached = "Total Rules : " + rulesCount.ToString();

            Report.Info("Active Attached Devices ", totalDHCPAttached);

            if (rulesCount == 0)
            {
                //Mouse.ScrollWheel(150);
                Report.Failure("DHCP List", "There are no devices to add !!");
                return;
            }
            else
            {
                //if there any rules? then choose appropriate radio button
                Report.Info(" There are " + rulesCount.ToString() + " devices attached to this router  !!! ");
                int rowNum = 1;
                //int addCheck = 1;
                bool   isMatch = false;
                string macAddress = "", macAddress1 = "", IPAddress = "", devName = "", Wifi_Freq = "";
                macAddress = argument1 + ":" + argument2 + ":" + argument3 + ":" + argument4 + ":" + argument5 + ":" + argument6;
                //Report.Info("macAddress",macAddress);
                foreach (var row in totalDHCPClients)
                {
                    //Report.Info("Row: " + rowNum);
                    //Report.Info(row.GetInnerHtml().ToString());
                    IList <TdTag> cols = row.Find <TdTag>("./td");              //column
                    //Report.Info(" Total Columns in the Row : ",cols.Count.ToString());
                    int    colNum          = 1;
                    String radiobuttonPath = "";
                    foreach (TdTag MacCol in cols)
                    {
                        //1- Radiobutton, 2-Device name,3-MAC address,4-IP Address,5-Lease time,6-Connected to
                        //Report.Info("MacCol: " + colNum);
                        //Report.Info("MacCol Info: "+MacCol.InnerText);
                        //Report.Info(MacCol.GetInnerHtml().ToString());
                        if (colNum == 1)
                        {
                            //radio button
                            radiobuttonPath = MacCol.GetPath().ToString();
                            //Report.Info(MacCol.GetInnerHtml().ToString());
                            //Report.Info(radiobuttonPath);
                            //Report.Info("Radio button Path:",radiobuttonPath);
                        }
                        else if (colNum == 2)
                        {
                            //device name
                            devName = MacCol.InnerText;
                        }
                        else if (colNum == 3)
                        {
                            //MAC Address
                            IList <SpanTag> spanVals = MacCol.Find <SpanTag>("./span");
                            //Report.Info("span count :  "+spanVals.Count);
                            foreach (SpanTag spanVal in spanVals)
                            {
                                macAddress1 = spanVal.InnerText;

                                if (macAddress == macAddress1)
                                {
                                    Report.Info("//--------------- MAC address  exist in attached device list------//");
                                    //Report.Info("//---------------  Wifi_Freq -----",Wifi_Freq);
                                    macAddress1 = spanVal.InnerText;
                                    Report.Info("Device Name ", devName);
                                    Report.Info("MAC Address to Add ", macAddress);
                                    isMatch = true;
                                    String newPath = "";
                                    int    radVal  = rowNum - 1;

                                    Report.Info("// rowNum //", rowNum.ToString());         Report.Info("// radVal //", radVal.ToString());
                                    Report.Info("radiobuttonPath : ", radiobuttonPath);

                                    newPath = radiobuttonPath + "/input[@name='attachedDevicesGroup' and @type='radio' and @value='" + radVal + "']";

                                    //below 2 lines added on 18/10/17 for code - 116.400
//				                    /dom[@caption='Hub 3.0' and @page='' and @path='/' and @browsername='IE' and @pageurl='http://192.168.0.1/?dhcp_setting&mid=DHCP']//tbody[#'AttachedDevicesTable_body']/tr[3]/td[1]/input[@name='attachedDevicesGroup']
//				                    newPath ="/dom[@caption='Hub 3.0' and @page='' and @path='/' and @browsername='IE' and @pageurl='http://192.168.0.1/?dhcp_setting&mid=DHCP']//tbody[#'AttachedDevicesTable_body']//input[@type='radio' and @value='"+radVal+"']";
                                    Report.Info("newPath : ", newPath);

                                    Ranorex.InputTag MACFilterAttachedDeviceTag = newPath;

                                    Delay.Seconds(1);
                                    MACFilterAttachedDeviceTag.PerformClick();
                                    Delay.Seconds(1);

                                    string rst = "The following DHCP Client is going to be added to the reserved list !!!";
                                    Report.Info(rst);
                                    Report.Screenshot("DHCP_Reserved_List", row.Element, true);
                                    break;
                                }
                            }                           //end of SpanTag for-loop
                        }
                        else if (colNum == 4)
                        {
                            //Ip Address
                            IPAddress = MacCol.InnerText;
                        }
                        else if (colNum == 6)
                        {
                            // frequency connected to
                            IList <SpanTag> spanVals = MacCol.Find <SpanTag>("./span");
                            foreach (SpanTag spanVal in spanVals)
                            {
                                Wifi_Freq = spanVal.InnerText;
                            }
                        }
                        colNum++;
                    }            //TdTag for-end loop
                                 //Report.Info("TdTag for-end loop");

                    if (isMatch)
                    {
                        //TestSuite.Current.GetTestCase("Collect_MAC_Address").Checked = true;//to receive MAC Address
                        TestSuite.Current.GetTestCase("Collect_Last_Octate_MAC_Address").Checked             = true;            //to receive MAC Address
                        TestSuite.Current.GetTestCase("Add_Duplicate_IPAddress_To_DHCP_Reservation").Checked = true;            //Add_Duplicate_IPAddress_To_DHCP_Reservation
                        Report.Info("Wifi_Freq", Wifi_Freq);
                        if (Wifi_Freq.Trim() == " WI-FI 2.4G")
                        {
                            Report.Info("This device is connected to  WI-FI 2.4G");
                            //choose the device  and click radio button
                            break;
                        }
                        else
                        {
                            Report.Info("This device is NOT connected to  WI-FI 2.4G");
                            break;
                        }
                        //break;
                    }
                    rowNum++;
                }                 //ROW for-end loop
                //Report.Info("ROW for-end loop");

                if (!isMatch)
                {
                    string rst = "The device  with MAC Address : " + "(" + macAddress + ")" + " : is not  attached to this router at this moment ";
                    //Report.Failure("DHCP_Reserved_List"," This device does not  exist in the attached list ");

                    Report.Failure("DHCP_Reserv", rst);
                    //TestSuite.Current.GetTestCase("Collect_MAC_Address").Checked = false;
                    TestSuite.Current.GetTestCase("Collect_Last_Octate_MAC_Address").Checked             = true;  //to receive MAC Address
                    TestSuite.Current.GetTestCase("Add_Duplicate_IPAddress_To_DHCP_Reservation").Checked = false; //Add_Duplicate_IPAddress_To_DHCP_Reservation
                }                                                                                                 //end of if
            }
        }
        public void Choose_Wireless_Device_To_Rename(string argument1, string argument2)
        {
            Report.Info(" ===== Wireless_Device_To_Rename  === " + argument1);

            //		/dom[@domain='192.168.0.1']//table[#'wireless_Device']
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";
            TableTag    myTable     = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'wireless_Device']");

            //count the rows
            IList <TrTag> rows    = myTable.Find <TrTag>("./tbody//tr");
            int           rowsCnt = rows.Count;

            //Report.Info("Total rowsCnt",rowsCnt.ToString());
            Report.Info("Total Rows", rowsCnt.ToString());
            if (rowsCnt == 0)
            {
                //Mouse.ScrollWheel(150);
                Report.Failure("Device Rename ", "There are no connected wireless devices to rename !!");
                TestSuite.Current.GetTestCase("Verify_Renamed_Wireless_Device_Name_In_Home_Screen").Checked = false;
                return;
            }
            else
            {
                //Choose_Wireless_Device_For_Rename
                int     rowNum  = 1;
                Boolean isMatch = false;
                foreach (var row in rows)
                {
                    Report.Info("Row: " + rowNum);
//			        Report.Info(row.GetInnerHtml().ToString());
                    IList <TdTag> cols   = row.Find <TdTag>("./td");
                    int           colCnt = cols.Count;
                    //Report.Info(" Total Columns(Devices)  : ",colCnt.ToString());
                    if (colCnt > 0)
                    {
                        Report.Info(" There are " + colCnt.ToString() + " devices attached to this router  !!! ");
                    }
                    int    colNum     = 1;
                    String devicePath = "";
                    foreach (TdTag MacCol in cols)
                    {
                        Report.Info(" MacCol: " + colNum);
                        //Report.Info("MacCol Info: "+MacCol.InnerText);
//			            Report.Info(MacCol.GetInnerHtml().ToString());

                        IList <PTag> pVals = MacCol.Find <PTag>("./p");
                        Report.Info(" pVals count  : ", pVals.Count.ToString());
                        foreach (PTag pVal in pVals)
                        {
                            string deviceName = pVal.InnerText.Trim();
                            Report.Info(" Device Name " + deviceName);
                            if (argument1.Trim() == deviceName.Trim())
                            {
                                Report.Info("This device name needs to be changed");
                                //devicePath = MacCol.GetPath().ToString();
                                //Report.Info("devicePath",devicePath);
                                devicePath = MacCol.GetPath() + "/p[@innertext='" + deviceName + "']";
//				                /dom[@domain='192.168.0.1']//table[#'wireless_Device']/?/?/tr/td[2]/p[@innertext='android-fc4d149c99a46022']
//				                newPath = col.GetPath() + "/input[#'ipv4FilterTable-Delete-"+delCheck+"']";
//				                newPath = radiobuttonPath + "/input[@name='attachedDevicesGroup' and @type='radio' and @value='"+radVal+"']";
                                Report.Info("devicePath", devicePath);
                                Ranorex.PTag DeviceRenameTag = devicePath;
                                Delay.Seconds(5);
                                DeviceRenameTag.DoubleClick();
                                DeviceRenameTag.PerformClick();
                                //input the new friendly ( argument2) and press "Apply" button
                                repo.WebDocumentIE.FriendlyName.Value = argument2;
//								/dom[@browsername='IE']//table[#'wireless_Device']//td/input[@type='button']
                                String           wireless_Device_applyButton_Path = "/dom[@browsername='IE']//table[#'wireless_Device']//td/input[@type='button']";
                                Ranorex.InputTag wireless_Device = wireless_Device_applyButton_Path;
                                wireless_Device.DoubleClick();
                                wireless_Device.PerformClick();
                                Delay.Seconds(5);
                                Report.Info("---------------before click -------------");
                                repo.WebDocument19216801.WarningWizardFrame0.Button29.Click();                                          //added on 09/05/18 to click YES button in  the popup window 9.1.1802.600
                                Report.Info("----------------after click -----------------");
                                isMatch = true;
                                break;
                            }
                        }

                        colNum++;
                    }
                    rowNum++;
                }
                if ((rowNum - 1) == rowsCnt && !isMatch)                //if device does not exist
                {
                    Report.Info(" ===== This device does not exist =====");
                    //Delay.Seconds(1);
                    //Report.Screenshot("Device Rename",myTable.Element,true);
                    //Report.Screenshot();
                }
            }
        }
        public void Choose_Port_fwd_rule_to_disable(string argument1, string argument2, string argument3, string argument4, string argument5)
        {
            //Implemented based on firmware 9.1.88T or before
            //Report.Info( "--------Inside Delete_A_Port_Fwd_Rule-------");
            //Report.Info( argument1 + "=="+argument2+ "=="+argument3+ "=="+argument4+ "=="+argument5);
            string localIP = "", localStartPort = "", localEndPort = "", externalStartPort = "", externalEndPort = "";

            Delay.Seconds(15);
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";
            TableTag    myTable     = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'PortForwardingTable']"); //R3.11
//            TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'portTriggeringTable']");  //As per R3.5 (9.1.116J)
            IList <TrTag> totalRules = myTable.Find <TrTag>("./tbody//tr");                                                 //count the rows
            int           rulesCount = totalRules.Count;

            if (rulesCount == 0)
            {
                Report.Failure("Port Forwarding ", "There are no active Port Forwarding rules to Disable !!");
                TestSuite.Current.GetTestCase("Disable_A_Port_Forward_Rule").Checked = false;
                return;
            }
            else
            {
                //walkthrough the column values
                IList <TdTag> cols = myTable.Find <TdTag>("./tbody//td");
                bool          isRuleExist = false;
                String        portFwdRule = "";
                int           j = 1, colsCount = cols.Count;
                Report.Info("Total colsCount", colsCount.ToString());

                foreach (TdTag col in cols)
                {
                    //Report.Info(j.ToString());
                    //Report.Info(col.InnerText);
                    if (j == 1)
                    {
                        //Ip Address
                        localIP = col.InnerText;
                        j++;
                    }
                    else if (j == 2)
                    {
                        //Local start port
                        localStartPort = col.InnerText;
                        j++;
                    }
                    else if (j == 3)
                    {
                        //Local end port
                        localEndPort = col.InnerText;
                        j++;
                    }
                    else if (j == 4)
                    {
                        //External start port
                        externalStartPort = col.InnerText;
                        j++;
                    }
                    else if (j == 5)
                    {
                        //External end port
                        externalEndPort = col.InnerText;
                        j++;
                    }
                    else if (j == 6)
                    {
                        //protocol
                        j++;
                    }
                    else if (j == 7)
                    {
                        //if(j == 7 || j == 15 || j == 23) {
                        //perfrom validation
                        if ((localIP == argument1) && (localStartPort == argument2) && (localEndPort == argument3) && (externalStartPort == argument4) && (externalEndPort == argument5))
                        {                               //Enable or Disable ?	//click the disable checkbox
                                                        //WebElement webElement = col.Element;
                                                        //webElement.Click();
                            //Report.Info("Clicked");

                            IList <InputTag> inputVals = col.Find <InputTag>("./input");
                            //Report.Info("input count :  "+inputVals.Count);
                            foreach (InputTag inputVal in inputVals)
                            {                                   //check or uncheck checkbo
                                Ranorex.InputTag testTag = inputVal;
                                //Report.Info(inputVal.GetPath().ToString());
                                if (testTag.Checked.ToString() == "False")
                                {
                                    //False - Currently DISABLED
                                    //Report.Info(" portForwardingTableEnabledTag is already disabled ! ");
                                    //inputVal.PerformClick();
                                    //inputVal.Checked="True";
                                    Report.Log(ReportLevel.Success, "This port forwarding rule is already disabled !!!");
                                    Delay.Seconds(2);
                                    Report.Screenshot("PortForwardingRule", col.Element, true);
                                }
                                else if (testTag.Checked.ToString() == "True")
                                {
                                    //True - Currently ENABLED
                                    Report.Info(" portForwardingTableEnabledTag is currently enabled and it will be disabled soon..!!! ");
                                    //inputVal.DoubleClick();
                                    inputVal.Checked = "False";
                                    Report.Log(ReportLevel.Success, "This port forwarding rule is disabled");
                                    Delay.Seconds(2);
                                    Report.Screenshot("PortForwardingRule", col.Element, true);
                                }
                            }                            //end of  InputTag : for-loop

                            /**
                             * portFwdRule = "localIP :: "+ localIP + "||"+"localStartPort :: "+localStartPort+"||"+"localEndPort :: "+localEndPort+ "||"+"externalStartPort :: "+externalStartPort + "||"+"externalEndPort :: "+externalEndPort;
                             * Report.Log(ReportLevel.Success,"portFwdRule",portFwdRule);
                             * //Report.Info("<---This port forwarding rule is deleted from the list--->");
                             * Report.Log(ReportLevel.Success,"portFwdRule","This port forwarding rule is disabled from the list");
                             **/
                            isRuleExist = true;
                            break;
                        }                        //end of if-else
                        j++;
                    }
                    else if (j == 8)
                    {
                        //delete
                        j = 1;
                    }
                }                //end of for-loop :TdTag
                if (!isRuleExist)
                {
                    portFwdRule = "localIP :: " + argument1 + "||" + "localStartPort :: " + argument2 + "||" + "localEndPort :: " + argument3 + "||" + "externalStartPort :: " + argument4 + "||" + "externalEndPort :: " + argument5;
                    Report.Log(ReportLevel.Failure, "portFwdRule", portFwdRule);
                    Report.Log(ReportLevel.Failure, "portFwdRule", "This port forwarding rule does not exist");
                }
            }//end of if-else:rulesCount
        }
        public void Choose_All_Port_Fwd_Rules_to_Disable()
        {
            // Report.Log(ReportLevel.Info, "Validation", "Validating AttributeEqual (Id='fmCbx-fm-0-1') on item 'WebDocumentIE.FmCbxFm01'.", repo.WebDocumentIE.FmCbxFm01Info);
            // Validate.Attribute(repo.WebDocumentIE.FmCbxFm01Info, "Id", "fmCbx-fm-0-1");

            //uncheck all the Enabled buttons
            //Report.Log(ReportLevel.Info,"Uncheck all the Enabled buttons");
            Delay.Seconds(15);
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";
            TableTag    myTable     = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'PortForwardingTable']"); //R3.11
//            TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'portTriggeringTable']");  //As per R3.5 (9.1.116J)

            //Count the total no of port forwarding rules (rows)
            IList <TrTag> totalRules = myTable.Find <TrTag>("./tbody//tr");
            int           rulesCount = totalRules.Count;
            //Report.Info("Total Rules",rulesCount.ToString());
            string totalPortRules = "Total Rules : " + rulesCount.ToString();

            Report.Info("Port Forwarding ", totalPortRules);

            if (rulesCount > 0)
            {
                // is there are any active rules ??
                //walkthrough the column values
                IList <TdTag> cols      = myTable.Find <TdTag>("./tbody//td");
                int           colsCount = cols.Count;
                int           j         = 1;
                Report.Info("Total colsCount", colsCount.ToString());

                foreach (TdTag col in cols)
                {
                    Report.Info("Column #", j.ToString());
                    Report.Info("Column Value", col.InnerText);

                    /**
                     * if(j == 7) {
                     *      Report.Info("Check box to be disabled");
                     *      //Button okChrome = "/form[@processname='chrome']//button[@text='OK']";
                     *      //okChrome.Click();
                     *      //CheckBox chkBox = "/dom[@domain='192.168.0.1']//b[#'fmCbx-fm-0-1']";
                     *      //chkBox.Uncheck();
                     *      WebElement webElement = webDocument.FindSingle("/dom[@domain='192.168.0.1']//b[#'fmCbx-fm-0-1']");
                     *      Report.Info(webElement.Id.ToString());
                     *      webElement.DoubleClick();
                     * }
                     * j++;
                     * if(j==8) j=1;
                     **/
                    //if(j == 7 || j == 15 || j == 23) {

                    /*
                     * if(j==1){
                     *      // j=1, Local IP
                     *      j++;
                     * }else if(j==2){
                     *              //J=2,Local start port
                     *              //localStartPort = col.InnerText;
                     *              j++;
                     *      }else if(j==3){
                     *              //J=3,Local end port
                     *              //localEndPort = col.InnerText;
                     *              j++;
                     *      }else if(j==4){
                     *              //J=4,External start port
                     *              //externalStartPort = col.InnerText;
                     *              j++;
                     *      }else if(j==5){
                     *              //J=5,External end port
                     *              //externalEndPort = col.InnerText;
                     *              j++;
                     *      }else if(j==6){
                     *              //j=6,protocol
                     *              j++;
                     *      }else */if (j == 7)
                    {
                        //enable or disable ?

                        Report.Info("Enable or Disable ?");

                        /**
                         * WebElement webElement = col.Element;
                         * Report.Info("webElement-Path", webElement.GetPath().ToString());
                         * RxPath path = webElement.GetPath();
                         * string strPath = path.ToString();
                         * //Report.Info(strPath);
                         * Report.Log(ReportLevel.Info,"strPath",strPath);
                         * //Report.Info("Style", col.Headrs());
                         * string colInnerHtml = col.GetInnerHtml();//to get inner HTML
                         * Report.Info("GetInnerHtml",colInnerHtml);
                         *      webElement.Focus();      webElement.Click();
                         **/

                        //strPath = strPath + "/input[@type='checkbox']";
                        //strPath = strPath + "/input[@name='Enabled']";
                        //Report.Log(ReportLevel.Info,"strPath",strPath);
                        //CheckBox chkBox = webDocument.FindSingle<Ranorex.CheckBox>(path);

                        //CheckBox chkBox =	myTable.FindSingle(".//input[@name='Enabled']", 30000);
                        //chkBox.Uncheck();
                        //locate checkbox

                        //path ="/dom[@domain='192.168.0.1']//b[#'fmCbx-fm-0-1']";
                        //CheckBox chkBox = Host.Local.FindSingle<Ranorex.CheckBox>(path);
                        //CheckBox chkBox = webDocument.FindSingle<Ranorex.CheckBox>(".//b[#'fmCbx-fm-0-1']");
                        //Report.Info(chkbox.Checked.ToString());
                        //WebElement webElement1 = repo.WebDocumentIE.Self.FindSingle(path);

                        /*
                         * IList<TdTag> childs = webElement.Find<TdTag>(path);
                         * Report.Info("Total childsCount",childs.Count.ToString());
                         * foreach(TdTag child in childs)
                         * {
                         * //Report.Info(child.TagName);
                         * Report.Info(child.GetPath().ToString());
                         * //Report.Info(child.TagValue);
                         * //Report.Info(child.Id);
                         * //Report.Info(child.Title);
                         * }
                         */
                        /*
                         * if(webElement.Enabled){
                         * webElement.DoubleClick();
                         * //Report.Info("Enabled");
                         * }else{
                         * webElement.Click();
                         * //Report.Info("Disabled");
                         * }
                         */
                        //int x = webElement.ScreenRectangle.X;
                        //int y = webElement.ScreenRectangle.Y;
                        //String cords = x.ToString() + ","+ y.ToString();
                        //Report.Info(cords);

                        IList <InputTag> inputVals = col.Find <InputTag>("./input");
                        Report.Info("input count :  " + inputVals.Count);
                        foreach (InputTag inputVal in inputVals)
                        {
                            Ranorex.InputTag testTag = inputVal;
                            Report.Info(inputVal.GetPath().ToString());
                            if (testTag.Checked.ToString() == "True")
                            {
                                Report.Info(" portForwardingTableEnabledTag is currently enabled ");
                                inputVal.Checked = "False";
                                Delay.Seconds(5);
                                Report.Log(ReportLevel.Success, "This port forwarding rule is disabled now...");
                                Report.Screenshot("PortForwardingRule", col.Element, true);
                            }
                            else
                            {
                                //Report.Info(" portForwardingTableEnabledTag is currently disabled ");
                                //inputVal.PerformClick();
                                //Delay.Seconds(5);
                                Report.Log(ReportLevel.Success, "This port forwarding rule is already disabled !!!");
                                Report.Screenshot("PortForwardingRule", col.Element, true);
                            }
                        }                //end of for-loop

                        j++;             //increment the column
                    }
                    else if (j == 8)
                    {
                        //delete box
                        j = 1;
                    }
                    else
                    {
                        j++;
                    }
                }                 // end of FOR-LOOP :TdTag

                Report.Log(ReportLevel.Success, "The following port forwarding rule(s) are Disabled");
                Delay.Seconds(1);
                //Report.Screenshot();
                Report.Screenshot("PortForwardingRule", myTable.Element, true);
            }
            else
            {
                Report.Failure("Port Forwarding ", "There are no active Port Forwarding rules to Disable !!");
                TestSuite.Current.GetTestCase("Apply_Port_Forward_Changes_Disable_All").Checked = false;
                return;
            }    // end of if-else
        }
Example #22
0
        public void Select_Ipv4_Port_Filter_To_Enable()
        {
            // code to select all the rows in IP Port Filter table

            Report.Info("---inside Select_Ipv4_Port_Filter_To_Enable --- ");

            Delay.Seconds(40);
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";
            //Report.Info(webDocument.GetHtml());

            TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'ipv4FilterTable']");

            //Count the total no of IPv4 port Filter rules (rows)
            IList <TrTag> totalIPv4Rules = myTable.Find <TrTag>("./tbody//tr");
            int           rulesCount     = totalIPv4Rules.Count;
            string        totalPortRules = "Total Rules : " + rulesCount.ToString();

            Report.Info("IPv4 Port Filter ", totalPortRules);

            if (rulesCount == 0)
            {
                //Mouse.ScrollWheel(150);
                Report.Failure("IPv4 Port Filter ", "There are no active IP Port rules to Enable !!");
                TestSuite.Current.GetTestCase("Enable_All_IPv4Port_Filtering_Rules").Checked = false;
                return;
            }
            else
            {
                Report.Info(" There are " + rulesCount.ToString() + " IPv4 Port Filter Rules to Enable !!! ");

                IList <TdTag> cols      = myTable.Find <TdTag>("./tbody//td");
                int           colsCount = cols.Count;
                Report.Info("Total colsCount", colsCount.ToString());
                int j        = 1;
                int delCount = 0;
                int delCheck = 0;
                int rowCount = 1;
                foreach (TdTag MacCol in cols)
                {
                    //Report.Info("------Row : ",rowCount.ToString());
                    //Report.Info("---------Column : ",j.ToString());
                    //Report.Info(MacCol.InnerText);
                    if (j == 6)                         //enable or disable ?
                    //Report.Info("---Checking  enabled box ---");
                    {
                        String newPath = "";
                        //newPath = MacCol.GetPath() + "/input[#'ipv4FilterTable-Enabled-"+delCheck+"']";
                        newPath = "/dom[@domain='192.168.0.1']//input[#'ipv4FilterTable-Enabled-" + delCheck + "']";
                        Ranorex.InputTag IP4PortFilterTableEnabledTag = newPath;
                        if (IP4PortFilterTableEnabledTag.Checked.ToString() == "False")
                        {
                            // IP4PortFilterTableEnabledTag is  disabled ?
                            //Report.Info("----------------- IP4PortFilterTableEnabledTag was false ---");
                            //Delay.Seconds(1);
                            //IP4PortFilterTableEnabledTag.Checked = "True";	//check the checkbox to enable
                            IP4PortFilterTableEnabledTag.PerformClick();
                            Delay.Seconds(1);
                            string rst = "The following MACFilter_Filtering rule is enabled permanently !!!";
                            Report.Success(rst);
                        }
                        else
                        {
                            //IP4PortFilterTableEnabledTag is already enabled
                            Report.Info(" IP4PortFilterTableEnabledTag is already enabled ");
                        }
                        Delay.Seconds(1);
                        //Report.Screenshot("MACFilter_Filtering",macAddress.Element,true);
                        Report.Screenshot("Ip4PortFilter_Filtering", MacCol.Element, true);
                        delCount++;
                        delCheck++;
                    }
                    if (j == 7)                         //delete checkbox?
                    {
                        j = 0;
                        rowCount++;
                    }
                    j++;
                }                //end of for-loop
                if (delCount == rulesCount)
                {
                    // to check whether it selected all rows for enable
                    string rst = "The following " + rulesCount.ToString() + " IP4 Port Filtering rules are enabled permanently !!!";
                    Report.Success(rst);
                    Delay.Seconds(1);
                    Report.Screenshot("Ip4PortFilter_Filtering", myTable.Element, true);
                }
                else
                {
                    Report.Info(" All IP4 Port Filtering rules are not enabled !!! ");
                }
            }           //end of if-else
        }
Example #23
0
        public void Select_Ipv6_Port_Rules(string argument1)
        {
            // code to select all the rows in IPv6 Port Filter table

            //Report.Info("---inside choose_all_ipport_filter_rules_to_delete --- ");
            string selectOption = argument1;

            Report.Info(selectOption);
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";

            webDocument.WaitForDocumentLoaded();
            Report.Info(TotalRows1.ToString());
            if (TotalRows1 <= 5)
            {
                Delay.Seconds(10);              // to load the pages
            }
            else if ((TotalRows1 > 5 && TotalRows1 <= 10))
            {
                Delay.Seconds(15);              // to load the pages
            }
            else if ((TotalRows1 > 10 && TotalRows1 <= 20))
            {
                Delay.Seconds(20);              // to load the pages
            }
            else
            {
                Delay.Seconds(60);              // to load the pages
            }
            //Report.Info(webDocument.GetHtml());
            TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'ipv6FilterTable']");
            //Count the total no of IPv6 port Filter rules (rows)
            IList <TrTag> totalIPv6Rules = myTable.Find <TrTag>("./tbody//tr");
            int           rulesCount     = totalIPv6Rules.Count;
            string        totalPortRules = "Total Rules : " + rulesCount.ToString();

            Report.Info("IPv6 Port Filter ", totalPortRules);
            if (rulesCount == 0)
            {
                //Mouse.ScrollWheel(150);
                Report.Failure("IPv6 Port Filter ", "There are no active rules to delete !!");
                if (selectOption == "DELETE")
                {
                    TestSuite.Current.GetTestCase("Delete_All_IPv6Port_Filtering_Rules").Checked = false;
                }
                else if (selectOption == "DISABLE")
                {
                    TestSuite.Current.GetTestCase("Disable_All_IPv6Port_Filtering_Rules").Checked = false;
                }
                else if (selectOption == "ENABLE")
                {
                    TestSuite.Current.GetTestCase("Enable_All_IPv6Port_Filtering_Rules").Checked = false;
                }
                return;
            }
            else
            {
                //Report.Info(" Rules are there to delete !!! ");
                //walkthrough the column values
                IList <TdTag> cols      = myTable.Find <TdTag>("./tbody//td");
                int           colsCount = cols.Count;
//				Report.Info("Total colsCount",colsCount.ToString());
                int  j            = 1;
                int  delCount     = 0;                  //for delete
                int  delCheck     = 0;                  //for disable
                bool noFilterRule = false;
                foreach (TdTag ipv6Col in cols)
                {
//					Report.Info(ipv6Col.InnerText);
//					Report.Info("j(before IF)   : " + j);
                    if (colsCount == 1 && ipv6Col.InnerText.StartsWith("No filtering rule applied!"))
                    {
                        Report.Info("There are No filtering rule to Delete");
                        noFilterRule = true;
                        break;
                        //return;
                    }
                    else if (j == 3)
                    {
                        //Protocol
                        if (ipv6Col.InnerText.ToString() != null)
                        {
                            String protocol = ipv6Col.InnerText.ToString();
//			                    Report.Info("----------------- Protocol : " + protocol);
                        }
                    }
                    else if ((j == 7) && (selectOption == "DISABLE"))
                    {
                        Report.Info("---Check for  DISABLE  ---");
                        //Report.Info("---Checking  enabled box ---");
                        String newPath = "";
                        //newPath = MacCol.GetPath() + "/input[#'ipv4FilterTable-Enabled-"+delCheck+"']";
                        newPath = "/dom[@domain='192.168.0.1']//input[#'ipv6FilterTable-Enabled-" + delCheck + "']";
                        Ranorex.InputTag IP6PortFilterTableEnabledTag = newPath;
                        if (IP6PortFilterTableEnabledTag.Checked.ToString() == "True")
                        {
                            // IP4PortFilterTableEnabledTag is already Enabled
                            Report.Info("----------------- IP6PortFilterTableEnabledTag was True ---");
                            IP6PortFilterTableEnabledTag.Checked = "False";                     //uncheck the checkbox to disable
                            Delay.Seconds(1);
                            string rst = "The following IPv6PortFilter_Filtering rule is disabled now !!!";
                            Report.Success(rst);
                        }
                        else
                        {
                            //IP4PortFilterTableEnabledTag.PerformClick();	//to enable
                            //IP4PortFilterTableEnabledTag is already disabled
                            Report.Info(" IPv6PortFilterTableEnabledTag is already disabled ");
                        }
                        //Report.Screenshot("MACFilter_Filtering",macAddress.Element,true);
                        Report.Screenshot("IPv6PortFilter_Filtering", ipv6Col.Element, true);
                        Delay.Seconds(1);
                        //j=0;
                        delCount++;
                        delCheck++;
                    }
                    else if ((j == 7) && (selectOption == "ENABLE"))
                    {
                        Report.Info("---Check for  ENABLE  ---");
                        //Report.Info("---Checking  enabled box ---");
                        String newPath = "";
                        //newPath = MacCol.GetPath() + "/input[#'ipv4FilterTable-Enabled-"+delCheck+"']";
                        newPath = "/dom[@domain='192.168.0.1']//input[#'ipv6FilterTable-Enabled-" + delCheck + "']";
                        Ranorex.InputTag IP6PortFilterTableEnabledTag = newPath;
                        if (IP6PortFilterTableEnabledTag.Checked.ToString() == "False")
                        {
                            // IP6PortFilterTableEnabledTag is  disabled ?
                            //Report.Info("----------------- IP6PortFilterTableEnabledTag was false ---");
                            //Delay.Seconds(1);
                            //IP6PortFilterTableEnabledTag.Checked = "True";	//check the checkbox to enable
                            IP6PortFilterTableEnabledTag.PerformClick();
                            Delay.Seconds(1);
                            string rst = "The following IP6PortFilter_Filtering rule is enabled permanently !!!";
                            Report.Success(rst);
                        }
                        else
                        {
                            //IP6PortFilterTableEnabledTag is already enabled
                            Report.Info(" IP6PortFilterTableEnabledTag is already enabled ");
                        }
                        Delay.Seconds(1);
                        Report.Screenshot("Ip6PortFilter_Filtering", ipv6Col.Element, true);
                        delCount++;
                        delCheck++;
                    }
                    else if ((j == 8) && (selectOption == "DELETE"))
                    {
                        Report.Info("---Check for  delete  ---");
                        WebElement webElement = ipv6Col.Element;
                        Delay.Seconds(2);
                        webElement.Click();
                        Report.Screenshot("Delete Ipv6_Port", webElement, true);
                        //j=0;
                        delCount++;
                    }
                    else if (j == 9)                            //inbound or outbound
                    {
                        j = 0;
                    }
//					Report.Info("j(after IF)   : " + j);
                    j++;
                }
                if (noFilterRule)
                {
                    return;
                }
                if (delCount == rulesCount)
                {
                    // to check whether it selected all rows for deletion/disable
                    string rst = "";
                    if (selectOption == "DELETE")
                    {
                        rst = "The following " + rulesCount.ToString() + " IPv6Port_Filtering rules are deleted permanently !!!";
                    }
                    else if (selectOption == "DISABLE")
                    {
                        rst = "The following " + rulesCount.ToString() + " IPv6Port_Filtering rules are disabled permanently !!!";
                    }
                    Report.Success(rst);
                    Report.Screenshot("IPv6Port_Filtering", myTable.Element, true);
                    //Report.Screenshot("Delete PortFwd",webElement,true);
                }
                else
                {
                    if (selectOption == "DELETE")
                    {
                        Report.Info(" All rows are not deleted !!! ");
                    }
                    else if (selectOption == "DISABLE")
                    {
                        Report.Info(" All rows are not disabled !!! ");
                    }
                }
            }
        }
Example #24
0
        public void Choose_All_Devices_From_MAC_List_To_Delete_2_4GHz_Primary()
        {
            //delete all devices that belongs to 2_4GHz_Primary
            if (TotalRows1 <= 5 || TotalRows2 <= 5)
            {
                Delay.Seconds(5);               // to load the pages
            }
            else if ((TotalRows1 > 5 && TotalRows1 <= 10) || (TotalRows2 > 5 && TotalRows2 <= 10))
            {
                Delay.Seconds(10);              // to load the pages
            }
            else if ((TotalRows1 > 10 && TotalRows1 <= 20) || (TotalRows2 > 10 && TotalRows2 <= 20))
            {
                Delay.Seconds(20);              // to load the pages
            }
            else
            {
                Delay.Seconds(30);              // to load the pages
            }
            //Delay.Seconds(30);
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";
            //Report.Info(webDocument.GetHtml());
            TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'macAddressFilterTable']");
            //Count the total no of IPv4 port Filter rules (rows)
            IList <TrTag> totalMACListDevices   = myTable.Find <TrTag>("./tbody//tr");
            int           rulesCount            = totalMACListDevices.Count;
            string        totalMACFilterDevices = "Total Rules : " + rulesCount.ToString();

            Report.Info("Active Devices ", totalMACFilterDevices);

            if (rulesCount == 0)
            {
                //Mouse.ScrollWheel(150);
                Report.Failure("MAC Filter Devices ", "There are no devie to delete !!");
                TestSuite.Current.GetTestCase("Delete_All_Devices_From_MAC_Filter_List_2_4GHz_Pmry_Wireless").Checked = false;
                return;
            }
            else if (rulesCount == 1)
            {
                //walkthrough the column values
                IList <TdTag> cols = myTable.Find <TdTag>("./tbody//td");
                int           colsCount = cols.Count, colCnt = 1, delCheck = 0;;
                string        noFilterStr = null;
                //Report.Info("colsCount",colsCount.ToString());
                string Wireless_radio = "";
                foreach (TdTag col in cols)
                {
                    if (colsCount == 1)                         ////No filtering device!
                    {
                        noFilterStr = col.InnerText.ToString();
                        //Report.Info(noFilterStr.ToString());
                        //if(noFilterStr.StartsWith("No filtering")){
                        if (noFilterStr.StartsWith("You have not selected a device to filter. Please select a device from the attached devices list."))
                        {
                            Report.Failure("MAC Filter Devices ", "There are no devie to delete !!");
                            TestSuite.Current.GetTestCase("Delete_All_Devices_From_MAC_Filter_List_2_4GHz_Pmry_Wireless").Checked = false;
                            return;
                        }
                    }
                    else                        //only one rule exist
                    //Report.Info("Only one MAC Filter rule exist,now !!!");
                    {
                        if (colCnt == 3)
                        {
                            IList <SpanTag> spanVals = col.Find <SpanTag>("./span");
                            //Report.Info("span count :  "+spanVals.Count);

                            foreach (SpanTag spanVal in spanVals)
                            {
                                Wireless_radio = spanVal.InnerText;
                                Report.Info("Wireless_radio  : " + Wireless_radio);
                            }
                            //Report.Info("Wireless_radio",Wireless_radio);
                            Report.LogHtml(ReportLevel.Info, Wireless_radio, "<b>Wireless_radio frequency</b>");
                        }
                        else if (colCnt == 4)
                        {
                            if (Wireless_radio == "2.4GHz")
                            {
                                //Report.Info("----------------- click delete checkbox ------");
                                String newPath = "", colPath = "";
                                colPath = col.GetPath().ToString();
                                Report.Info("colpath -->" + colPath);
                                newPath = colPath + "/input[#'macAddressFilterTable-Delete-" + delCheck + "']";
                                Ranorex.InputTag MACFilterTableDeleteTag = newPath;
                                if (MACFilterTableDeleteTag.Checked.ToString() == "False")
                                {
                                    //Report.Info("----------------- MACFilterTableDeleteTag was False ---");
                                    Delay.Seconds(1);
                                    MACFilterTableDeleteTag.Click();
                                    MACFilterTableDeleteTag.PerformClick();
                                    MACFilterTableDeleteTag.Checked = "Checked";
                                    Delay.Seconds(1);
                                }
                                else
                                {
                                    Report.Info(" MACFilterTableDeleteTag is already checked  ");
                                }
                                string rst = "The following MACFilter_Filtering rule is deleted permanently !!!";
                                Report.Success(rst);
                                Report.Screenshot("MACFilter_Filtering", col.Element, true);
                            }
                            else
                            {
                                Report.Info(" Different wireless radio frequency(5GHz) devices are added in the list ! ");
                            }
                        }
                        colCnt++;
                    }                   //end of if-else
                }                       //end of forloop:TdTag
            }
            else
            {
                Report.Info(" There are " + rulesCount.ToString() + " MAC filter list !!! ");

                int rowNum   = 1;
                int delCheck = 0;

                foreach (var row in totalMACListDevices)
                {
                    Report.Info("Row: " + rowNum);
                    //walkthrough the column values
                    //IList<TdTag> cols = myTable.Find<TdTag>("./tbody//td");
                    IList <TdTag> cols      = row.Find <TdTag>("./td");
                    int           colsCount = cols.Count;
//					Report.Info("Total colsCount",colsCount.ToString());
                    int    j = 1;                       //column number
                    string Wireless_radio = "";
                    foreach (TdTag col in cols)
                    {
//						Report.Info("col number: " + j);
                        //Report.Info("col.InnerText",col.InnerText);

                        /*
                         * if(j==3){
                         *      //Wireless radio
                         *      //Wireless_radio = col.InnerText;
                         *      String wirelessRadioPath = "";
                         *      wirelessRadioPath = col.GetPath().ToString();
                         *      Report.Info("wirelessRadioPath",wirelessRadioPath);
                         *      //find span tag
                         * }else **/
                        if (j == 3)
                        {
                            //Wireless_radio = col.InnerText;
                            IList <SpanTag> spanVals = col.Find <SpanTag>("./span");
                            //Report.Info("span count :  "+spanVals.Count);

                            foreach (SpanTag spanVal in spanVals)
                            {
                                Wireless_radio = spanVal.InnerText;
                                Report.Info("Wireless_radio  : " + Wireless_radio);
                            }
                            //Report.Info("Wireless_radio",Wireless_radio);
//							 Report.LogHtml(ReportLevel.Info,Wireless_radio,"<b>Wireless_radio frequency</b>");
                        }
                        else if (j == 4)
                        {
                            if ((Wireless_radio == "2.4GHz") || (Wireless_radio == "2.4 GHz"))                                  //updated on 17/10/17  based on SON code - 116.400

                            /*
                             * WebElement webElement = col.Element;
                             * Delay.Seconds(2);
                             * webElement.Click();
                             * Report.Screenshot("Delete MACFilterDevices",webElement,true);
                             * Report.Info("Delete Checkbox Clicked");
                             * j=0;
                             */
                            //Delay.Seconds(5);
                            //Report.Info("----------------- click delete checkbox ------");
                            //Report.Info("Wireless_radio",Wireless_radio);
                            //if(macAddress == macAddress1){
                            //isMatch = true;
                            //Report.Info("----------------- Rules Matches !!! ------");
                            {
                                String newPath = "", colPath = "";
                                colPath = col.GetPath().ToString();
                                //Report.Info("col Path ", colPath);
                                //newPath = col.GetPath() + "/input[#'macAddressFilterTable-Delete-"+delCheck+"']";	//fmChbx-macAddressFilterTable-Delete-0
                                //macAddressFilterTable-Delete-0
                                newPath = colPath + "/input[#'macAddressFilterTable-Delete-" + delCheck + "']";

                                //newPath = "/dom[@domain='192.168.0.1']//input[#'macAddressFilterTable-"+delCheck+"']";
                                //dom[@domain='192.168.0.1']//input[#'macAddressFilterTable-Delete-0']
                                //Report.Info("newPath ", newPath);
                                Ranorex.InputTag MACFilterTableDeleteTag = newPath;
                                if (MACFilterTableDeleteTag.Checked.ToString() == "False")
                                {
                                    Report.Info("----------------- MACFilterTableDeleteTag was False ---");
                                    Delay.Seconds(1);
                                    MACFilterTableDeleteTag.Click();
                                    MACFilterTableDeleteTag.PerformClick();
                                    MACFilterTableDeleteTag.Checked = "Checked";
                                    Delay.Seconds(1);
                                }
                                else
                                {
                                    Report.Info(" MACFilterTableDeleteTag is already marked for deletion ");
                                }
                                string rst = "The following MACFilter_Filtering rule is deleted permanently !!!";
                                Report.Success(rst);
                                Report.Screenshot("MACFilter_Filtering", col.Element, true);


                                //	}
                            }
                            else
                            {
                                Report.Info(" Different wireless radio frequency ");
                            }   //end of IF-ELSE : Wireless_radio frequency
                        }
                        j++;    //column number
                    }           //end of foreach - column
                    rowNum++;
                    delCheck++; //counter to select delete checkbox
                }               //end of foreach - row
                TestSuite.Current.GetTestCase("Delete_All_Devices_From_MAC_Filter_List_2_4GHz_Pmry_Wireless").Checked = true;
            }                   //end of if-else
        }                       //end of function
        public void Choose_Port_forwarding_rule_to_disable(string argument1, string argument2, string argument3, string argument4, string argument5)
        {
            //Implemented based on R3.5(9.1.116J) GUI
            //argument1- LocalIP,argument2-Localstart,argument3-Localend,argument4-Externalstart,argument5-ExternalEnd
            string localIP = "", localPortRange = "", local_Start_End_Port_Range = "", externalPortRange = "", external_Start_End_Port_Range = "";

            Delay.Seconds(15);
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";
            TableTag    myTable     = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'PortForwardingTable']"); //R3.11
//            TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'portTriggeringTable']");  //As per R3.5 (9.1.116J)

            //Count the total no of port forwarding rules (rows)
            IList <TrTag> totalRules = myTable.Find <TrTag>("./tbody//tr");
            int           rulesCount = totalRules.Count;
            //Report.Info("Total Rules",rulesCount.ToString());
            string totalPortRules = "Total Rules : " + rulesCount.ToString();

            //Report.Info("Port Forwarding ",totalPortRules);

            if (rulesCount > 0)
            {
                Report.Info("Total Rules", totalPortRules);
                IList <TdTag> cols = myTable.Find <TdTag>("./tbody//td");
                bool          isRuleExist = false;
                String        portFwdRule = "";
                int           j = 1, colsCount = cols.Count;
                Report.Info("Total colsCount", colsCount.ToString());

                foreach (TdTag col in cols)
                {
                    Report.Info(col.InnerText);

                    if (j == 1)                         //Ip Address
                    {
                        localIP = col.InnerText;
                        j++;
                    }
                    else if (j == 2)                            //Local Port range
                    //Local start & end port
                    //localStartPort = col.InnerText;
                    {
                        localPortRange             = col.InnerText;
                        local_Start_End_Port_Range = argument2 + "-" + argument3;
                        j++;
                    }
                    else if (j == 3)                    //External start & end port
                    //externalStartPort = col.InnerText;
                    {
                        externalPortRange             = col.InnerText;
                        external_Start_End_Port_Range = argument4 + "-" + argument5;
                        j++;
                    }
                    else if (j == 4)                    //protocol
                    {
                        j++;
                    }
                    else if (j == 5)                            //enable or disable ?
                    //Report.Info("Enable or Disable ?");
                    {
                        if ((localIP == argument1) && (localPortRange == local_Start_End_Port_Range) && (externalPortRange == external_Start_End_Port_Range))
                        {
                            IList <InputTag> inputVals = col.Find <InputTag>("./input");
                            //Report.Info("input count :  "+inputVals.Count);
                            foreach (InputTag inputVal in inputVals)
                            {
                                Ranorex.InputTag testTag = inputVal;
                                Report.Info(inputVal.GetPath().ToString());
                                if (testTag.Checked.ToString() == "True")
                                {
                                    Report.Info(" portForwardingTableEnabledTag is currently enabled ");
                                    inputVal.Checked = "False";
                                    Delay.Seconds(10);
                                    Report.Log(ReportLevel.Success, "This port forwarding rule is disabled now...");
                                    Report.Screenshot("PortForwardingRule", col.Element, true);
                                }
                                else
                                {
                                    //Report.Info(" portForwardingTableEnabledTag is currently disabled ");
                                    Delay.Seconds(10);
                                    Report.Log(ReportLevel.Success, "This port forwarding rule is already disabled !!!");
                                    Report.Screenshot("PortForwardingRule", col.Element, true);
                                }
                            }                            //end of for-loop : InputTag
                            isRuleExist = true;
                            break;
                        }                        //end of if-else :
                        j++;                     //increment the column
                    }
                    else if (j == 6)             //delete check box
                    {
                        j = 1;
                    }
                }        //end of for-loop :TdTag
                if (!isRuleExist)
                {
                    portFwdRule = "localIP :: " + argument1 + "||" + "localStartPort :: " + argument2 + "||" + "localEndPort :: " + argument3 + "||" + "externalStartPort :: " + argument4 + "||" + "externalEndPort :: " + argument5;
                    Report.Log(ReportLevel.Failure, "portFwdRule", portFwdRule);
                    Report.Log(ReportLevel.Failure, "portFwdRule", "This port forwarding rule does not exist");
                }
            }
            else
            {
                Report.Failure("Port Forwarding ", "There are no active Port Forwarding rules to Disable !!");
                //TestSuite.Current.GetTestCase("Apply_Port_Forward_Changes_Disable_All").Checked = false;
                TestSuite.Current.GetTestCase("Disable_Any_Port_Forward_Rule").Checked = false;
                return;
            }
        }
        public void Choose_Any_IP4Port_Filtering_To_Disable(string argument1, string argument2, string argument3, string argument4, string argument5, string argument6, string argument7, string argument8)
        {
            //choose P4Port_Filtering rules to disable

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

            webDocument.WaitForDocumentLoaded();
            TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'ipv4FilterTable']");

            //count the rows
            IList <TrTag> rows    = myTable.Find <TrTag>("./tbody//tr");
            int           rowsCnt = rows.Count;

            //Report.Info("Total rowsCnt",rowsCnt.ToString());
            Report.Info("Total Rules", rowsCnt.ToString());

            if (rowsCnt > 0)     //if there are any rules exist ?
            {
                Report.Info("There are  active IP4Port_Filtering rules to disable");
                int rowNum = 1;
                //int enableCheck = 0;
                foreach (var row in rows)
                {
                    var    cells = row.FindDescendants <TdTag>();
                    int    colNum = 1;
                    string srcRangeIP = "", dstRangeIP = "", srcRange_Start_End_IP = "", dstRange_Start_End_IP = "", protocol = "", srcPortRange_Start_End = "", dstPortRange_Start_End = "", srcPorts = "", dstPorts = "";
                    //string srcRangeStart_IP="" , srcRangeEnd_IP="", dstRangeStart_IP="", dstRangeEnd_IP="";
                    // string srcPortRange_Start="",srcPortRange_End="",dstPortRange_Start="",dstPortRange_End="";

                    //Report.Info("cells count",cells.Count.ToString());	//count columns in a row

                    foreach (var cell in cells)
                    {
                        //Report.Info("Cell: " + cell.InnerText);
                        if (cells.Count == 1 && cell.InnerText.StartsWith("No triggering rule"))
                        {
                            Report.Failure("There are no active IP4Port_Filtering to disable !!!");
                            Report.Screenshot("IPv4 Port Filter ", myTable.Element, true);
                            TestSuite.Current.GetTestCase("Apply_Changes_To_Any_IPv4Port_Filtering_Disable").Checked = false;
                            break;
                        }
                        else
                        {
                            if (colNum == 1)
                            {
                                //Source address - combination of start and end IP
                                IList <SpanTag> spanVals = cells[0].Find <SpanTag>("./span");
                                //Report.Info("colNum1 span count :  "+spanVals.Count);
                                foreach (SpanTag spanVal in spanVals)
                                {
                                    srcRangeIP = spanVal.InnerText;
                                    //Report.Info("srcRangeIP: " + srcRangeIP);
                                    //srcRangeStart_IP="";
                                    //srcRangeEnd_IP="";
                                    srcRange_Start_End_IP = argument1 + "-" + argument2;
                                    //Report.Info(srcRange_Start_End_IP);
                                }
                            }
                            else if (colNum == 2)
                            {
                                //Destination address - combination of start and end IP
                                IList <SpanTag> spanVals = cells[1].Find <SpanTag>("./span");
                                //Report.Info("colNum2 span count :  "+spanVals.Count);
                                foreach (SpanTag spanVal in spanVals)
                                {
                                    dstRangeIP = spanVal.InnerText;
                                    //Report.Info("dstRangeIP: " + dstRangeIP);
                                    //dstRangeStart_IP="";
                                    //dstRangeEnd_IP="";
                                    dstRange_Start_End_IP = argument3 + "-" + argument4;
                                    //Report.Info(dstRange_Start_End_IP);
                                }
                            }
                            else if (colNum == 3)
                            {
                                //Protocol
                                protocol = cell.InnerText;
                                //Report.Info("protocol",protocol);
                            }
                            else if (colNum == 4)
                            {
                                //Source port - combination of start and end IP
                                srcPorts = cell.InnerText;
                                //Report.Info("srcPorts",srcPorts);
                                //srcPortRange_Start="";
                                //srcPortRange_End="";
                                srcPortRange_Start_End = argument5 + ":" + argument6;
                                //Report.Info(srcPortRange_Start_End);
                            }
                            else if (colNum == 5)
                            {
                                //Destination port
                                dstPorts = cell.InnerText;
                                //Report.Info("dstPorts",dstPorts);
                                //dstPortRange_Start="";
                                //dstPortRange_End="";
                                dstPortRange_Start_End = argument7 + ":" + argument8;
                                //Report.Info(dstPortRange_Start_End);
                            }
                            else if (colNum == 6)
                            {
                                //enabled or disabled?
                                //Report.Info("Check for enabled or disabled? ");
                                if (srcRangeIP == srcRange_Start_End_IP && dstRangeIP == dstRange_Start_End_IP && srcPorts == srcPortRange_Start_End && dstPorts == dstPortRange_Start_End)
                                {
                                    Report.Success("This IP4Port_Filtering rule is exist in the list");
                                    IList <InputTag> inputVals = cells[5].Find <InputTag>("./input");
                                    Report.Info("input count :  " + inputVals.Count);
                                    foreach (InputTag inputVal in inputVals)
                                    {
                                        Ranorex.InputTag testTag = inputVal;
                                        //Report.Info(inputVal.GetPath().ToString());
                                        if (testTag.Checked.ToString() == "True")
                                        {
                                            Report.Info(" pIP4Port_FilteringTableEnabledTag is currently enabled ");
                                            //inputVal.DoubleClick();
                                            inputVal.Checked = "False";
                                            Delay.Seconds(5);
                                            Report.Log(ReportLevel.Success, "This IP4Port_Filtering rule is disabled");
                                            Report.Screenshot("IP4Port_Filtering", row.Element, true);
                                        }
                                        else
                                        {
                                            Report.Info(" IP4Port_FilteringTableEnabledTag is currently disabled ");

                                            /*
                                             * inputVal.PerformClick();
                                             * Delay.Seconds(5);
                                             */
                                            Report.Log(ReportLevel.Success, "This IP4Port_Filtering rule is disabled");
                                            Report.Screenshot("IP4Port_Filtering", row.Element, true);
                                        }
                                    }
                                }
                            }                     //colNum==7				//Delete
                        }                         //end of if-else
                        colNum++;
                    }                             //end of for-loop column : cells
                    rowNum++;
                }
                Report.Info("// The following IP4Port_Filtering rule(s) are disabled from the list //");
                Report.Screenshot();
            }
            else
            {
                Report.Failure("IPv4 Port Filter ", "There are no active IP Port Filtering rules to Disable !!");
                Report.Screenshot("IPv4 Port Filter ", myTable.Element, true);
                TestSuite.Current.GetTestCase("Apply_Changes_To_Any_IPv4Port_Filtering_Disable").Checked = false;
                return;
            }
        }
Example #27
0
        public void Choose_all_port_forward_rules_to_delete()
        {       //Implemented based on R3.5 ( 9.1.116J)
            //Delay.Seconds(15);
            Report.Info("inside Choose_all_port_forward_rules_to_delete");
            Report.Info(" TotalRows : " + TotalRows);
            if (TotalRows < 10)
            {
                Delay.Seconds(30);
            }
            else if (TotalRows > 10 && TotalRows < 20)
            {
                Delay.Seconds(40);
            }
            else if (TotalRows > 20 && TotalRows < 30)
            {
                Delay.Seconds(50);
            }
            else if (TotalRows > 30)
            {
                Delay.Seconds(60);
            }
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";

            webDocument.WaitForDocumentLoaded();
            //TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'PortForwardingTable']");
            TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'portForwardingTable']");  //As per R3.5 (9.1.116J)

            //Count the total no of port forwarding rules (rows)
            IList <TrTag> totalRules = myTable.Find <TrTag>("./tbody//tr");
            int           rulesCount = totalRules.Count;
            //Report.Info("Total Rules",rulesCount.ToString());
            string totalPortRules = "Total Rules : " + rulesCount.ToString();
            //Report.Info("Port Forwarding ",totalPortRules);
            bool isRuleExist = true;

            if (rulesCount > 0)
            {
                //Report.Info("Total Rules",totalPortRules);
                // is there are any active rules ??
                //walkthrough the column values
                IList <TdTag> cols      = myTable.Find <TdTag>("./tbody//td");
                int           colsCount = cols.Count;
                int           j         = 1;
                //Report.Info("Total colsCount",colsCount.ToString());
                foreach (TdTag col in cols)
                {
                    Report.Info("Column #", j.ToString());
                    //Report.Info("Column Value",col.InnerText);
                    //if(j == 1 && col.InnerText.StartsWith("No forwarding rule!")){	//9.1.116u
                    if (j == 1 && col.InnerText.StartsWith("No forwarding rule applied!"))              //9.1.116v(R3.7.1)
//						Report.Failure("PortForwardingRule","There are no active port forwarding rules to delete !!");
                    {
                        Report.Success("PortForwardingRule", "There are no active port forwarding rules to delete !!");
                        TestSuite.Current.GetTestCase("Delete_All_Port_Forward_Rules").Checked = false;
                        isRuleExist = false;
                        //return;
                        break;
                    }
                    if (j == 6)
                    {
                        //delete ?
                        //Report.Info("Deleting this port forward rule ?");
                        IList <InputTag> inputVals = col.Find <InputTag>("./input");
                        //Report.Info("input count :  "+inputVals.Count);
                        foreach (InputTag inputVal in inputVals)
                        {
                            Ranorex.InputTag testTag = inputVal;
                            Report.Info(inputVal.GetPath().ToString());
                            if (testTag.Checked.ToString() == "False")
                            {
                                Report.Info(" portForwardingTableDeleteTag is currently  not seleted to delete");
                                //inputVal.Checked="True";
                                inputVal.PerformClick();
                                Delay.Seconds(5);
                                Report.Log(ReportLevel.Success, "This port forwarding rule is  selected for deletion...");
                                Report.Screenshot("PortForwardingRule", col.Element, true);
                            }
                            else
                            {
                                //Report.Info(" portForwardingTableEnabledTag is currently enabled ");
                                //inputVal.PerformClick();
                                Delay.Seconds(5);
                                Report.Log(ReportLevel.Success, "This port forwarding rule is already selected for deletion !!!");
                                Report.Screenshot("PortForwardingRule", col.Element, true);
                            }
                        }                //end of for-loop : InputTag
                        j = 0;;          //reselt the column
                    }
                    j++;
                }                // end of FOR-LOOP :TdTag

                //Report.Log(ReportLevel.Success,"The following port forwarding rule(s) are deleted");

                if (isRuleExist)
                {
                    string finalRst = "The following " + rulesCount.ToString() + " Port Forwarding Rules are deleted from the table";
                    //Report.Log(ReportLevel.Success,finalRst);
                    Report.Success(finalRst);
                }
                else
                {
                    //Report.Log(ReportLevel.Failure,"There are no active rules to delete !!!");
//					Report.Failure("There are no active rules to delete !!!");
                    Report.Success("There are no active rules to delete !!!");
                }
                Delay.Seconds(1);
                //Report.Screenshot();
                Report.Screenshot("PortForwardingRule", myTable.Element, true);
            }
            else
            {
                Report.Failure("Port Forwarding ", "There are no active Port Forwarding rules to Delete !!");
                TestSuite.Current.GetTestCase("Delete_All_Port_Forward_Rules").Checked = false;
                return;
            }    // end of if-else
        }
        public void Choose_All_DHCP_Reserved_Rules_To_Delete()
        {
            //This method is to select all the filter rules to delete
            Delay.Seconds(40);
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";

            webDocument.WaitForDocumentLoaded();
            //Report.Info(webDocument.GetHtml());
            TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'dhcpClientsTable']");
            //Count the total no of DHCP Reserved rules (rows)
            IList <TrTag> totalDHCPList         = myTable.Find <TrTag>("./tbody//tr");
            int           rulesCount            = totalDHCPList.Count;
            string        totalDHCPReservedList = "Total Rules : " + rulesCount.ToString();

            Report.Info("Active MAC  Filter Rules ", totalDHCPReservedList);

            if (rulesCount == 0)
            {
                //Mouse.ScrollWheel(150);
                Report.Failure("DHCP Reserved List ", "There are no active reservation list(s) to delete !!");
                TestSuite.Current.GetTestCase("Confirm_To_Delete_All_From_DHCP_Reservation").Checked = false;
                return;
            }
            else
            {
                Report.Info(" There are " + rulesCount.ToString() + " DHCP Reservation list(s) to delete !!! ");
                //walkthrough the column values

                IList <TdTag> cols      = myTable.Find <TdTag>("./tbody//td");
                int           colsCount = cols.Count;
                Report.Info("Total colsCount", colsCount.ToString());
                int j = 1, delCount = 0, delCheck = 0;

                foreach (TdTag MacCol in cols)
                {
                    //Report.Info("Column",j.ToString());
                    //Report.Info(MacCol.InnerText);
                    string macAddress = "", ipAddress = "";
                    if (j == 1 && (MacCol.InnerText.ToString().StartsWith("No reserved rule")))                         //No reserved rule! --R3.7
                    //Report.Info("No MAC filtering rule exists !!!");
                    {
                        Report.Failure("MAC Filter ", "There are No DHCP Reservation list to delete !!");
                        TestSuite.Current.GetTestCase("Confirm_To_Delete_All_From_DHCP_Reservation").Checked = false;
                        Delay.Seconds(1);
                        Report.Screenshot("DHCP Reserved List", myTable.Element, true);
                        return;
                    }
                    else if (j == 1 && !(MacCol.InnerText.ToString().StartsWith("No reserved rule")))
                    {
                        //macAddress
                        macAddress = MacCol.InnerText.ToString();
                        //Report.Info("macAddress",macAddress);
                    }
                    else if (j == 2)
                    {
                        //Report.Info(MacCol.InnerText);
                        //macAddress = MacCol;
                        ipAddress = MacCol.InnerText.ToString();
                        //Report.Info("ipAddress",ipAddress.ToString());
                    }
                    else if (j == 3)
                    {
                        //Report.Info("---Checked  delete box ---");

                        /*
                         * WebElement webElement = MacCol.Element;
                         * Delay.Seconds(2);
                         * webElement.Click();
                         * Report.Screenshot("Delete MACFilter",webElement,true);
                         */
                        //Report.Info(MacCol.GetInnerHtml().ToString());
                        //Report.Info("MacCol path: "+MacCol.GetPath().ToString());

                        String newPath = "";
                        newPath = MacCol.GetPath() + "/input[#'dhcpClientsTable-Delete-" + delCheck + "']";
                        //Report.Info("newPath : "+ newPath);

                        Ranorex.InputTag DHCPClientsTableDeleteTag = newPath;
                        // Report.Info("DHCPClientsTableDeleteTag(Default) : " + DHCPClientsTableDeleteTag.Checked.ToString());
                        if (DHCPClientsTableDeleteTag.Checked.ToString() == "False")
                        {
                            //Report.Info("----------------- DHCPClientsTableDeleteTag was False ---");
                            Delay.Seconds(1);
                            DHCPClientsTableDeleteTag.PerformClick();
                        }
                        else
                        {
                            //Report.Info("----------------- DHCPClientsTableDeleteTag was True ---");
                            Report.Info(" DHCPClientsTableDeleteTag is already Enabled ");
                        }
                        string rst = "The following DHCP Reserved List is selected to delete permanently !!!";
                        Report.Success(rst);
                        Delay.Seconds(2);
                        Report.Screenshot("DHCP Reserved List", MacCol.Element, true);
                        //Report.Screenshot("DHCP Reserved List",myTable.Element,true);
                        Delay.Seconds(2);
                        j = 0;
                        delCount++;
                        delCheck++;
                    }
                    j++;
                }                       //end of TdTag for-loop

                if (delCount == rulesCount)
                {
                    // to check whether it selected all rows for deletion
                    string rst = "All the " + rulesCount.ToString() + " DHCP Reserved List(s) are deleted permanently !!!";
                    Report.Success(rst); Delay.Seconds(2);
                    Report.Screenshot("DHCP Reserved List", myTable.Element, true);
                }
                else
                {
                    Report.Info(" All rows are not deleted !!! ");
                }
            }
        }       //end of method Choose_All_DHCP_Reserved_Rules_To_Delete()
        public void Choose_Attached_DHCPv6_Device_To_Reserved_List(string argument1, string argument2, string argument3, string argument4, string argument5, string argument6, string argument7)
        {
            //choose IPv6 devices to reserve
            ////choose device from the attached list
            //This method is to select any MAC filter rules to delete
            //argument1 - MAC Address1, argument2- MAC Address2
            //argument3 - MAC Address3, argument4 - MAC Address4
            //argument5 - MAC Address5, argument6 - MAC Address6
            //argument7 - Device Name

            Delay.Seconds(30);                  // to load the pages
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";

            webDocument.WaitForDocumentLoaded();
            //Report.Info(webDocument.GetHtml());

            //DHCP lease table

            TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'AttachedDevicesTable']");
            //Count the total no of IPv4 port Filter rules (rows)
            IList <TrTag> totalDHCPClients  = myTable.Find <TrTag>("./tbody//tr");              //Row
            int           rulesCount        = totalDHCPClients.Count;
            string        totalDHCPAttached = "Total Rules : " + rulesCount.ToString();

            Report.Info("Active Attached Devices ", totalDHCPAttached);

            if (rulesCount == 0)
            {
                //Mouse.ScrollWheel(150);
                Report.Failure("DHCP List", "There are no devices to add !!");
                return;
            }
            else
            {
                //if there any rules? then choose appropriate radio button
                Report.Info(" There are " + rulesCount.ToString() + " devices attached to this router  !!! ");
                int rowNum = 1;
                //int addCheck = 1;
                Boolean isMatch = false, isMacAddressMatch = false;
                string  macAddress = "", macAddress1 = "", IPAddress = "", devName = "", Wifi_Freq = "";
                string  IPAddressSubStr = "";
                macAddress = argument1 + ":" + argument2 + ":" + argument3 + ":" + argument4 + ":" + argument5 + ":" + argument6;

                foreach (var row in totalDHCPClients)
                {
                    Report.Info("Row : " + rowNum);
//					Report.Info(row.GetInnerHtml().ToString());
                    IList <TdTag> cols = row.Find <TdTag>("./td");                      //column
                    Report.Info(" Total Columns in the Row : ", cols.Count.ToString());

                    int    colNum          = 1;
                    String radiobuttonPath = "";
//					Ranorex.InputTag MACFilterAttachedDeviceTag = null;
//					String newPath = "";
                    foreach (TdTag MacCol in cols)
                    {
                        //1- Radiobutton, 2-Device name,3-MAC address,4-IP Address,5-Lease time,6-Connected to
                        Report.Info("MacCol: " + colNum);
//						Report.Info("MacCol Info: "+MacCol.InnerText);

                        if (colNum == 1)
                        {
                            radiobuttonPath = MacCol.GetPath().ToString();
                        }
                        else if (colNum == 2)
                        {
                            devName = MacCol.InnerText;
                            Report.Info("devName : " + devName);
                        }
                        else if (colNum == 3)                           //MAC Address

                        {
                            IList <SpanTag> spanVals = MacCol.Find <SpanTag>("./span");
                            //Report.Info("span count :  "+spanVals.Count);
                            foreach (SpanTag spanVal in spanVals)
                            {
                                macAddress1 = spanVal.InnerText;
                                if (macAddress == macAddress1)
                                {
                                    Report.Info(" The device with MAC Address -  " + macAddress1 + "  - is attached to the Hub");
//									Report.Info(" Wifi_Freq  : ",Wifi_Freq);
//									Report.Info("Device Name : ", devName);
//									Report.Info("MAC Address to Add :", macAddress1);
                                    isMacAddressMatch = true;

                                    /*
                                     * //									isMatch = true;
                                     * String newPath = "";
                                     * int radVal = rowNum -1;
                                     * newPath = radiobuttonPath + "/input[@name='attachedDevicesGroup' and @type='radio' and @value='"+radVal+"']";
                                     * Ranorex.InputTag MACFilterAttachedDeviceTag = newPath;
                                     * //									MACFilterAttachedDeviceTag = newPath;
                                     * Report.Info("MACFilterAttachedDeviceTag PATH :  ", newPath);
                                     *
                                     * //									Delay.Seconds(1);
                                     * MACFilterAttachedDeviceTag.PerformClick();	//MACFilterAttachedDeviceTag.Checked = "True";
                                     * //MACFilterAttachedDeviceTag.TagValue ="2";
                                     * Delay.Seconds(1);
                                     * //									string rst = "The following DHCP Client is added to the reserved list !!!";Report.Success(rst);
                                     * Report.Success("The following DHCP Client is added to the reserved list !!!");
                                     * Report.Screenshot("DHCP_Reserved_List",MacCol.Element,true);
                                     * //Report.Screenshot("DHCP_Reserved_List",row.Element,true);
                                     * //break;
                                     */
                                }
                            }
                        }
                        else if (colNum == 4)                           //Ip Address
                        {
                            IPAddress = MacCol.InnerText;
                            //check if the IP Address is IPv6 type,if yes then click the radio button
                            Report.Info(" IPAddress : " + IPAddress);
//							Report.Info(" IPAddress length : " + IPAddress.Length);
                            if (IPAddress.Length <= 0)
                            {
                                Report.Failure("InValid IPv4/v6 Address");
                            }
                            else if (IPAddress.Length > 0)
                            {
                                Report.Info(" IPAddressLength : " + IPAddress.Length);
                                IPAddressSubStr = IPAddress.Substring(0, IPAddress.Length - 3);
                                Report.Info("IPAddressSubStr : " + IPAddressSubStr);
                            }
                            //parse the IPv4 address
                            Boolean CheckIPAddress = this.CheckIPv4AddressValid(IPAddressSubStr.Trim());

                            if (CheckIPAddress)
                            {
                                Report.Success("Valid IP v4/v6 Address");
                                int isIPv4 = IPAddressSubStr.IndexOf('.');
//								Report.Info(isIPv4.ToString());

                                if (isIPv4 == -1)                                // it is IPv6
                                {
                                    if (isMacAddressMatch)
                                    {
                                        isMatch = true;
                                        Report.Info("It is IPv6 ");
                                        //choose the device and add to the reserve list
                                        String newPath = "";
                                        int    radVal  = rowNum - 1;
                                        newPath = radiobuttonPath + "/input[@name='attachedDevicesGroup' and @type='radio' and @value='" + radVal + "']";
                                        Ranorex.InputTag MACFilterAttachedDeviceTag = newPath;
                                        Report.Info("MACFilterAttachedDeviceTag PATH :  ", newPath);
                                        Delay.Seconds(1);
                                        MACFilterAttachedDeviceTag.Click();
                                        MACFilterAttachedDeviceTag.PerformClick();
                                        Delay.Seconds(2);
                                        Report.Screenshot("DHCPv6_Reserved_List", MacCol.Element, true);
                                        Report.Success("The DHCPv6 Client is added to the reserved list !!!");
                                    }
                                }
                                else
                                {
                                    Report.Info("It is IPv4 ");
                                }
                            }
                            else
                            {
                                //IPAddress is v6
                                Report.Failure("InValid IPv4/v6 Address");
                            }
                        }
                        else if (colNum == 6)                           // frequency connected to
                        //IList<SpanTag> spanVals = MacCol.Find<SpanTag>("./span");
                        //foreach(SpanTag spanVal in spanVals){
                        //Wifi_Freq = spanVal.InnerText;
                        //}
                        {
                            Wifi_Freq = MacCol.InnerText;
//							Report.Info("Wifi_Freq : " + Wifi_Freq);

                            /*
                             * if(isMatch){
                             *      break;
                             * } */
                        }

                        colNum++;
                    }                           //end of forloop - cols
                    if (isMatch)                //is device attached and radio button clicked ??
                    {
                        Report.Info("Wifi_Frequency : ", Wifi_Freq);
                        if (Wifi_Freq.Trim().StartsWith("Wi-Fi 2.4G"))
                        {
                            Report.Info("This device is connected to  WI-FI 2.4G");
                            //choose the device  and click radio button
                            break;
                        }
                        else if (Wifi_Freq.Trim().StartsWith("Wi-Fi 5G"))
                        {
                            Report.Info("This device is connected to  WI-FI 5G");
                            break;
                        }
                        else if (Wifi_Freq.Trim().StartsWith("Ethernet"))
                        {
                            Report.Info("This device is connected to  Ethernet");
                            break;
                        }
                        else
                        {
                            Report.Info("This device is NOT connected to  WI-FI 2.4G /WI-FI 5G");
                            break;
                        }
                        //break;
                    }

                    rowNum++;
                }                       //end of forloop - totalDHCPClients

                if (!isMatch)
                {
                    string rst = "The device : " + devName + "(" + macAddress + ")" + " does not  exist in the attached list ";
                    Report.Failure("DHCPv6_Reserved_List", rst);
                    TestSuite.Current.GetTestCase("Add_Device_To_DHCPv6_Reserved_List").Checked = false;                        //Add_Device_To_DHCP_Reserved_List
                }
                else
                {
                    TestSuite.Current.GetTestCase("Add_Device_To_DHCPv6_Reserved_List").Checked = true; //Add_Device_To_DHCP_Reserved_List
                }
            }                                                                                           //end of if-else
        }                                                                                               //end of method
        public void Delete_Any_Port_Forward_Rule(string argument1, string argument2, string argument3, string argument4, string argument5)
        {
            //Delete any fort forwarding rules, implemented based on R3.5(9.1.116J)
            //argument1- LocalIP,argument2-Localstart,argument3-Localend,argument4-Externalstart,argument5-ExternalEnd
            string localIP = "", localPortRange = "", local_Start_End_Port_Range = "", externalPortRange = "", external_Start_End_Port_Range = "";

            Delay.Seconds(15);
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";
            TableTag    myTable     = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'PortForwardingTable']");
//            TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'portTriggeringTable']");  //As per R3.5 (9.1.116J)

            //Count the total no of port forwarding rules (rows)
            IList <TrTag> totalRules = myTable.Find <TrTag>("./tbody//tr");
            int           rulesCount = totalRules.Count;
            //Report.Info("Total Rules",rulesCount.ToString());
            string totalPortRules = "Total Rules : " + rulesCount.ToString();

            if (rulesCount > 1)
            {
                Report.Info("Port Forwarding ", totalPortRules);
            }

            if (rulesCount > 0)
            {
                //Report.Info("Total Rules",totalPortRules);
                IList <TdTag> cols = myTable.Find <TdTag>("./tbody//td");
                bool          isRuleExist = false;
                String        portFwdRule = "";
                int           j = 1, colsCount = cols.Count;
                //Report.Info("Total colsCount",colsCount.ToString());

                foreach (TdTag col in cols)
                {
                    //Report.Info(col.InnerText);

                    //check if there any rows
                    if (j == 1 && col.InnerText.StartsWith("No forwarding rule!"))
                    {
                        //Report.Failure("PortForwardingRule","There are no active port forwarding rules to delete !!");
                        TestSuite.Current.GetTestCase("Delete_Any_Port_Forward_Rule").Checked = false;
                        isRuleExist = false;
                        //return;
                        break;
                    }
                    if (j == 1)                         //Ip Address
                    {
                        localIP = col.InnerText;
                        j++;
                    }
                    else if (j == 2)                            //Local Port range
                    //Local start & end port
                    //localStartPort = col.InnerText;
                    {
                        localPortRange             = col.InnerText;
                        local_Start_End_Port_Range = argument2 + "-" + argument3;
                        j++;
                    }
                    else if (j == 3)                    //External start & end port
                    //externalStartPort = col.InnerText;
                    {
                        externalPortRange             = col.InnerText;
                        external_Start_End_Port_Range = argument4 + "-" + argument5;
                        j++;
                    }
                    else if (j == 4)                    //protocol
                    {
                        j++;
                    }
                    else if (j == 5)                //enable or disable ?
                    {
                        j++;                        //increment the column
                    }
                    else if (j == 6)                //delete check box
                    {
                        if ((localIP == argument1) && (localPortRange == local_Start_End_Port_Range) && (externalPortRange == external_Start_End_Port_Range))
                        {
                            IList <InputTag> inputVals = col.Find <InputTag>("./input");
                            //Report.Info("input count :  "+inputVals.Count);
                            foreach (InputTag inputVal in inputVals)
                            {
                                Ranorex.InputTag testTag = inputVal;
                                Report.Info(inputVal.GetPath().ToString());
                                if (testTag.Checked.ToString() == "True")
                                {
                                    Report.Info(" portForwarding rule is already selected for deletion ");
                                    //inputVal.Checked="False";
                                    Delay.Seconds(5);
                                    //Report.Log(ReportLevel.Success,"This port forwarding rule is deleted now...");
                                    Report.Screenshot("PortForwardingRule", col.Element, true);
                                }
                                else
                                {
                                    Report.Info(" portForwarding rule is currently not selected ");
                                    Delay.Seconds(5);
                                    inputVal.Checked = "True";                                          //check the port forwarding delete box

                                    /*
                                     * //below 3 lines added on 18-10-17
                                     * Report.Info("3 lines begining");
                                     * Ranorex.InputTag PortFwdTableDeleteTag = "/dom[@caption='Hub 3.0' and @page='' and @path='/' and @browsername='IE' and @pageurl='http://192.168.0.1/?portforwarding&mid=PortForwarding']//input[#'portForwardingTable-Delete-7'] ";
                                     * PortFwdTableDeleteTag.Click();
                                     * PortFwdTableDeleteTag.PerformClick();
                                     */
                                    Report.Screenshot();
                                    Delay.Seconds(5);
                                    Report.Log(ReportLevel.Success, "This port forwarding rule is selected for deletion !!!");
                                    //	Report.Screenshot("PortForwardingRule",col.Element,true);
                                }
                            }                            //end of for-loop : InputTag
                            isRuleExist = true;
                            break;
                        }                        //end of if-else :
                        j = 1;
                    }
                }        //end of for-loop :TdTag
                if (!isRuleExist)
                {
                    if (colsCount == 1)
                    {
                        Report.Failure("Port Forwarding ", "There are no active Port Forwarding rules to Delete !!");
                        //TestSuite.Current.GetTestCase("Apply_Port_Forward_Changes_Disable_All").Checked = false;
                        TestSuite.Current.GetTestCase("Delete_Any_Port_Forward_Rule").Checked = false;
                        return;
                    }
                    else
                    {
                        portFwdRule = "localIP :: " + argument1 + "||" + "localStartPort :: " + argument2 + "||" + "localEndPort :: " + argument3 + "||" + "externalStartPort :: " + argument4 + "||" + "externalEndPort :: " + argument5;
                        Report.Log(ReportLevel.Failure, "portFwdRule", portFwdRule);
                        Report.Log(ReportLevel.Failure, "portFwdRule", "This port forwarding rule does not exist");
                    }
                }
            }
            else
            {
                Report.Failure("Port Forwarding ", "There are no active Port Forwarding rules to Delete !!");
                //TestSuite.Current.GetTestCase("Apply_Port_Forward_Changes_Disable_All").Checked = false;
                TestSuite.Current.GetTestCase("Delete_Any_Port_Forward_Rule").Checked = false;
                return;
            }
        }