public void Choose_Connected_DHCP_Device(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;
                Boolean 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;
                                    newPath = radiobuttonPath + "/input[@name='attachedDevicesGroup' and @type='radio' and @value='" + radVal + "']";

                                    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 with another IP Address !!!";
                                    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

                    if (isMatch)
                    {
                        TestSuite.Current.GetTestCase("Add_Duplicate_Device_To_DHCP_Reservation").Checked = true;                       //Add_Duplicate_Device_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;
                    }
                    else
                    {
                        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_Reserved_List", rst);
                        TestSuite.Current.GetTestCase("Add_Duplicate_Device_To_DHCP_Reservation").Checked = false; //Add_Duplicate_Device_To_DHCP_Reservation
                    }                                                                                              //end of if-else
                    rowNum++;
                    //addCheck++;	//counter to select add checkbox
                }                 //ROW for-end loop
            }
        }
Пример #2
0
        public void Validate_Connected_Device_Name(string argument1)
        {
            //check if the device name is shown in connceted devices list
            Report.Info("Inside Validate_Connected_Device_Name ");
            Delay.Seconds(20);
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";
            TableTag    myTable     = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'AttachedDevicesTable']"); //R3.8

            Report.Screenshot("Devices Connected", myTable.Element, true);                                                   // print the devices table

            //Count the rows(total no of devices)
            IList <TrTag> rows      = myTable.Find <TrTag>("./tbody//tr");
            int           rowsCount = rows.Count;

            Report.Info("Total Devices Connected", rowsCount.ToString());
            if (rowsCount == 0)
            {
                //Mouse.ScrollWheel(150);
                Report.Failure("Device Rename ", "There are no connected wireless devices to rename !!");

                return;
            }
            else
            {
                int     rowNum = 1;
                Boolean isWirelessMatch = false, isEthernetMatch = false;
                int     wirelessCnt = 0, ethernetCnt = 0, connectCount = 0;
                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;
                    int           colNum = 1;
                    string        deviceName = "", connectionType = "";
                    foreach (TdTag MacCol in cols)
                    {
                        Report.Info("MacCol: " + colNum);
                        Report.Info("MacCol Info: " + MacCol.InnerText);
                        Report.Info(MacCol.GetInnerHtml().ToString());

                        //column1 - device name
                        //column5 - Wi-Fi 2.4G _VM0365087_2G  / Wi-Fi 5G _VM0365087_5G / Ethernet
                        if (colNum == 1)
                        {
                            deviceName = MacCol.InnerText.Trim();
                        }
                        else if (colNum == 5)
                        {
                            connectionType = MacCol.InnerText.Trim();
                            Report.Info(" deviceName : " + deviceName + "and " + "connectionType  : " + connectionType);
                            if (argument1.Trim() == deviceName.Trim())
                            {
//								isConnected = true;
                                connectCount++;
//								Report.Info("connectionType  : " + connectionType);
                                Report.Success("  Device :  " + deviceName + " is in connected list ");
//			                    if(connectionType.StartsWith("Wi-Fi")){
//			                    if(connectionType.StartsWith("Wireless frequency")){	//added on 02/11/17 to test code 9.1.116.600
                                if ((connectionType.StartsWith("Wi-Fi")) || (connectionType.StartsWith("Wireless frequency")))                                          //  added on 15/01/18 to test code 9.1.116.604
                                {
                                    Report.Success(" Wireless Connected  Device Name  is Successfull");
                                    isWirelessMatch = true;
                                    wirelessCnt++;
                                    break;
                                }
                                else                                    //failure condition
                                {
                                    Report.Info("Ethernet  Device Name ");
                                    isEthernetMatch = true;
                                    ethernetCnt++;
                                }
                            }                           /*else{
                                                         * //								Report.Info(" The Device " + argument1 + " is not connected again " );
                                                         * //								Report.Failure("The Device " + argument1 + " is not connected again ");
                                                         * //								isConnected = false;
                                                         * }//end of IF-deviceName
                                                         */
                        }                               //end of if-else : column5

                        colNum++;
                    }
                    rowNum++;
                }                       //end of iF-ELSE row
                if (isWirelessMatch)
                {
                    Report.Info("wirelessCnt", wirelessCnt.ToString());
                    if (wirelessCnt == 1)
                    {
                        Report.Info(" One device exist in conencted device table and it is connected via Wireless network ");
                    }
                    else
                    {
                        Report.Info(" Multiple devices exist in conencted device table and it is  Connected via Wireless network ");
                    }
                }
                if (isEthernetMatch)
                {
                    Report.Info("ethernetCnt", ethernetCnt.ToString());
                    if (ethernetCnt == 1)
                    {
                        Report.Info("One  device is connected via ethernet  ");
                    }
                    else
                    {
                        Report.Info("More than one device is connected via Ethernet");
                    }
                }
                if (connectCount > 0)
                {
                    Report.Success(" The Device " + argument1 + " is connected to the CPE ");
                }
                else
                {
                    Report.Failure(" The Device " + argument1 + " is not yet connected ");
                }
                Report.Screenshot();
            }                   //end of IF-ELSE
        }
Пример #3
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_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 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()
Пример #6
0
        public void Verify_Device_Info_IPv6(string argument1, string argument2, string argument3, string argument4, string argument5, string argument6)
        {
            //Standard specification compliant : argument1
            //Hardware version : argument2
            //Software version : argument3
            //Cable modem serial number : argument4
            //Network access : argument5
            //Cable MAC address : argument6
            Report.Info(" INSIDE  Verify_Device_Info_IPv6   ");
            Duration newDuration = new Duration(240000);

            repo.WebDocument19216801.DivButtonsInfo.WaitForExists(newDuration);

            //-----  Hub3.0 device info ----//
            //Hardware version, software ver,Cable Mac,cable modem serial number, system up time, netork access

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

            webDocument.WaitForDocumentLoaded();
//			Report.Info(webDocument.GetHtml());
            TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'Hub 3.0 device information']/table");
            //Count the total no of rows
            IList <TrTag> totalDeviceRows     = myTable.Find <TrTag>("./tbody//tr");
            int           rulesCount          = totalDeviceRows.Count;
            string        totalDeviceInfoRows = rulesCount.ToString() + " : Rows :";

            Report.Info(" Hub 3.0 device information ", totalDeviceInfoRows);

            if (rulesCount == 0)
            {
                //Mouse.ScrollWheel(150);
                Report.Failure("Device Info ", "There are no active Hub 3.0 device information !!");
                return;
            }
            else
            {
                Report.Info(" There are " + totalDeviceInfoRows + " in Hub 3.0 device information !!! ");
                int    rowNum = 1;
                string devInfo = "", devInfoCol1 = "", deviceInfo = "", devInfoSubstr = "";
                foreach (var row in totalDeviceRows)
                {
                    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);
                        if (colNum == 1)
                        {
                            devInfoCol1 = MacCol.InnerText;
                            //Report.Info("Col1 Info: "+MacCol.InnerText);
                            //Report.Info("Col1 Info: " + devInfoCol1);
                        }
                        if (colNum == 2)
                        {
                            IList <SpanTag> spanVals = MacCol.Find <SpanTag>("./span");
                            foreach (SpanTag spanVal in spanVals)
                            {
                                devInfo = spanVal.InnerText;
                                if (devInfo.Length > 0)
                                {
                                    devInfoSubstr = devInfo.Substring(1, devInfo.Length - 1);                                   // for validation purpose
                                }
                                else
                                {
                                    //blank
                                    devInfoSubstr = "";
                                }
                                //Report.Info(  "	devInfoSubstr   " + devInfoSubstr);
                            }
                            //Report.Info("Col2 Info: "+devInfo);
                            deviceInfo = devInfoCol1 + "		"+ devInfo;
                            //Report.Info( devInfoCol1 + "		" + devInfo);
                            Report.Info(deviceInfo);
                            //Report.LogHtml(ReportLevel.Info, "deviceInfo", "<a>deviceInfo</a>");

                            //perform Hub 3.0 device information validation here
                            //Standard specification compliant : DOCSIS 3.0
                            //Hardware version : 10
                            //Software version : 9.1.116V
                            //Cable MAC address : C0:05:C2:00:24:1B
                            //Cable modem serial number : AAAP51770041
                            //System up time : 0 days 17h:38m:47s
                            //Network access : Allowed
                            if (rowNum == 1)
                            {
                                //Standard specification compliant
                                if (devInfoSubstr.Length == 0)
                                {
                                    Report.Failure("	Standard specification compliant  is BLANK 	");
                                }
                                else if (devInfoSubstr.Trim().Equals(argument1.Trim()))
                                {
                                    Report.Success("	Standard specification compliant  	"+ " PASS");
                                }
                                else
                                {
                                    Report.Failure("	Standard specification compliant  	"+ " FAIL");
                                }
                            }
                            else if (rowNum == 2)
                            {
                                //Hardware Version
                                if (devInfoSubstr.Length == 0)
                                {
                                    Report.Failure("	Hardware Version  is BLANK 	");
                                }
                                else if (devInfoSubstr.Trim() == argument2.Trim())
                                {
                                    Report.Success("	Hardware Version  	"+ " PASS");
                                }
                                else
                                {
                                    Report.Failure("	Hardware Version  	"+ " FAIL");
                                }
                            }
                            else if (rowNum == 3)
                            {
                                //Software Version
                                if (devInfoSubstr.Length == 0)
                                {
                                    Report.Failure("	Software Version  is BLANK 	");
                                }
                                else if (devInfoSubstr.Trim() == argument3.Trim())
                                {
                                    Report.Success("	Software Version  	"+ " PASS");
                                }
                                else
                                {
                                    Report.Failure("	Software Version  	"+ " FAIL");
                                }
                            }
                            else if (rowNum == 4)
                            {
                                //MAC Address - C0:05:C2:00:24:1B
                                if (devInfoSubstr.Length == 0)
                                {
                                    Report.Failure("	MAC Address  is BLANK 	");
                                }
                                else if (devInfoSubstr.Trim() == argument6.Trim())
                                {
                                    Report.Success("	MAC Address  	"+ " PASS");
                                }
                                else
                                {
                                    Report.Failure("	MAC Address  	"+ " FAIL");
                                }
                            }
                            else if (rowNum == 5)
                            {
                                //Cable modem serial number
                                if (devInfoSubstr.Length == 0)
                                {
                                    Report.Failure("	Cable modem serial number  is BLANK 	");
                                }
                                else if (devInfoSubstr.Trim() == argument4.Trim())
                                {
                                    Report.Success("	Cable modem serial number  	"+ " PASS");
                                }
                                else
                                {
                                    //validate Cable modem serial number
                                    Report.Failure("	Cable modem serial number  	"+ " FAIL");
                                }
                            }
                            else if (rowNum == 6)
                            {
                                //System up time
                                if (devInfoSubstr.Length == 0)
                                {
                                    Report.Failure("	System uptime  is BLANK 	");
                                }
                                else
                                {
                                    //Validate system time format
                                    //Report.Info("Need to Validate system time format");
                                    //Report.Failure("	System up time      " + " FAIL");
                                }
                            }
                            else if (rowNum == 7)
                            {
                                //Network access
                                if (devInfoSubstr.Length == 0)
                                {
                                    Report.Failure("	Network access  is BLANK 	");
                                }
                                else if (devInfoSubstr.Trim() == argument5.Trim())
                                {
                                    Report.Success("	Network access  	"+ " PASS");
                                }
                                else
                                {
                                    Report.Failure("	Network access  	"+ " FAIL");
                                }
                            }
                        }
                        colNum++;
                    }    // end of COLUMN for-loop
                    rowNum++;
                }        //end of totalDeviceRows for-loop
            }            //end if IF-ELSE


            //-------------------------- WANIPSettingInfo - MAC Address ------------------------------//

            // /dom[@page='' and @path='/' and @browsername='IE' and @pageurl='http://192.168.0.1/?device_status&mid=Info']//div[#'WANIPSettingInfo}}']/table
            //MAC address
            TableTag myTable3 = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'WANIPSettingInfo}}']/table");
            //Count the total no of rows
            IList <TrTag> totalDeviceRows3     = myTable3.Find <TrTag>("./tbody//tr");
            int           rulesCount3          = totalDeviceRows3.Count;
            string        totalDeviceInfoRows3 = rulesCount3.ToString() + " : Rows :";

            Report.Info(" Hub 3.0 WANIPSettingInfo  ", totalDeviceInfoRows3);
            if (rulesCount3 == 0)
            {
                //Mouse.ScrollWheel(150);
                Report.Failure("Device Info ", "There are no WAN IP information !!");
                return;
            }
            else
            {
                Report.Info(" There are " + totalDeviceInfoRows3 + " in Hub 3.0 WANIPSettingInfo !!! ");
                int    rowNum3 = 1;
                string WANIPInfo3 = "", WANIPInfoCol3 = "", WANInfo3 = "", WANIPInfoSubstr3 = "";
                foreach (var row in totalDeviceRows3)
                {
                    Report.Info("Row: " + rowNum3);
                    Report.Info(row.GetInnerHtml().ToString());
                    IList <TdTag> cols = row.Find <TdTag>("./td");
                    //Report.Info(" Total Column ", cols.Count.ToString());
                    int colNum3 = 1;
                    foreach (TdTag MacCol in cols)
                    {
                        Report.Info("MacCol: " + colNum3);
                        if (colNum3 == 1)
                        {
                            WANIPInfoCol3 = MacCol.InnerText;
                            Report.Info("Col1 Info: " + WANIPInfoCol3);
                        }
                        else if (colNum3 == 2)
                        {
                            IList <SpanTag> spanVals = MacCol.Find <SpanTag>("./span");
                            foreach (SpanTag spanVal in spanVals)
                            {
                                WANIPInfo3       = spanVal.InnerText;
                                WANIPInfoSubstr3 = WANIPInfo3.Substring(1, WANIPInfo3.Length - 1);                              // for validation purpose
//								Report.Info(  "	WANIPInfoSubstr     " + WANIPInfoSubstr1);
                            }
                            WANInfo3 = WANIPInfoCol3 + "		"+ WANIPInfo3;
                            Report.Info(WANInfo3);
                            if (rowNum3 == 1)
                            {
                                //MAC Address - C0:05:C2:CF:14:9D
                                if (WANIPInfoSubstr3.Length == 0)
                                {
                                    Report.Failure("	MAC Address  is BLANK 	");
                                }
                                else if (WANIPInfoSubstr3.Trim() != argument6.Trim())
                                {
                                    Report.Success("	MAC Address  	"+ " PASS");
                                }
                                else
                                {
                                    Report.Failure("	MAC Address  	"+ " FAIL");
                                }
                            }
                        }
                        colNum3++;
                    }    // end of COLUMN for-loop
                    rowNum3++;
                }        //end of ROW for-loop : totalDeviceRows4
            }            //end if IF-ELSE	: WAN IP settings -Info



            //------------------------------------- WAN IP settings - IPv6 Info -----------------------------------------------------//

            // IPv6 address, default gateway,IPv6 lease time, IPv6 lease expire, IPv6 DNS server
            TableTag myTable1 = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'WANIPv6Info']/table");
            //Count the total no of rows
            IList <TrTag> totalDeviceRows1     = myTable1.Find <TrTag>("./tbody//tr");
            int           rulesCount1          = totalDeviceRows1.Count;
            string        totalDeviceInfoRows1 = rulesCount1.ToString() + " : Rows :";

            Report.Info(" Hub 3.0 WAN IPv6 information  ", totalDeviceInfoRows1);

            if (rulesCount1 == 0)
            {
                //Mouse.ScrollWheel(150);
                Report.Failure("Device Info ", "There are no WAN IP information !!");
                return;
            }
            else
            {
                Report.Info(" There are " + totalDeviceInfoRows1 + " in Hub 3.0 WAN IPv6 information !!! ");
                int    rowNum1 = 1;
                string WANIPInfo1 = "", WANIPInfoCol1 = "", WANInfo1 = "", WANIPInfoSubstr1 = "";
                foreach (var row in totalDeviceRows1)
                {
                    Report.Info("Row: " + rowNum1);
                    Report.Info(row.GetInnerHtml().ToString());
                    IList <TdTag> cols = row.Find <TdTag>("./td");
                    //Report.Info(" Total Column ", cols.Count.ToString());
                    int colNum1 = 1;
                    foreach (TdTag MacCol in cols)
                    {
                        Report.Info("MacCol: " + colNum1);
                        if (colNum1 == 1)
                        {
                            WANIPInfoCol1 = MacCol.InnerText;
                            Report.Info("Col1 Info: " + WANIPInfoCol1);
                        }
                        else if (colNum1 == 2)
                        {
                            IList <SpanTag> spanVals = MacCol.Find <SpanTag>("./span");
                            foreach (SpanTag spanVal in spanVals)
                            {
                                WANIPInfo1       = spanVal.InnerText;
                                WANIPInfoSubstr1 = WANIPInfo1.Substring(1, WANIPInfo1.Length - 1);                              // for validation purpose
//								Report.Info(  "	WANIPInfoSubstr     " + WANIPInfoSubstr1);
                            }
                            WANInfo1 = WANIPInfoCol1 + "		"+ WANIPInfo1;
                            Report.Info("WANInfo1  : " + WANInfo1);

//							Row: 1      IPv6 address
//							Row: 2		IPv6 default gateway
//							Row: 3		IPv6 lease time
//							Row: 4      IPv6 lease expire
//							Row: 5      IPv6 DNS servers
                            if (rowNum1 == 1 || rowNum1 == 2 || rowNum1 == 5)
                            {
                                Report.Info(" To check IPv6 address type ");
                            }
                            else if (rowNum1 == 3)                                      //IPv6 lease time
                            {
                                if (WANIPInfoSubstr1.Length == 0)
                                {
                                    Report.Failure("	InValid IPv6 lease time 	");
                                }
                                else
                                {
                                    Report.Success(" Valid IPv6 lease time  ");
                                }
                            }
                            else if (rowNum1 == 4)                                      //IPv6 lease expire
                            //2017-08-10 11:56:40.00
                            {
                                if (WANIPInfoSubstr1.Length == 0)
                                {
                                    Report.Failure("	InValid IPv6 lease expire 	");
                                }
                                else
                                {
                                    Boolean CheckDateTime = CheckDateTimeValid(WANIPInfoSubstr1.Trim());                                     //calling CheckDateTimeValid()
                                    if (CheckDateTime)
                                    {
                                        Report.Success("  Valid IPv6 lease expire  ");
                                    }
                                    else
                                    {
                                        Report.Failure("  InValid IPv6 lease expire ");
                                    }
                                }
                            }
                        }
                        colNum1++;
                    }    // end of COLUMN for-loop
                    rowNum1++;
                }        //end of ROW for-loop : totalDeviceRows1
            }            //end if IF-ELSE	: WAN IP settings - IPv6 Info


            //-------------------------- WAN IP settings - IPv4 Info ------------------------------------------//
            //MAC address, IPv4 address, default gateway,IPv4 lease time, IPv4 lease expire, IPv4 DNS server

            TableTag myTable2 = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'WANIPv4Info']/table");
            //Count the total no of rows
            IList <TrTag> totalDeviceRows2     = myTable2.Find <TrTag>("./tbody//tr");
            int           rulesCount2          = totalDeviceRows2.Count;
            string        totalDeviceInfoRows2 = rulesCount2.ToString() + " : Rows :";

            Report.Info(" Hub 3.0 WAN IP information  ", totalDeviceInfoRows2);

            if (rulesCount2 == 0)
            {
                //Mouse.ScrollWheel(150);
                Report.Failure("Device Info ", "There are no WAN IP information !!");
                return;
            }
            else
            {
                Report.Info(" There are " + totalDeviceInfoRows2 + " in Hub 3.0 WANIPv4 information !!! ");
                int    rowNum2 = 1;
                string WANIPInfo2 = "", WANIPInfoCol2 = "", WANInfo2 = "", WANIPInfoSubstr2 = "";
                foreach (var row in totalDeviceRows2)
                {
                    Report.Info("Row: " + rowNum2);
//					Report.Info(row.GetInnerHtml().ToString());
                    IList <TdTag> cols = row.Find <TdTag>("./td");
                    //Report.Info(" Total Column ", cols.Count.ToString());
                    int colNum2 = 1;
                    foreach (TdTag MacCol in cols)
                    {
                        Report.Info("MacCol: " + colNum2);
                        if (colNum2 == 1)
                        {
                            WANIPInfoCol2 = MacCol.InnerText;
                            //Report.Info("Col1 Info: "+MacCol.InnerText);
                            //Report.Info("Col1 Info: "+WANIPInfoCol1);
                        }
                        else if (colNum2 == 2)
                        {
                            IList <SpanTag> spanVals = MacCol.Find <SpanTag>("./span");
                            foreach (SpanTag spanVal in spanVals)
                            {
                                WANIPInfo2       = spanVal.InnerText;
                                WANIPInfoSubstr2 = WANIPInfo2.Substring(1, WANIPInfo2.Length - 1);                              // for validation purpose
                                //Report.Info(  "	WANIPInfoSubstr     " + WANIPInfoSubstr);
                            }
                            Report.Info("Col2 Info: " + WANIPInfo2);
                            WANInfo2 = WANIPInfoCol2 + "		"+ WANIPInfo2;
                            //Report.Info( WANIPInfoCol1 + "		" + WANIPInfo);
                            Report.Info("WANInfo2 : " + WANInfo2);
                            //Report.LogHtml(ReportLevel.Info, "WANInfo", "<a>WANInfo</a>");

                            //perform WAN IP Settings validation here

                            //IPv4 address : 80.2.153.121
                            //Default gateway : 80.2.153.97
                            //IPv4 lease time : 0 days 19h:24m:26s
                            //IPv4 lease expire : 2016-07-01 04:09:29.00
                            //IPv4 DNS servers : 194.168.4.100
                            if (rowNum2 == 1 || rowNum2 == 2 || rowNum2 == 5)
                            {
                                //IP Address Validation
                                if (WANIPInfoSubstr2.Length == 0)
                                {
                                    Report.Failure("	InValid IP Address 	");
                                }
                                else
                                {
                                    Boolean CheckIPAddress = CheckIPAddressValid(WANIPInfoSubstr2.Trim());                                    //Calling CheckIPAddressValid()
                                    if (CheckIPAddress)
                                    {
                                        Report.Success("Valid IP Address");
                                    }
                                    else
                                    {
                                        Report.Failure("InValid IP Address....It is : " + WANIPInfoSubstr2);
                                    }
                                }
                            }
                            else if (rowNum2 == 3)
                            {
                                //IPv4 lease time validation
                                if (WANIPInfoSubstr2.Length == 0)
                                {
                                    Report.Failure("	InValid IPv4 lease time 	");
                                }
                                else
                                {
                                    /*
                                     * Boolean CheckDateTime = CheckDateTimeValid(WANIPInfoSubstr.Trim()); //calling CheckDateTimeValid()
                                     * if(CheckDateTime){
                                     * Report.Success("  Valid IPv4 lease time  ");
                                     * }else{
                                     * Report.Failure("  InValid IPv4 lease time ");
                                     * }
                                     */
                                    Report.Success(" Valid IPv4 lease time  ");
                                }
                            }
                            else if (rowNum2 == 4)
                            {
                                //string input = "2016-07-15 09:21:27.00";	//"???"
                                if (WANIPInfoSubstr2.Length == 0)
                                {
                                    Report.Failure("	InValid IPv4 lease expire 	");
                                }
                                else
                                {
                                    Boolean CheckDateTime = CheckDateTimeValid(WANIPInfoSubstr2.Trim());                                     //calling CheckDateTimeValid()
                                    //Boolean CheckDateTime = CheckDateTimeValid("???");
                                    if (CheckDateTime)
                                    {
                                        Report.Success("  Valid IPv4 lease expire  ");
                                    }
                                    else
                                    {
                                        Report.Failure("  InValid IPv4 lease expire ");
                                    }
                                }
                            }                            //end of rowNum1 IF-ELSE
                        }
                        colNum2++;
                    }    // end of COLUMN for-loop
                    rowNum2++;
                }        //end of ROW for-loop : totalDeviceRows1
            }            //end if IF-ELSE	: WAN IP settings - IPv6 Info


            //---------------------------------------------  WANDSLiteInfo --------------------------------------------------------//
            //	/dom[@page='' and @path='/' and @browsername='IE' and @pageurl='http://192.168.0.1/?device_status&mid=Info']//div[#'WANDSLiteInfo']/table

            TableTag myTable4 = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'WANDSLiteInfo']/table");
            //Count the total no of rows
            IList <TrTag> totalDeviceRows4     = myTable4.Find <TrTag>("./tbody//tr");
            int           rulesCount4          = totalDeviceRows4.Count;
            string        totalDeviceInfoRows4 = rulesCount4.ToString() + " : Rows :";

            Report.Info(" Hub 3.0 WANDSLiteInfo  ", totalDeviceInfoRows4);
            if (rulesCount4 == 0)
            {
                //Mouse.ScrollWheel(150);
                Report.Failure("Device Info ", "There are no WANDSLiteInfo !!");
                return;
            }
            else
            {
                Report.Info(" There are " + totalDeviceInfoRows4 + " in Hub 3.0 WANDSLiteInfo !!! ");
                int    rowNum4 = 1;
                string WANIPInfo4 = "", WANIPInfoCol4 = "", WANInfo4 = "", WANIPInfoSubstr4 = "";
                foreach (var row in totalDeviceRows4)
                {
                    Report.Info("Row: " + rowNum4);
                    Report.Info(row.GetInnerHtml().ToString());
                    IList <TdTag> cols = row.Find <TdTag>("./td");
                    //Report.Info(" Total Column ", cols.Count.ToString());
                    int colNum4 = 1;
                    foreach (TdTag MacCol in cols)
                    {
                        Report.Info("MacCol: " + colNum4);
                        colNum4++;
                    }    // end of COLUMN for-loop
                    rowNum4++;
                }        //end of ROW for-loop : totalDeviceRows4
            }            //end if IF-ELSE	: WANDSLiteInfo
        }
Пример #7
0
        public void Choose_Ethernet_Device_To_Rename(string argument1, string argument2)
        {
            Report.Info("---- Choose_Ethernet_Device_To_Rename ---------");
            Report.Info("----  Ethernet_Device_To_Rename ---- " + argument1);

            WebDocument webDocument = "/dom[@domain='192.168.0.1']";
            TableTag    myTable     = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'wired_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 ethernet devices to rename !!");
                TestSuite.Current.GetTestCase("Verify_Renamed_Ethernet_Device_Name_In_Home_Screen").Checked = false;
                return;
            }
            else
            {
                //Choose_Ethernet_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(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           ethernet_Device_applyButton_Path = "/dom[@browsername='IE']//table[#'wired_Device']//td/input[@type='button']";
                                Ranorex.InputTag ethernet_Device = ethernet_Device_applyButton_Path;
                                ethernet_Device.DoubleClick();
                                ethernet_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++;
                }                                        //end of row forloop
                Report.Screenshot();
                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();
                    TestSuite.Current.GetTestCase("Verify_Renamed_Ethernet_Device_Name_In_Home_Screen").Checked = false;
                    return;
                }
            }
        }
        public void Validate_Router_Status_Configuration()
        {
            //validate router status configuration tables -> Configuration, PrimaryDWFlow, PrimaryUPFlow

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

            webDocument.WaitForDocumentLoaded();

            //validate the Configuration table rows & columns
//			TableTag configTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'configuration']");
            TableTag      configTable     = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'configuration']//table[@id='configuration']");
            IList <TrTag> totalRows       = configTable.Find <TrTag>("./tbody//tr");
            int           configRowsCount = totalRows.Count;
//			string totalConfigRowsCnt = "Total Rows(Configuration) : "+configRowsCount.ToString();
            string totalConfigRowsCnt = configRowsCount.ToString();

            Report.Info("Total Items(Configuration) ", totalConfigRowsCnt);
            if (configRowsCount == 0)
            {
                //Mouse.ScrollWheel(150);
                Report.Failure("Device Info ", "There are no Router status-Configuration information !!");
                return;
            }
            else
            {
                Report.Info(" There are " + totalConfigRowsCnt + " in General Configuration information !!! ");
                int    rowNum = 1;
                string configInfo = "", configInfoTitle = "";
                foreach (var row in totalRows)
                {
                    Report.Info("Configuration -Row#: " + rowNum);
//					Report.Info(row.GetInnerHtml().ToString());
                    IList <TdTag> cols = row.Find <TdTag>("./td");
                    Report.Info(" Configuration -Row-Total Columns ", cols.Count.ToString());
                    int colNum = 1;
                    foreach (TdTag MacCol in cols)
                    {
//						Report.Info("Configuration Col # " + colNum);
                        if (colNum == 1)
                        {
                            configInfoTitle = MacCol.InnerText;
//							Report.Info("Col1 Info: "+MacCol.InnerText);
                            Report.Info("Col1 Info: " + configInfoTitle);
                        }
                        if (colNum == 2)
                        {
                            IList <DivTag> divVals = MacCol.Find <DivTag>("./div");
//							Report.Info("divVals count : " + divVals.Count.ToString());

                            foreach (DivTag divVal in divVals)
                            {
                                IList <SpanTag> spanVals = divVal.Find <SpanTag>("./span");
//								Report.Info("spanVals count : " + spanVals.Count.ToString());
                                foreach (SpanTag spanVal in spanVals)
                                {
                                    configInfo = spanVal.InnerText;
                                }
                                Report.Info("Col2 Info: " + configInfo);
                            }
                        }

                        colNum++;
                    }
                    rowNum++;
                }        //end of totalRows
            }            //end if IF-ELSE -Configuration


            //validate the PPrimary Downstream Service Flow table rows & columns
            TableTag      primaryDWTable     = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'primaryDWFlow']");
            IList <TrTag> totalRows1         = primaryDWTable.Find <TrTag>("./tbody//tr");
            int           primaryDWRowsCount = totalRows1.Count;
//			string totalPrimaryDWRowsCount = "Total Rows(primaryDW) : "+primaryDWRowsCount.ToString();
            string totalPrimaryDWRowsCount = primaryDWRowsCount.ToString();

            Report.Info("Total Items(PrimaryDW) ", totalPrimaryDWRowsCount);
            if (primaryDWRowsCount == 0)
            {
                //Mouse.ScrollWheel(150);
                Report.Failure("Device Info ", "There are no Primary Downstream Service Flow information !!");
                return;
            }
            else
            {
                Report.Info(" There are " + totalPrimaryDWRowsCount + " in Primary Downstream Service Flow information !!! ");
                int    rowNum = 1;
                string primaryDWInfo = "", primaryDWInfoTitle = "";
                foreach (var row in totalRows1)
                {
                    Report.Info("Configuration -Row#: " + rowNum);
//					Report.Info(row.GetInnerHtml().ToString());
                    IList <TdTag> cols = row.Find <TdTag>("./td");
                    Report.Info(" Configuration -Row-Total Columns ", cols.Count.ToString());
                    int colNum = 1;
                    foreach (TdTag MacCol in cols)
                    {
//						Report.Info("Configuration Col # " + colNum);
                        if (colNum == 1)
                        {
                            primaryDWInfoTitle = MacCol.InnerText;
//							Report.Info("Col1 Info: "+MacCol.InnerText);
                            Report.Info("Col1 Info: " + primaryDWInfoTitle);
                        }
                        if (colNum == 2)
                        {
                            primaryDWInfo = MacCol.InnerText;
//							Report.Info("Col2 Info: "+MacCol.InnerText);
                            IList <DivTag> divVals = MacCol.Find <DivTag>("./div");
//							Report.Info("divVals count : " + divVals.Count.ToString());

                            foreach (DivTag divVal in divVals)
                            {
                                IList <SpanTag> spanVals = divVal.Find <SpanTag>("./span");
//								Report.Info("spanVals count : " + spanVals.Count.ToString());
                                foreach (SpanTag spanVal in spanVals)
                                {
                                    primaryDWInfo = spanVal.InnerText;
                                }
                                Report.Info("Col2 Info: " + primaryDWInfo);
                            }
                            Report.Info("Col2 Info: " + primaryDWInfo);
                        }

                        colNum++;
                    }
                    rowNum++;
                }        //end of totalRows
            }            //end if IF-ELSE -Configuration

            //validate the Primary Upstream Service Flow table rows & columns
            TableTag      primaryUPTable     = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'primaryUPFlow']");
            IList <TrTag> totalRows2         = primaryUPTable.Find <TrTag>("./tbody//tr");
            int           primaryUPRowsCount = totalRows2.Count;
//			string totalPrimaryUPRowsCount = "Total Rows(primaryUP) : "+primaryUPRowsCount.ToString();
            string totalPrimaryUPRowsCount = primaryUPRowsCount.ToString();

            Report.Info("Total Items(PrimaryUP) ", totalPrimaryUPRowsCount);
            if (primaryUPRowsCount == 0)
            {
                //Mouse.ScrollWheel(150);
                Report.Failure("Device Info ", "There are no Primary Upstrean Service Flow information !!");
                return;
            }
            else
            {
                Report.Info(" There are " + primaryUPRowsCount + " in Primary Upstrean Service Flow information !!! ");
                int    rowNum = 1;
                string primaryUPInfo = "", primaryUPInfoTitle = "";
                foreach (var row in totalRows2)
                {
                    Report.Info("Configuration -Row#: " + rowNum);
//					Report.Info(row.GetInnerHtml().ToString());
                    IList <TdTag> cols = row.Find <TdTag>("./td");
                    Report.Info(" Configuration -Row-Total Columns ", cols.Count.ToString());
                    int colNum = 1;
                    foreach (TdTag MacCol in cols)
                    {
//						Report.Info("Configuration Col # " + colNum);
                        if (colNum == 1)
                        {
                            primaryUPInfoTitle = MacCol.InnerText;
//							Report.Info("Col1 Info: "+MacCol.InnerText);
                            Report.Info("Col1 Info: " + primaryUPInfoTitle);
                        }
                        if (colNum == 2)
                        {
                            primaryUPInfo = MacCol.InnerText;
//							Report.Info("Col2 Info: "+MacCol.InnerText);
                            IList <DivTag> divVals = MacCol.Find <DivTag>("./div");
//							Report.Info("divVals count : " + divVals.Count.ToString());

                            foreach (DivTag divVal in divVals)
                            {
                                IList <SpanTag> spanVals = divVal.Find <SpanTag>("./span");
//								Report.Info("spanVals count : " + spanVals.Count.ToString());
                                foreach (SpanTag spanVal in spanVals)
                                {
                                    primaryUPInfo = spanVal.InnerText;
                                }
                                Report.Info("Col2 Info: " + primaryUPInfo);
                            }
                            Report.Info("Col2 Info: " + primaryUPInfo);
                        }

                        colNum++;
                    }
                    rowNum++;
                }        //end of totalRows
            }            //end if IF-ELSE -Configuration
        }
        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 Validate_Renamed_Wireless_Connected_Device_Name(string argument1, string argument2)
        {
            Delay.Seconds(20);
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";
            TableTag    myTable     = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'AttachedDevicesTable']"); //R3.8

            Report.Screenshot("Devices Connected", myTable.Element, true);                                                   // print the devices table

            //Count the rows(total no of devices)
            IList <TrTag> rows      = myTable.Find <TrTag>("./tbody//tr");
            int           rowsCount = rows.Count;

            Report.Info("Total Devices Connected", rowsCount.ToString());
            if (rowsCount == 0)
            {
                //Mouse.ScrollWheel(150);
                Report.Failure("Device Rename ", "There are no connected wireless devices to rename !!");

                return;
            }
            else
            {
                int     rowNum = 1;
                Boolean isWirelessMatch = false, isEthernetMatch = false;
                int     wirelessCnt = 0, ethernetCnt = 0;
                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;
                    int           colNum = 1;
                    string        deviceName = "", connectionType = "";
                    foreach (TdTag MacCol in cols)
                    {
                        Report.Info("MacCol: " + colNum);
                        Report.Info("MacCol Info: " + MacCol.InnerText);
                        Report.Info(MacCol.GetInnerHtml().ToString());

                        //column1 - device name
                        //column5 - Wi-Fi 2.4G _VM0365087_2G  / Wi-Fi 5G _VM0365087_5G / Ethernet
                        if (colNum == 1)
                        {
                            deviceName = MacCol.InnerText.Trim();
                        }
                        else if (colNum == 5)
                        {
                            connectionType = MacCol.InnerText.Trim();
                            if (argument2.Trim() == deviceName)
                            {
                                Report.Info("connectionType  : " + connectionType);
//			                    if(connectionType.StartsWith("Wi-Fi")){
//			                    if(connectionType.StartsWith("Wireless frequency")){	//added on 02/11/17 to test code 9.1.116.600
                                if ((connectionType.StartsWith("Wi-Fi")) || (connectionType.StartsWith("Wireless frequency")))                                  //  added on 15/01/18 to test code 9.1.116.604
                                {
                                    Report.Info("Rename Wireless Connected  Device Name  is Successfull");
                                    isWirelessMatch = true;
                                    wirelessCnt++;
                                    //break;
                                }
                                else
                                {
                                    Report.Info("Ethernet  Device Name ");
                                    isEthernetMatch = true;
                                    ethernetCnt++;
                                }
                            }            //end of IF-deviceName
                        }                //end of if-else : column5

                        colNum++;
                    }
                    rowNum++;
                }
                if (isWirelessMatch)
                {
                    Report.Info("wirelessCnt", wirelessCnt.ToString());
                    if (wirelessCnt == 1)
                    {
                        Report.Success("Rename Wireless Connected  Device Name  is Successfull");
                    }
                    else
                    {
                        Report.Failure("More than one Wireless Connected  Device Renamed");
                    }
                }
                else if (isEthernetMatch)
                {
                    Report.Info("ethernetCnt", ethernetCnt.ToString());
                    if (ethernetCnt == 1)
                    {
                        Report.Failure("One  Ethernet Connected  Device Name  is Renamed instead of Wireless Device");
                    }
                    else
                    {
                        Report.Failure("More than one Ethernet Connected  Device Renamed instead of one(1) Wireless Device");
                    }
                }
                Report.Screenshot();
            }           //end of IF-ELSE
        }
        public void WPS_PIN_Verification_Validation()
        {
            Delay.Seconds(5);
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";

            TableTag      myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'PriSecurityStatusTable']");
            IList <TdTag> cols    = myTable.Find <TdTag>("./tbody//td");
            //Report.Info(" Total columns ",cols.Count.ToString());

            bool   isValidPIN = true;
            string WPSPIN     = "";

            foreach (TdTag col in cols)
            {
                WPSPIN = col.InnerText.ToString();
                //Report.Info("WPS PIN Value",col.InnerText);
                Report.Info("WPS PIN Value", WPSPIN);
                //Report.Info("WPS PIN Length",col.InnerText.Length.ToString());
                Report.Info("WPS PIN Length", WPSPIN.Length.ToString());
                //if(col.InnerText.Length < 8){
                if (WPSPIN.Length < 8)
                {
                    isValidPIN = false;
                }
                else
                {
                    break;
                }
            }
            if (isValidPIN)
            {
                Report.Success("Valid WPS PIN");
            }
            else
            {
                Report.Failure("Invalid WPS PIN");
            }
            TableTag table_WPS_PIN = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'PriSecurityStatusTable']");

            Report.Screenshot("WPS_PIN_Length", table_WPS_PIN.Element, false);

            //Navigate to Admin-Info
            Report.Info("Verify the PIN with IP Address and BOX serial Number");
            Ranorex.ATag Admin = "/dom[@domain='192.168.0.1']//li[#'Admin']/a[@innertext='Admin']";
            Admin.DoubleClick();
            //Admin.PerformClick();
            Delay.Seconds(2);
            Ranorex.ATag AdminInfo = "/dom[@domain='192.168.0.1']//li[#'Info']/a[@innertext='Info']";
            AdminInfo.DoubleClick();
            AdminInfo.PerformClick();
            Delay.Seconds(2);

            // Verify the PIN with cable modem serial Number //
            Delay.Seconds(20);
            TableTag myTable1 = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'Hub 3.0 device information']/table");
            //Count the total no of rows
            IList <TrTag> totalDeviceRows1     = myTable1.Find <TrTag>("./tbody//tr");
            int           rulesCount1          = totalDeviceRows1.Count;
            string        totalDeviceInfoRows1 = rulesCount1.ToString() + " : Rows :";

            //Report.Info(" Hub 3.0 device information ",totalDeviceInfoRows1);
//	        string cableSerialNumber="";
            if (rulesCount1 == 0)
            {
                //Mouse.ScrollWheel(150);
                Report.Failure("Device Info ", "There are no active Hub 3.0 device information !!");
                return;
            }
            else
            {
                Report.Info(" There are " + totalDeviceInfoRows1 + " in Hub 3.0 device information !!! ");
                int    rowNum = 1;
                string devInfo = "", devInfoCol1 = "", deviceInfo = "", devInfoSubstr = "";
                foreach (var row in totalDeviceRows1)
                {
                    //Report.Info("Row: " + rowNum);
                    //Report.Info(row.GetInnerHtml().ToString());
                    IList <TdTag> cols1 = row.Find <TdTag>("./td");
                    //Report.Info(" Total Column ", cols.Count.ToString());
                    int colNum = 1;
                    foreach (TdTag MacCol in cols1)
                    {
                        //Report.Info("MacCol: " + colNum);
                        if (colNum == 1)
                        {
                            devInfoCol1 = MacCol.InnerText;
                            //Report.Info("Col1 Info: "+MacCol.InnerText);
                            //Report.Info("Col1 Info: " + devInfoCol1);
                        }
                        if (colNum == 2)
                        {
                            IList <SpanTag> spanVals = MacCol.Find <SpanTag>("./span");
                            foreach (SpanTag spanVal in spanVals)
                            {
                                devInfo = spanVal.InnerText;
                                if (devInfo.Length > 0)
                                {
                                    devInfoSubstr = devInfo.Substring(1, devInfo.Length - 1);                           // for validation purpose
                                }
                                else
                                {
                                    //blank
                                    devInfoSubstr = "";
                                }
                                //Report.Info(  "	devInfoSubstr   " + devInfoSubstr);
                            }
                            //Report.Info("Col2 Info: "+devInfo);
                            deviceInfo = devInfoCol1 + "		"+ devInfo;
                            //Report.Info( devInfoCol1 + "		" + devInfo);
                            //Report.Info(deviceInfo);
                            if (rowNum == 4)
                            {
                                //MAC Address - C0:05:C2:00:24:1B  ( Arris1)
                                if (devInfoSubstr.Length == 0)
                                {
                                    Report.Failure("	MAC Address  is BLANK 	");
                                }
                                else if (devInfoSubstr.Trim() != WPSPIN)
                                {
                                    Report.Info("WPSPIN : " + WPSPIN + "  MAC Address : " + devInfoSubstr);
                                    Report.Success("	WPS PIN is different from MAC Address  	"+ " PASS");
                                }
                                else
                                {
                                    Report.Failure("	MAC Address  	"+ " FAIL");
                                }
                            }
                            else if (rowNum == 5)
                            {
                                //Cable modem serial number
                                if (devInfoSubstr.Length == 0)
                                {
                                    Report.Failure("	Cable modem serial number  is BLANK 	");
                                }
                                else if (devInfoSubstr.Trim() != WPSPIN)
                                {
                                    Report.Info("WPSPIN : " + WPSPIN + "  Cable Modem Serial Number : " + devInfoSubstr);
                                    Report.Success("	WPS PIN is different from Modem Serial Number	"+ " PASS");
                                }
                                else
                                {
                                    //validate Cable modem serial number
                                    Report.Failure("	WPS PIN  	"+ " FAIL");
                                }
                            }
                        }
                        colNum++;
                    }    //end of COLUMN forloop
                    rowNum++;
                }        //end of ROW forloop
            }

            //Verify the PIN with IP Addresses //
            Delay.Seconds(20);
            TableTag myTable2 = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'WANIPv4Info']/table");
            //Count the total no of rows
            IList <TrTag> totalDeviceRows2     = myTable2.Find <TrTag>("./tbody//tr");
            int           rulesCount2          = totalDeviceRows2.Count;
            string        totalDeviceInfoRows2 = rulesCount2.ToString() + " : Rows :";

            //Report.Info(" Hub 3.0 WAN IP information Rows ",totalDeviceInfoRows2);

            if (rulesCount2 == 0)
            {
                //Mouse.ScrollWheel(150);
                Report.Failure("Device Info ", "There are no WAN IP information !!");
                return;
            }
            else
            {
                Report.Info(" There are " + totalDeviceInfoRows2 + " in Hub 3.0 WAN IP information !!! ");
                int    rowNum1 = 1;
                string WANIPInfo = "", WANIPInfoCol1 = "", WANInfo = "", WANIPInfoSubstr = "";
//	             string deviceIPAddress="",deviceGatwayIP="";
                foreach (var row in totalDeviceRows2)
                {
                    //Report.Info("Row: " + rowNum1);
                    //Report.Info(row.GetInnerHtml().ToString());
                    IList <TdTag> cols2 = row.Find <TdTag>("./td");
                    //Report.Info(" Total Column ", cols.Count.ToString());
                    int colNum1 = 1;
                    foreach (TdTag MacCol in cols2)
                    {
                        //Report.Info("MacCol: " + colNum1);
                        if (colNum1 == 1)
                        {
                            WANIPInfoCol1 = MacCol.InnerText;
                            //Report.Info("Col1 Info: "+MacCol.InnerText);
                            //Report.Info("Col1 Info: "+WANIPInfoCol1);
                        }
                        if (colNum1 == 2)
                        {
                            IList <SpanTag> spanVals = MacCol.Find <SpanTag>("./span");
                            foreach (SpanTag spanVal in spanVals)
                            {
                                WANIPInfo       = spanVal.InnerText;
                                WANIPInfoSubstr = WANIPInfo.Substring(1, WANIPInfo.Length - 1);                         // for validation purpose
                                //Report.Info(  "	WANIPInfoSubstr     " + WANIPInfoSubstr);
                            }
                            //Report.Info("Col2 Info: "+WANIPInfo);
                            WANInfo = WANIPInfoCol1 + "		"+ WANIPInfo;
                            //Report.Info( WANIPInfoCol1 + "		" + WANIPInfo);
                            //Report.Info(WANInfo);
                            //Report.LogHtml(ReportLevel.Info, "WANInfo", "<a>WANInfo</a>");

                            //IPv4 address : 80.2.153.121
                            //Default gateway : 80.2.153.97
                            //IPv4 lease time : 0 days 19h:24m:26s
                            //IPv4 lease expire : 2016-07-01 04:09:29.00
                            //IPv4 DNS servers : 194.168.4.100
                            if (rowNum1 == 1 || rowNum1 == 2 || rowNum1 == 5)
                            {
                                //IP Address Validation
                                if (WANIPInfoSubstr.Length == 0)
                                {
                                    Report.Failure("	InValid IP Address 	");
                                }
                                else
                                {
                                    Boolean CheckIPAddress = CheckIPAddressValid(WANIPInfoSubstr.Trim());                            //Calling CheckIPAddressValid()
                                    if (CheckIPAddress)
                                    {
                                        Report.Success("Valid IP Address");
                                        if (WANIPInfoSubstr.Trim() != WPSPIN)
                                        {
                                            Report.Info("WPSPIN : " + WPSPIN + "  IP Address : " + WANIPInfoSubstr);
                                            if (rowNum1 == 1)
                                            {
                                                Report.Success("	WPS PIN  is different from IPv4 address 	"+ " PASS");
                                            }
                                            else if (rowNum1 == 2)
                                            {
                                                Report.Success("	WPS PIN  is different from Default Gateway IPv4 address 	"+ " PASS");
                                            }
                                            else if (rowNum1 == 5)
                                            {
                                                Report.Success("	WPS PIN  is different from IPv4 DNS servers IPv4 address 	"+ " PASS");
                                            }
                                        }
                                    }
                                    else
                                    {
                                        Report.Failure("InValid IP Address");
                                    }
                                }
                            }
                        }
                        colNum1++;
                    }    //end of COLUMN forloop
                    rowNum1++;
                }        //end of ROW forloop
            }
        }
        public void Verify_And_Validate_Device_Connection_Status_Info(string argument1, string argument2, string argument3, string argument4, string argument5, string argument6)
        {
            //Standard specification compliant : argument1
            //Hardware version : argument2
            //Software version : argument3
            //Cable modem serial number : argument4
            //Network access : argument5
            //Cable MAC address : argument6

            //Report.Info("Arg1 " + argument1);
            //Report.Info("Arg5 " + argument5);

            //Capture the following table info

            /*
             * /dom[@domain='192.168.0.1']//div[#'InfoHead']/table
             *      /dom[@domain='192.168.0.1']//div[#'WANIP']/table
             *      /dom[@domain='192.168.0.1']//div[#'WANIPSettingInfo}}']/table
             *      /dom[@domain='192.168.0.1']//div[#'WANIPv6Info']/table
             *      /dom[@domain='192.168.0.1']//div[#'WANIPv4Info']/table
             *      /dom[@domain='192.168.0.1']//div[#'WANDSLiteInfo']/table
             *
             */
//          Delay.Seconds(30);
            Duration newDuration = new Duration(240000);

            repo.WebDocument19216801.DivButtonsInfo.WaitForExists(newDuration);

            //Hub3.0 device info //
            //Hardware version, software ver,Cable Mac,cable modem serial number, system up time, netork access

            //	"/dom[@domain='192.168.0.1']//div[#'Hub 3.0 device information']/table"   =>Hub 3.0 device information

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

            webDocument.WaitForDocumentLoaded();
            //Report.Info(webDocument.GetHtml());
            TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'Hub 3.0 device information']/table");
            //Count the total no of rows
            IList <TrTag> totalDeviceRows     = myTable.Find <TrTag>("./tbody//tr");
            int           rulesCount          = totalDeviceRows.Count;
            string        totalDeviceInfoRows = rulesCount.ToString() + " : Rows :";

            Report.Info(" Hub 3.0 device information ", totalDeviceInfoRows);

            if (rulesCount == 0)
            {
                //Mouse.ScrollWheel(150);
                Report.Failure("Device Info ", "There are no active Hub 3.0 device information !!");
                return;
            }
            else
            {
                Report.Info(" There are " + totalDeviceInfoRows + " in Hub 3.0 device information !!! ");
                int    rowNum = 1;
                string devInfo = "", devInfoCol1 = "", deviceInfo = "", devInfoSubstr = "";
                foreach (var row in totalDeviceRows)
                {
                    //Report.Info("Row: " + rowNum);
                    //Report.Info(row.GetInnerHtml().ToString());
                    IList <TdTag> cols = row.Find <TdTag>("./td");
                    //Report.Info(" Total Column ", cols.Count.ToString());
                    int colNum = 1;
                    foreach (TdTag MacCol in cols)
                    {
                        //Report.Info("MacCol: " + colNum);
                        if (colNum == 1)
                        {
                            devInfoCol1 = MacCol.InnerText;
                            //Report.Info("Col1 Info: "+MacCol.InnerText);
                            //Report.Info("Col1 Info: " + devInfoCol1);
                        }
                        if (colNum == 2)
                        {
                            IList <SpanTag> spanVals = MacCol.Find <SpanTag>("./span");
                            foreach (SpanTag spanVal in spanVals)
                            {
                                devInfo = spanVal.InnerText;
                                if (devInfo.Length > 0)
                                {
                                    devInfoSubstr = devInfo.Substring(1, devInfo.Length - 1);                           // for validation purpose
                                }
                                else
                                {
                                    //blank
                                    devInfoSubstr = "";
                                }
                                //Report.Info(  "	devInfoSubstr   " + devInfoSubstr);
                            }
                            //Report.Info("Col2 Info: "+devInfo);
                            deviceInfo = devInfoCol1 + "		"+ devInfo;
                            //Report.Info( devInfoCol1 + "		" + devInfo);
                            Report.Info(deviceInfo);
                            //Report.LogHtml(ReportLevel.Info, "deviceInfo", "<a>deviceInfo</a>");

                            //perform Hub 3.0 device information validation here
                            //Standard specification compliant : DOCSIS 3.0
                            //Hardware version : 10
                            //Software version : 9.1.116V
                            //Cable MAC address : C0:05:C2:00:24:1B
                            //Cable modem serial number : AAAP51770041
                            //System up time : 0 days 17h:38m:47s
                            //Network access : Allowed
                            if (rowNum == 1)
                            {
                                //Standard specification compliant
                                if (devInfoSubstr.Length == 0)
                                {
                                    Report.Failure("	Standard specification compliant  is BLANK 	");
                                }
                                else if (devInfoSubstr.Trim().Equals(argument1.Trim()))
                                {
                                    Report.Success("	Standard specification compliant  	"+ " PASS");
                                }
                                else
                                {
                                    Report.Failure("	Standard specification compliant  	"+ " FAIL");
                                }
                            }
                            else if (rowNum == 2)
                            {
                                //Hardware Version
                                if (devInfoSubstr.Length == 0)
                                {
                                    Report.Failure("	Hardware Version  is BLANK 	");
                                }
                                else if (devInfoSubstr.Trim() == argument2.Trim())
                                {
                                    Report.Success("	Hardware Version  	"+ " PASS");
                                }
                                else
                                {
                                    Report.Failure("	Hardware Version  	"+ " FAIL");
                                }
                            }
                            else if (rowNum == 3)
                            {
                                //Software Version
                                if (devInfoSubstr.Length == 0)
                                {
                                    Report.Failure("	Software Version  is BLANK 	");
                                }
                                else if (devInfoSubstr.Trim() == argument3.Trim())
                                {
                                    Report.Success("	Software Version  	"+ " PASS");
                                }
                                else
                                {
                                    Report.Failure("	Software Version  	"+ " FAIL");
                                }
                            }
                            else if (rowNum == 4)
                            {
                                //MAC Address - C0:05:C2:00:24:1B
                                Report.Info("	devInfoSubstr 	"+ devInfoSubstr);
                                Report.Info(" argument6  " + argument6);
                                if (devInfoSubstr.Length == 0)
                                {
                                    Report.Failure("	MAC Address  is BLANK 	");
                                }
                                else if (devInfoSubstr.Trim() == argument6.Trim())
                                {
                                    Report.Success("	MAC Address  	"+ " PASS");
                                }
                                else
                                {
                                    Report.Failure("	MAC Address  	"+ " FAIL");
                                }
                            }
                            else if (rowNum == 5)
                            {
                                //Cable modem serial number
                                if (devInfoSubstr.Length == 0)
                                {
                                    Report.Failure("	Cable modem serial number  is BLANK 	");
                                }
                                else if (devInfoSubstr.Trim() == argument4.Trim())
                                {
                                    Report.Success("	Cable modem serial number  	"+ " PASS");
                                }
                                else
                                {
                                    //validate Cable modem serial number
                                    Report.Failure("	Cable modem serial number  	"+ " FAIL");
                                }
                            }
                            else if (rowNum == 6)
                            {
                                //System up time
                                if (devInfoSubstr.Length == 0)
                                {
                                    Report.Failure("	System uptime  is BLANK 	");
                                }
                                else
                                {
                                    //Validate system time format
                                    //Report.Info("Need to Validate system time format");
                                    //Report.Failure("	System up time      " + " FAIL");
                                }
                            }
                            else if (rowNum == 7)
                            {
                                //Network access
                                if (devInfoSubstr.Length == 0)
                                {
                                    Report.Failure("	Network access  is BLANK 	");
                                }
                                else if (devInfoSubstr.Trim() == argument5.Trim())
                                {
                                    Report.Success("	Network access  	"+ " PASS");
                                }
                                else
                                {
                                    Report.Failure("	Network access  	"+ " FAIL");
                                }
                            }
                        }

                        colNum++;
                    } // end of COLUMN for-loop
                    rowNum++;
                }     //end of ROW for-loop
            }         //end if IF-ELSE

            // WAN IP settings //
            //MAC address, IPv4 address, default gateway,IPv4 lease time, IPv4 lease expire, IPv4 DNS server

            // "/dom[@domain='192.168.0.1']//div[#'WANIPv4Info']/table"					=> WANIPv4Info --WAN IP settings

            TableTag myTable1 = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'WANIPv4Info']/table");
            //Count the total no of rows
            IList <TrTag> totalDeviceRows1     = myTable1.Find <TrTag>("./tbody//tr");
            int           rulesCount1          = totalDeviceRows1.Count;
            string        totalDeviceInfoRows1 = rulesCount1.ToString() + " : Rows :";

            Report.Info(" Hub 3.0 WAN IP information Rows ", totalDeviceInfoRows1);

            if (rulesCount == 0)
            {
                //Mouse.ScrollWheel(150);
                Report.Failure("Device Info ", "There are no WAN IP information !!");
                return;
            }
            else
            {
                Report.Info(" There are " + totalDeviceInfoRows1 + " in Hub 3.0 WAN IP information !!! ");
                int    rowNum1 = 1;
                string WANIPInfo = "", WANIPInfoCol1 = "", WANInfo = "", WANIPInfoSubstr = "";
                foreach (var row in totalDeviceRows1)
                {
                    //Report.Info("Row: " + rowNum1);
                    //Report.Info(row.GetInnerHtml().ToString());
                    IList <TdTag> cols = row.Find <TdTag>("./td");
                    //Report.Info(" Total Column ", cols.Count.ToString());
                    int colNum1 = 1;
                    foreach (TdTag MacCol in cols)
                    {
                        //Report.Info("MacCol: " + colNum1);
                        if (colNum1 == 1)
                        {
                            WANIPInfoCol1 = MacCol.InnerText;
                            //Report.Info("Col1 Info: "+MacCol.InnerText);
                            //Report.Info("Col1 Info: "+WANIPInfoCol1);
                        }
                        if (colNum1 == 2)
                        {
                            IList <SpanTag> spanVals = MacCol.Find <SpanTag>("./span");
                            foreach (SpanTag spanVal in spanVals)
                            {
                                WANIPInfo       = spanVal.InnerText;
                                WANIPInfoSubstr = WANIPInfo.Substring(1, WANIPInfo.Length - 1);                         // for validation purpose
                                //Report.Info(  "	WANIPInfoSubstr     " + WANIPInfoSubstr);
                            }
                            //Report.Info("Col2 Info: "+WANIPInfo);
                            WANInfo = WANIPInfoCol1 + "		"+ WANIPInfo;
                            //Report.Info( WANIPInfoCol1 + "		" + WANIPInfo);
                            Report.Info(WANInfo);
                            //Report.LogHtml(ReportLevel.Info, "WANInfo", "<a>WANInfo</a>");

                            //perform WAN IP Settings validation here

                            //IPv4 address : 80.2.153.121
                            //Default gateway : 80.2.153.97
                            //IPv4 lease time : 0 days 19h:24m:26s
                            //IPv4 lease expire : 2016-07-01 04:09:29.00
                            //IPv4 DNS servers : 194.168.4.100
                            if (rowNum1 == 1 || rowNum1 == 2 || rowNum1 == 5)
                            {
                                //IP Address Validation
                                if (WANIPInfoSubstr.Length == 0)
                                {
                                    Report.Failure("	InValid IP Address 	");
                                }
                                else
                                {
                                    Boolean CheckIPAddress = CheckIPAddressValid(WANIPInfoSubstr.Trim());                            //Calling CheckIPAddressValid()
                                    if (CheckIPAddress)
                                    {
                                        Report.Success("Valid IP Address");
                                    }
                                    else
                                    {
                                        Report.Failure("InValid IP Address");
                                    }
                                }
                            }
                            else if (rowNum1 == 3)
                            {
                                //IPv4 lease time validation
                                if (WANIPInfoSubstr.Length == 0)
                                {
                                    Report.Failure("	InValid IPv4 lease time 	");
                                }
                                else
                                {
                                    /*
                                     * Boolean CheckDateTime = CheckDateTimeValid(WANIPInfoSubstr.Trim()); //calling CheckDateTimeValid()
                                     * if(CheckDateTime){
                                     *      Report.Success("  Valid IPv4 lease time  ");
                                     * }else{
                                     *      Report.Failure("  InValid IPv4 lease time ");
                                     * }
                                     */
                                    Report.Success(" Valid IPv4 lease time  ");
                                }
                            }
                            else if (rowNum1 == 4)
                            {
                                //string input = "2016-07-15 09:21:27.00";	//"???"
//			                    Report.Info("WANIPInfoSubstr : " , WANIPInfoSubstr);
//			                    Report.Info(WANIPInfoSubstr.Length.ToString());
                                if (WANIPInfoSubstr.Length == 0)
                                {
                                    Report.Failure("	InValid IPv4 lease expire 	");
                                }
                                else
                                {
                                    Boolean CheckDateTime = CheckDateTimeValid(WANIPInfoSubstr.Trim());                             //calling CheckDateTimeValid()
                                    //Boolean CheckDateTime = CheckDateTimeValid("???");
                                    if (CheckDateTime)
                                    {
                                        Report.Success("  Valid IPv4 lease expire  ");
                                    }
                                    else
                                    {
                                        Report.Failure("  InValid IPv4 lease expire ");
                                    }
                                }
                            }                    //end of rowNum1 IF-ELSE
                        }
                        colNum1++;
                    } // end of COLUMN for-loop
                    rowNum1++;
                }     //end of ROW for-loop
            }         //end if IF-ELSE

            /**
             * string addrString = "-200.0.0.1";
             * Boolean CheckIPAddress = CheckIPAddressValid(addrString);//Calling CheckIPAddressValid()
             * if(CheckIPAddress){
             *      Report.Info("Valid IP - CheckIPAddressValid()");
             * }else{
             *      Report.Info("InValid IP - CheckIPAddressValid()");
             * }
             *
             * Boolean checkIP = CheckIPValid(addrString);	//Calling CheckIPValid()
             * if(checkIP){
             *      Report.Info("Valid IP - CheckIPValid()");
             * }else{
             *      Report.Info("InValid IP - CheckIPValid()");
             * }
             **/
            Report.Info("Device Status Info");
            Mouse.ScrollWheel(3);
            Report.Screenshot();
        }
Пример #13
0
        public void Choose_Any_DHCP_Reserv_Rule_To_Delete(string argument1, string argument2)
        {
            //argument1 - MAC Address, argument2- IP Address

            //Choose_the _DHCP_Reserv_Rule_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[#'dhcpClientsTable']");
            IList <TrTag> totalDHCPReservList = myTable.Find <TrTag>("./tbody//tr");
            int           rulesCount          = totalDHCPReservList.Count;

            Report.Info("Total Rows in the table :" + rulesCount.ToString());
//	        string totalDHCPReservListStr = "Total Reserv list : "+rulesCount.ToString();
//	        Report.Info("Active DHCP Reserv list ",totalDHCPReservListStr);
            if (rulesCount == 0)
            {
                Report.Failure("DHCP Reserv list ", "There are no active rules to delete !!");
                TestSuite.Current.GetTestCase("Delete_Any_DHCP_Rule").Checked = false;
                return;
            }
            else
            {
                int     rowNum = 1;
                int     delCheck = 0;
                Boolean isMatch = false;
                string  macAddress = "", macAddress1 = "", ipAddress = "", ipAddress1 = "";
                macAddress = argument1;
                ipAddress  = argument2;
                Report.Info("MAC Address to Delete : " + macAddress);
                Report.Info("IP Address tp delete: " + ipAddress);
                foreach (var row in totalDHCPReservList)
                {
                    Report.Info("Row: " + rowNum);
                    Report.Info(row.GetInnerHtml().ToString());
                    IList <TdTag> cols = row.Find <TdTag>("./td");
                    if (cols.Count == 1)
                    {
                        Report.Info("There are no active rules to delete ");
                        TestSuite.Current.GetTestCase("Delete_Any_DHCP_Rule").Checked = false;
                        return;
                    }
                    Report.Info(" There are " + rulesCount.ToString() + " DHCP Rules in the Reserv list !!! ");
                    int colNum = 1;
                    foreach (TdTag MacCol in cols)
                    {
//			            Report.Info("MacCol: " + colNum);
//			            Report.Info("MacCol Info: "+MacCol.InnerText);
                        if (colNum == 1)
                        {
                            //Report.Info(MacCol.InnerText);
                            macAddress1 = MacCol.InnerText;
                            Report.Info("MAC Address in the Reserv list : " + macAddress1);
                        }
                        else if (colNum == 2)
                        {
                            ipAddress1 = MacCol.InnerText;
                            Report.Info("IP Address in the Reserv list : " + ipAddress1);
                        }
                        else if (colNum == 3)
                        {
                            // check if Mac address is matching
//			                Report.Info("----------------- click delete checkbox ------");
                            if (macAddress.Trim() == macAddress1.Trim())
                            {
                                isMatch = true;
                                Report.Info("----------------- Rules Matches !!! ------");
                                String newPath = "";
//			                    Report.Info("delCheck ", delCheck.ToString());
                                newPath = MacCol.GetPath() + "/input[#'dhcpClientsTable-Delete-" + delCheck + "']";
                                Ranorex.InputTag DHCPReservTableDeleteTag = newPath;
                                if (DHCPReservTableDeleteTag.Checked.ToString() == "False")
                                {
                                    Report.Info("----------------- DHCPReservTableDeleteTag will be enabled now ---");
                                    Delay.Seconds(1);
                                    DHCPReservTableDeleteTag.PerformClick();
                                    Report.Screenshot("DHCPReserv_List", row.Element, true);
                                    Delay.Seconds(2);
                                }
                                else
                                {
                                    Report.Info(" DHCPReservTableDeleteTag is already Enabled ");
                                }

                                Report.Success("The following DHCP Reserv rule is deleted permanently !!!");
                                Report.Screenshot("DHCPReserv_List", myTable.Element, false);
                            }
                        }
                        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
                {
                    Report.Info(" ===== This DHCP Rule does not exist =====");
                    Delay.Seconds(1);
                    Report.Screenshot("DHCPReserv_List", myTable.Element, true);
                }
            }
        }
        public void Choose_Any_MAC_Filtering_To_Delete(string argument1, string argument2, string argument3, string argument4, string argument5, string argument6)
        {
            //This method is to select any MAC filter rules to delete
            //argument1 - MAC Address0, argument2- MAC Address1
            //argument3 - MAC Address3, argument4 - MAC Address4
            //argument5 - MAC Address5

            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[#'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_Any_MAC_Filtering_Rules").Checked = false;
                return;
            }
            else
            {
                Report.Info(" There are " + totalMACFilterRules + " MAC Filter Rules 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 == 4)
                        {
                            // check if Mac address is matching
                            //Report.Info("----------------- click delete checkbox ------");
                            if (macAddress == macAddress1)
                            {
                                isMatch = true;
                                //Report.Info("----------------- Rules Matches !!! ------");
                                String newPath = "";
                                newPath = MacCol.GetPath() + "/input[#'macFilterTable-Delete-" + delCheck + "']";
                                Ranorex.InputTag MACFilterTableDeleteTag = newPath;
                                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);
                                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
                {
                    Report.Info(" ===== This Rule does not exist =====");
                    Delay.Seconds(1);
                    Report.Screenshot("MAC_Filtering", myTable.Element, true);
                }
            }           //end of IF-ELSE
        }