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 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); } }