public void Validate_IPv6_IPv4_Menu_Items(string argument1) { Delay.Seconds(5); WebDocument webDocument = "/dom[@domain='192.168.0.1']"; webDocument.WaitForDocumentLoaded(); Report.Info("Modem_Env Environment : " + argument1); //TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'ConnectionTable']"); Ranorex.UlTag menuUITag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//ul[#'menu']"); IList <LiTag> menuCounts = menuUITag.FindChildren <LiTag>(); //counting menu items int menuItemsCount = menuCounts.Count; Report.Info("menuItemsCount : " + menuItemsCount.ToString()); Boolean isAdvancedTrue = true, isAdminTrue = true; Ranorex.ATag advancedTag = null; Ranorex.ATag homeTag = null; Ranorex.ATag connectedDevicesTag = null; Ranorex.ATag adminTag = null; Ranorex.ATag modemModeTag = null; String newPath = ""; Ranorex.ATag wirelessTag = null; Ranorex.ATag securityTag = null; Ranorex.ATag toolsTag = null; string environment = argument1; if (argument1 == "IPv6") // modem environment { Report.Info(" It is IPv6"); if (menuItemsCount > 4) { Report.Failure(" Other than Home,Connected Devices, Advance Settings and Admin menu items are present in the screen"); return; } foreach (LiTag col in menuCounts) { // Report.Info(col.InnerText); IList <ATag> aVals = col.Find <ATag>("./a"); foreach (ATag aVal in aVals) { string menuItem = aVal.InnerText.ToString(); Report.Info(" menuItem Name: "+ menuItem + " : is present"); //if((menuItem.Trim().StartsWith("Home")) || (menuItem.Trim().StartsWith("Modem Mode" ))|| (menuItem.Trim().StartsWith("Admin") )){ if (menuItem.Trim().StartsWith("Home")) { Report.Success("Home menu item exist "); // String newPath = ""; newPath = aVal.GetPath().ToString(); // Report.Info("newPath : " + newPath); homeTag = newPath; Report.Screenshot(homeTag.Element, true); } else if (menuItem.Trim().StartsWith("Connected devices")) { Report.Success("Connected devices menu item exist "); // String newPath = ""; newPath = aVal.GetPath().ToString(); // Report.Info("newPath : " + newPath); connectedDevicesTag = newPath; Report.Screenshot(connectedDevicesTag.Element, true); } else if (menuItem.Trim().StartsWith("Advanced settings")) { isAdvancedTrue = true; // get path of Advanced settings element // String newPath = ""; newPath = aVal.GetPath().ToString(); //+ "/input[#'macFilterTable-Delete-"+delCheck+"']"; // Report.Info("newPath : " + newPath); //Ranorex.InputTag MACFilterTableDeleteTag = newPath; //Ranorex.ATag adminTag = newPath; advancedTag = newPath; advancedTag.Click(); Delay.Seconds(5); IList <LiTag> advancedMenuCounts = col.FindDescendants <LiTag>(); //counting menu items int advancedMenuCount = advancedMenuCounts.Count; Report.Info("advancedMenuCount" + advancedMenuCount.ToString()); foreach (LiTag col1 in advancedMenuCounts) { IList <ATag> aVals1 = col1.Find <ATag>("./a"); foreach (ATag aVal1 in aVals1) { string menuItem1 = aVal1.InnerText.ToString(); if (menuItem1.Equals("Wireless")) { isAdvancedTrue = true; Report.Success(" menuItem : "+ menuItem1 + " : is present under Advanced settings menu"); newPath = aVal1.GetPath().ToString(); // Report.Info("Wireless newPath : " + newPath); wirelessTag = newPath; wirelessTag.Click(); Delay.Seconds(5); Report.Screenshot(wirelessTag.Element, true); IList <LiTag> wirelessMenuCounts = col1.FindDescendants <LiTag>(); //Wireless counting menu items // int wirelessMenuCount = wirelessMenuCounts.Count; // Report.Info("wirelessMenuCount" + wirelessMenuCounts.ToString()); // IList<ATag> aVals2 = aVal1.Find<ATag>("./a"); // Report.Info(aVals2.Count.ToString()); isAdvancedTrue = this.validate_wireless_menu(wirelessMenuCounts); // Validate Wireless menu items break; } else if (menuItem1.StartsWith("Security")) { isAdvancedTrue = true; Report.Success(" menuItem : "+ menuItem1 + " : is present under Advanced settings menu"); newPath = aVal1.GetPath().ToString(); // Report.Info("Security newPath : " + newPath); securityTag = newPath; securityTag.Click(); Delay.Seconds(5); Report.Screenshot(securityTag.Element, true); IList <LiTag> securityMenuCounts = col1.FindDescendants <LiTag>(); //counting Security menu items Report.Success( " menuItem : " + menuItem1 + " : is present under Advanced settings menu"); if (securityMenuCounts.Count == 0) { // This is Advanced settings/Wireless/Security menu Report.Info(" menuItem : "+ menuItem1 + " : is present under (Advanced settings/Wireless) menu"); } else { isAdvancedTrue = this.validate_security_menu(securityMenuCounts, environment); // Validate Advanced settings/Security menu items } break; } else if (menuItem1.StartsWith("DHCP")) { Report.Success(" menuItem(DHCP) : "+ menuItem1 + " : is present under Advanced settings menu"); isAdvancedTrue = true; break; } else if (menuItem1.StartsWith("UPnP")) { Report.Success(" menuItem(UPnP) : "+ menuItem1 + " : is present under Advanced settings menu"); isAdvancedTrue = true; break; } else if (menuItem1.StartsWith("Tools")) { Report.Success(" menuItem(Tools) : "+ menuItem1 + " : is present under Advanced settings menu"); isAdvancedTrue = true; newPath = aVal1.GetPath().ToString(); // Report.Info("Tools newPath : " + newPath); toolsTag = newPath; toolsTag.Click(); Delay.Seconds(5); Report.Screenshot(toolsTag.Element, true); IList <LiTag> toolsMenuCounts = col1.FindDescendants <LiTag>(); //counting Tools menu items Report.Success( " menuItem : " + menuItem1 + " : is present under Advanced settings menu"); isAdvancedTrue = this.validate_tools_menu(toolsMenuCounts); // Validate Tools menu items break; } else //else // Report.Info( " menuItem ( else condition) : " + menuItem1 + " : is present under Advanced menu"); // check the menu item is other than 16 menu items { isAdvancedTrue = true; break; } } } Report.Screenshot(advancedTag.Element, true); } else if (menuItem.Trim().StartsWith("Admin")) { Report.Success("Admin menu item exist in IPv6 mode "); newPath = aVal.GetPath().ToString(); // Report.Info("Admin newPath : " + newPath); adminTag = newPath; Report.Screenshot(adminTag.Element, true); isAdminTrue = true; adminTag.Click(); Delay.Seconds(5); IList <LiTag> adminMenuCounts = col.FindDescendants <LiTag>(); //counting menu items this.validate_admin_menu(adminMenuCounts); } else if (menuItem.Trim().StartsWith("Modem mode")) { isAdvancedTrue = false; Report.Failure("Modem mode Menu items exist in Ipv6 mode"); } } // end of forloop } //end of forloop - menuCounts } else if (argument1 == "IPv4") { Report.Info(" It is IPv4"); if (menuItemsCount != 5) // gateway mode { Report.Success(" All the menu items are not present in the screen"); return; } foreach (LiTag col in menuCounts) { // Report.Info(col.InnerText); IList <ATag> aVals = col.Find <ATag>("./a"); foreach (ATag aVal in aVals) { string menuItem = aVal.InnerText.ToString(); Report.Info(" menuItem Name: "+ menuItem + " : is present"); //if((menuItem.Trim().StartsWith("Home")) || (menuItem.Trim().StartsWith("Modem Mode" ))|| (menuItem.Trim().StartsWith("Admin") )){ if (menuItem.Trim().StartsWith("Home")) { isAdvancedTrue = true; Report.Success("Home menu item exist "); // String newPath = ""; newPath = aVal.GetPath().ToString(); // Report.Info("newPath : " + newPath); homeTag = newPath; Report.Screenshot(homeTag.Element, true); } else if (menuItem.Trim().StartsWith("Connected devices")) { isAdvancedTrue = true; Report.Success("Connected devices menu item exist "); // String newPath = ""; newPath = aVal.GetPath().ToString(); // Report.Info("newPath : " + newPath); connectedDevicesTag = newPath; Report.Screenshot(connectedDevicesTag.Element, true); } else if (menuItem.Trim().StartsWith("Modem mode")) { isAdvancedTrue = true; Report.Success("Modem mode Menu items exist in Ipv4 mode"); newPath = aVal.GetPath().ToString(); // Report.Info("newPath : " + newPath); modemModeTag = newPath; Report.Screenshot(modemModeTag.Element, true); } else if (menuItem.Trim().StartsWith("Advanced settings")) { isAdvancedTrue = true; Report.Success("Advanced settings Menu items exist in Ipv4 mode"); // String newPath = ""; newPath = aVal.GetPath().ToString(); //+ "/input[#'macFilterTable-Delete-"+delCheck+"']"; // Report.Info("Advanced settings newPath : " + newPath); //Ranorex.InputTag MACFilterTableDeleteTag = newPath; //Ranorex.ATag adminTag = newPath; advancedTag = newPath; advancedTag.Click(); Delay.Seconds(5); IList <LiTag> advancedMenuCounts = col.FindDescendants <LiTag>(); //counting menu items int advancedMenuCount = advancedMenuCounts.Count; Report.Info("Advanced settings MenuCount : " + advancedMenuCount.ToString()); foreach (LiTag col1 in advancedMenuCounts) { IList <ATag> aVals1 = col1.Find <ATag>("./a"); foreach (ATag aVal1 in aVals1) { string menuItem1 = aVal1.InnerText.ToString(); if (menuItem1.Equals("Wireless")) { isAdvancedTrue = true; Report.Success(" menuItem : "+ menuItem1 + " : is present under Advanced settings menu"); newPath = aVal1.GetPath().ToString(); // Report.Info("Wireless newPath : " + newPath); wirelessTag = newPath; wirelessTag.Click(); Delay.Seconds(5); Report.Screenshot(wirelessTag.Element, true); IList <LiTag> wirelessMenuCounts = col1.FindDescendants <LiTag>(); //counting menu items int wirelessMenuCount = wirelessMenuCounts.Count; Report.Info("wirelessMenuCount" + wirelessMenuCount.ToString()); // IList<ATag> aVals2 = aVal1.Find<ATag>("./a"); // Report.Info(aVals2.Count.ToString()); this.validate_wireless_menu(wirelessMenuCounts); break; } else if (menuItem1.StartsWith("Security")) { isAdvancedTrue = true; Report.Success(" menuItem : "+ menuItem1 + " : is present under Advanced settings menu"); newPath = aVal1.GetPath().ToString(); // Report.Info("Security newPath : " + newPath); securityTag = newPath; securityTag.Click(); Delay.Seconds(5); Report.Screenshot(securityTag.Element, true); IList <LiTag> securityMenuCounts = col1.FindDescendants <LiTag>(); //counting Security menu items Report.Success( " menuItem : " + menuItem1 + " : is present under Advanced settings menu"); if (securityMenuCounts.Count == 0) { // This is Advanced settings/Wireless/Security menu Report.Info(" menuItem : "+ menuItem1 + " : is present under (Advanced settings/Wireless) menu"); } else { isAdvancedTrue = this.validate_security_menu(securityMenuCounts, environment); // Validate Advanced settings/Security menu items } break; } else if (menuItem1.StartsWith("DHCP")) { isAdvancedTrue = true; Report.Success(" menuItem : "+ menuItem1 + " : is present under Advanced settings menu"); break; } else if (menuItem1.StartsWith("UPnP")) { isAdvancedTrue = true; Report.Success(" menuItem : "+ menuItem1 + " : is present under Advanced settings menu"); break; } else if (menuItem1.StartsWith("Tools")) { Report.Success(" menuItem : "+ menuItem1 + " : is present under Advanced settings menu"); isAdvancedTrue = true; newPath = aVal1.GetPath().ToString(); // Report.Info("Tools newPath : " + newPath); toolsTag = newPath; toolsTag.Click(); Delay.Seconds(5); Report.Screenshot(toolsTag.Element, true); IList <LiTag> toolsMenuCounts = col1.FindDescendants <LiTag>(); //counting Tools menu items Report.Success( " menuItem : " + menuItem1 + " : is present under Advanced settings menu"); isAdvancedTrue = this.validate_tools_menu(toolsMenuCounts); // Validate Tools menu items break; } /* * else if(menuItem1.StartsWith("MAC filtering")){ * isAdvancedTrue = true; * Report.Success( " menuItem : " + menuItem1 + " : is present under Advanced settings menu"); * }else if(menuItem1.StartsWith("DMZ")){ * isAdvancedTrue = true; * Report.Success( " menuItem : " + menuItem1 + " : is present under Advanced settings menu"); * } */ else { // Report.Success( " menuItem : " + menuItem1 + " : is present under Advanced settings menu"); // check the menu item is other than 19 menu items isAdvancedTrue = true; } } } Report.Screenshot(advancedTag.Element, true); } else if (menuItem.Trim().StartsWith("Admin")) { Report.Success("Admin menu item exist in IPv4 mode "); isAdminTrue = true; newPath = aVal.GetPath().ToString(); // Report.Info("newPath : " + newPath); adminTag = newPath; Report.Screenshot(adminTag.Element, true); adminTag.Click(); Delay.Seconds(5); IList <LiTag> adminMenuCounts = col.FindDescendants <LiTag>(); //counting menu items /* * int adminMenuCount = adminMenuCounts.Count; * Report.Info("adminMenuCount : " + adminMenuCount.ToString()); * foreach(LiTag col1 in adminMenuCounts) * { * IList<ATag> aVals1 = col1.Find<ATag>("./a"); * foreach(ATag aVal1 in aVals1){ * string menuItem1 = aVal1.InnerText.ToString(); * // Report.Success( " menuItem : " + menuItem1 + " : is present under Admin menu"); * if(menuItem1.StartsWith("Change password")){ * isAdminTrue = true; * Report.Success( " menuItem : " + menuItem1 + " : is present under Admin menu"); * }else if(menuItem1.StartsWith("Reload and Reboot")){ * isAdminTrue = true; * Report.Success( " menuItem : " + menuItem1 + " : is present under Admin menu"); * }else if(menuItem1.StartsWith("Remote access")){ * isAdminTrue = true; * Report.Success( " menuItem : " + menuItem1 + " : is present under Admin menu"); * }else if(menuItem1.StartsWith("Info")){ * isAdminTrue = true; * Report.Success( " menuItem : " + menuItem1 + " : is present under Admin menu"); * }else{ * isAdminTrue = false; * Report.Failure( " menuItem : " + menuItem1 + " : is present under Admin menu"); * } * } * } */ // Report.Info("validate_admin_menu " + this.validate_admin_menu(adminMenuCounts)); this.validate_admin_menu(adminMenuCounts); } } // end of forloop } //end of forloop - menuCounts } //if-else if (!isAdvancedTrue || !isAdminTrue) { Report.Failure("Different Menu items exist in IPv6/IPv4 mode"); } else { Report.Success("All the required menu item exists !!! "); Report.Screenshot(menuUITag.Element, true); } }
public void Is_MM_Admin_Menu_Remote_Access_Visible() { //Verify if MM_Admin_Menu_Remote_Access_Visible Delay.Seconds(5); WebDocument webDocument = "/dom[@domain='192.168.100.1']"; webDocument.WaitForDocumentLoaded(); //TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'ConnectionTable']"); Ranorex.UlTag menuUITag = webDocument.FindSingle("/dom[@domain='192.168.100.1']//ul[#'menu']"); IList <LiTag> menuCounts = menuUITag.FindChildren <LiTag>(); //counting menu items int menuItemsCount = menuCounts.Count; Report.Info("menuItemsCount" + menuItemsCount.ToString()); if (menuItemsCount > 4) { Report.Failure(" Other than Home,Modem Mode and Admin menu items are present in the screen"); return; } Boolean isAdminTrue = true; Boolean isRemoteAccessTrue = false; Ranorex.ATag adminTag = null; foreach (LiTag col in menuCounts) { // Report.Info(col.InnerText); IList <ATag> aVals = col.Find <ATag>("./a"); foreach (ATag aVal in aVals) { string menuItem = aVal.InnerText.ToString(); Report.Info(" menuItem Name: "+ menuItem + " : is present"); //if((menuItem.Trim().StartsWith("Home")) || (menuItem.Trim().StartsWith("Modem Mode" ))|| (menuItem.Trim().StartsWith("Admin") )){ if (menuItem.Trim().StartsWith("Admin")) { isAdminTrue = true; //get path of Admin element //find sub menu's under admin // /dom[@domain='192.168.100.1']//li[#'Admin'] // /dom[@domain='192.168.100.1']//li[#'Admin']/ul //Ranorex.LiTag testTag = aVal; //Report.Info(LiTag.GetPath().ToString()); String newPath = ""; newPath = aVal.GetPath().ToString(); //+ "/input[#'macFilterTable-Delete-"+delCheck+"']"; // Report.Info("newPath : " + newPath); //Ranorex.InputTag MACFilterTableDeleteTag = newPath; //Ranorex.ATag adminTag = newPath; adminTag = newPath; adminTag.Click(); Delay.Seconds(5); IList <LiTag> adminMenuCounts = col.FindDescendants <LiTag>(); //counting menu items int adminMenuCount = adminMenuCounts.Count; Report.Info("adminMenuCount" + adminMenuCount.ToString()); foreach (LiTag col1 in adminMenuCounts) { IList <ATag> aVals1 = col1.Find <ATag>("./a"); foreach (ATag aVal1 in aVals1) { string menuItem1 = aVal1.InnerText.ToString(); if (menuItem1.StartsWith("Remote Access")) { isAdminTrue = false; isRemoteAccessTrue = true; break; } else { Report.Info(" menuItem : "+ menuItem1 + " : is present under Admin menu"); isAdminTrue = true; } } } Report.Screenshot(adminTag.Element, true); } //end of menuitem check } } if (!isAdminTrue) { Report.Failure("Different Menu items exist"); if (isRemoteAccessTrue) { Report.Failure("Remote Access Menu items exist"); } } else { Report.Success("Admin menu item exist with required menu items"); Report.Success("Remote Access Menu item does not exist"); Report.Screenshot(menuUITag.Element, true); } }
public void Is_Advanced_settings_Tools_Menu_Visible() { //Advanced_settings_Tools_Menu should be Visible Delay.Seconds(5); WebDocument webDocument = "/dom[@domain='192.168.100.1']"; webDocument.WaitForDocumentLoaded(); //TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'ConnectionTable']"); Ranorex.UlTag menuUITag = webDocument.FindSingle("/dom[@domain='192.168.100.1']//ul[#'menu']"); IList <LiTag> menuCounts = menuUITag.FindChildren <LiTag>(); //counting menu items int menuItemsCount = menuCounts.Count; Report.Info("menuItemsCount" + menuItemsCount.ToString()); if (menuItemsCount > 4) { Report.Failure(" Other than Home,Modem Mode,Advanced settings and Admin menu items are present in the screen"); return; } // Boolean isAdminTrue =true; // Boolean isRemoteAccessTrue = false; Boolean isAdvancedsettingsTrue = true; Boolean isAdvancedsettingsToolsTrue = true; Boolean isNetworkStatusTrue = true; // Ranorex.ATag adminTag = null; Ranorex.ATag AdvancedsettingsTag = null; Ranorex.ATag AdvancedsettingsToolsTag = null; foreach (LiTag col in menuCounts) { // Report.Info(col.InnerText); IList <ATag> aVals = col.Find <ATag>("./a"); foreach (ATag aVal in aVals) { string menuItem = aVal.InnerText.ToString(); Report.Info(" menuItem Name: "+ menuItem + " : is present"); //if((menuItem.Trim().StartsWith("Home")) || (menuItem.Trim().StartsWith("Modem Mode" ))|| (menuItem.Trim().StartsWith("Admin") )){ if (menuItem.Trim().StartsWith("Advanced settings")) { // isAdminTrue = true; //get path of Admin element //find sub menu's under admin // /dom[@domain='192.168.100.1']//li[#'Admin'] // /dom[@domain='192.168.100.1']//li[#'Admin']/ul //Ranorex.LiTag testTag = aVal; //Report.Info(LiTag.GetPath().ToString()); isAdvancedsettingsTrue = true; String newPath = ""; newPath = aVal.GetPath().ToString(); //+ "/input[#'macFilterTable-Delete-"+delCheck+"']"; // Report.Info("newPath : " + newPath); //Ranorex.InputTag MACFilterTableDeleteTag = newPath; //Ranorex.ATag adminTag = newPath; AdvancedsettingsTag = newPath; AdvancedsettingsTag.Click(); Delay.Seconds(5); IList <LiTag> advancedsettingsMenuCounts = col.FindDescendants <LiTag>(); //counting menu items int advancedsettingsMenuCount = advancedsettingsMenuCounts.Count; Report.Info("advancedsettingsMenuCount :" + advancedsettingsMenuCount.ToString()); foreach (LiTag col1 in advancedsettingsMenuCounts) { IList <ATag> aVals1 = col1.Find <ATag>("./a"); foreach (ATag aVal1 in aVals1) { string menuItem1 = aVal1.InnerText.ToString(); Report.Info("menuItem name :" + menuItem1); if (menuItem1.StartsWith("Tools")) { isAdvancedsettingsToolsTrue = true; isAdvancedsettingsTrue = true; Report.Info(" menuItem : "+ menuItem1 + " : is present under Advancedsettings menu"); // check if network status menu item is present under tools // IList <LiTag> advancedsettingsToolsMenuCounts = col1.FindDescendants <LiTag>(); //counting menu items int advancedsettingsToolsMenuCount = advancedsettingsToolsMenuCounts.Count; Report.Info("advancedsettingsToolsMenuCount :" + advancedsettingsToolsMenuCount.ToString()); //check the sub menu items under tools foreach (LiTag col2 in advancedsettingsToolsMenuCounts) { IList <ATag> aVals2 = col2.Find <ATag>("./a"); foreach (ATag aVal2 in aVals2) { string menuItem2 = aVal2.InnerText.ToString(); Report.Info("menuItem name(under tools) :" + menuItem2); if (menuItem1.StartsWith("Network status")) { isNetworkStatusTrue = true; Report.Info(" menuItem : "+ menuItem1 + " : is present under Advancedsettings-Tools menu"); break; } else { // Report.Info( " menuItem : " + menuItem1 + " : is NOT present under Advancedsettings-Tools menu"); isNetworkStatusTrue = true; } } } String newPath_Tools = ""; newPath_Tools = aVal1.GetPath().ToString(); AdvancedsettingsToolsTag = newPath_Tools; AdvancedsettingsToolsTag.Click(); Delay.Seconds(5); break; } else if (menuItem1.StartsWith("Network status")) { Report.Info(" menuItem : "+ menuItem1 + " : is present under Advancedsettings menu"); } else { Report.Info(" menuItem : "+ menuItem1 + " : is present under Advancedsettings menu"); isAdvancedsettingsToolsTrue = false; } } } Report.Screenshot(AdvancedsettingsTag.Element, true); } //end of menuitem check } } //end of for-loop if (!isAdvancedsettingsTrue) //if Advancedsettings is not present { Report.Failure("Advancedsettings Menu items does not exist"); } else //if Advancedsettings is present { Report.Success("Advancedsettings menu item exist with required sub menu items"); if (isAdvancedsettingsToolsTrue) { Report.Success(" Tools Menu item does exist under Advancedsettings menu "); if (isNetworkStatusTrue) { Report.Success(" NetworkStatus Menu item does exist under AdvancedsettingsTools menu "); } else { Report.Failure(" NetworkStatus Menu item does NOT exist under AdvancedsettingsTools menu "); } Report.Screenshot(menuUITag.Element, true); } else { Report.Failure("AdvancedsettingsTools Menu items does not exist"); Report.Screenshot(menuUITag.Element, true); } } }
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 } }