void DHCP_Reserve_Rules() { WebDocument webDocument = "/dom[@domain='192.168.0.1']"; webDocument.WaitForDocumentLoaded(); Delay.Seconds(30); TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'dhcpClientsTable']"); // /dom[@domain='192.168.0.1']//table[#'dhcpClientsTable'] IList <TrTag> rows = myTable.Find <TrTag>("./tbody//tr"); int rowsCnt = rows.Count; //if it is just 1 row need to check if it is an invalid filter - No reserved rule! if (rowsCnt == 1) { IList <TdTag> cols = myTable.Find <TdTag>("./tbody//td"); foreach (TdTag MacCol in cols) { //Report.Info("Column",j.ToString()); Report.Info(MacCol.InnerText); if (MacCol.InnerText.ToString().StartsWith("No reserved rule")) //No reserved rule! --R3.7 //Report.Info("No DHCP filtering rule exists !!!"); { Report.Success("DHCP Filter ", "There are No DHCP rule exists !!"); return; } else { break; } } } Report.Info("DHCP_Resv Rule(s) ", rowsCnt.ToString()); }
public void Validate_DHCPv6_Configuration_Parameters() { //Validate_DHCPv6_Configuration Report.Info("Validate_DHCPv6_Configuration"); WebDocument webDocument = "/dom[@domain='192.168.0.1']"; TableTag myTable1 = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'DHCPv6server']/table"); // Ranorex.InputTag IPv4FirewallProtectTag ="/dom[@domain='192.168.0.1']//div[#'tr_EnableFirewall']/input[#'EnableFirewall']"; //count the rows IList <TrTag> rows1 = myTable1.Find <TrTag>("./tbody//tr"); TotalRows1 = rows1.Count; Report.Info("Total rows ", TotalRows1.ToString()); if (TotalRows1 > 0) { int rowNum = 1; IList <TrTag> rows = myTable1.Find <TrTag>("./tbody//tr"); // Report.Info("rows(tr)",rows.Count.ToString()); //walkthrough all the columns foreach (TrTag row in myTable1.Find("./ tbody /tr")) { if (rowNum > 1) { int colNum = 1; // Get all cells from the row /* rowInfo += " All Cells : "; */ foreach (TdTag cell in row.Find("./ td")) { /* rowInfo += cell . InnerText + ", "; */ // if(colNum == 1 || colNum == 3 ){ // Report . Info ("cell info: ", cell.InnerText); // } // Move the mouse to each cell element cell.MoveTo(); // Set css style cell.SetStyle(" background - color ", " #33 ff00 "); colNum++; } //Report . Info ( rowInfo ); } rowNum++; } /* * IList<TdTag> cols = myTable1.Find<TdTag>("./tbody//td"); * foreach(TdTag col in cols) * { * Report.Info(col.InnerText); * colNum++; * }//end of forloop */ } // Report.Screenshot(); Report.Screenshot("DHCPv6server", myTable1.Element, true); }
void Count_Ipv6_PortFiltering_Rules() { //count total number of port triggering rules Report.LogHtml(ReportLevel.Info, "TestCase", "<b>IPv6_PortFiltering Count</b>"); int TotalRows = 0; Delay.Seconds(60); WebDocument webDocument1 = "/dom[@domain='192.168.0.1']"; webDocument1.WaitForDocumentLoaded(); TableTag myTable1 = webDocument1.FindSingle("/dom[@domain='192.168.0.1']//table[#'ipv6FilterTable']"); IList <TrTag> rows1 = myTable1.Find <TrTag>("./tbody//tr"); TotalRows = rows1.Count; Ranorex.Report.Success(" Total Number of Rows in the table : " + TotalRows.ToString()); //Report.Info(" Ipv4_PortFiltering_Rules",TotalRows.ToString()); // Report.Info(" IP_PortFilter",Total_Rules); //Ranorex.Report.Failure("Failure Message"); //Report.LogHtml(ReportLevel.Info, "Link", "<a href='http://www.ranorex.com/'>Visit www.ranorex.com</a>"); // Report.LogHtml(ReportLevel.Info, "Link", "<a href='http://www.virginmedia.com/'>Visit www.virginmedia.com</a>"); //<b>and this is bold text</b> int j = 1; bool isRuleExist = true; String Total_Rules = ""; if (TotalRows > 0) { IList <TdTag> cols = myTable1.Find <TdTag>("./tbody//td"); Ranorex.Report.Info(" Total cols : " + cols.Count.ToString()); foreach (TdTag col in cols) { // Report.Info(" col value : " + col.InnerText.ToString()); if (j == 1 && TotalRows == 1 && col.InnerText.ToString().StartsWith("No filtering rule applied!")) { isRuleExist = false; //return; Report.Info(" There are no active IPv6 and Port Filtering rules "); TotalRows = -1; break; } else { Total_Rules = "Totally, There are " + TotalRows.ToString() + " Rules"; // Ranorex.Report.Success(Total_Rules); isRuleExist = true; break; } } if (isRuleExist) { // Report.Info(" Total Rules",TotalRows.ToString()); Report.Info(Total_Rules); // Report.Info(" Total IPv6 and Port Filtering Rules : " + TotalRows.ToString()); } } }
public void Validate_WPS_PIN() { 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; foreach(TdTag col in cols) { Report.Info("WPS PIN Value",col.InnerText); Report.Info("WPS PIN Length",col.InnerText.Length.ToString()); if(col.InnerText.Length < 8){ isValidPIN = false; } 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); }
private void Init() { // Your recording specific initialization code goes here. Delay.Seconds(20); WebDocument webDocument1 = "/dom[@domain='192.168.0.1']"; webDocument1.WaitForDocumentLoaded(); TableTag myTable1 = webDocument1.FindSingle("/dom[@domain='192.168.0.1']//table[#'macAddressFilterTable']"); //highlight the new MACFiltering rule IList <TrTag> rows1 = myTable1.Find <TrTag>("./tbody//tr"); TotalRows = rows1.Count; Report.Info("------Inside Init()------ TotalRows", TotalRows.ToString()); if (TotalRows == 1) { foreach (var row in rows1) { IList <TdTag> cols = row.Find <TdTag>("./td"); string tempColCount = cols.Count.ToString(); initColCount = Int32.Parse(tempColCount); Report.Info("initColCount : " + initColCount.ToString()); } } }
public void Count_List_Of_Reserv_List() { Delay.Seconds(30); WebDocument webDocument = "/dom[@domain='192.168.0.1']"; webDocument.WaitForDocumentLoaded(); TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'dhcpClientsTable']"); IList <TrTag> rows = myTable.Find <TrTag>("./tbody//tr"); int rowsCnt = rows.Count; Report.Info("Total Reservation_List", rowsCnt.ToString()); if (rowsCnt == 32) { Report.Info("Total Reservation_List", rowsCnt.ToString()); TestSuite.Current.GetTestCase("DHCP_Reservation_Add_Rule1").Checked = true; } else if (rowsCnt < 32) { Report.Info("Total No of Reservation_List is less than 32"); TestSuite.Current.GetTestCase("DHCP_Reservation_Add_Rule1").Checked = false; } else { Report.Info("Total No of Reservation_List is more than 32"); TestSuite.Current.GetTestCase("DHCP_Reservation_Add_Rule1").Checked = false; } }
void Count_Ipv4_PortFiltering_Rules() { //count total number of port triggering rules Report.LogHtml(ReportLevel.Info, "TestCase", "<b>IPv4_PortFiltering Count</b>"); int TotalRows = 0; Delay.Seconds(30); WebDocument webDocument1 = "/dom[@domain='192.168.0.1']"; webDocument1.WaitForDocumentLoaded(); // Delay.Seconds(40); TableTag myTable1 = webDocument1.FindSingle("/dom[@domain='192.168.0.1']//table[#'ipv4FilterTable']"); IList <TrTag> rows1 = myTable1.Find <TrTag>("./tbody//tr"); TotalRows = rows1.Count; if (TotalRows == 1) { // int rowNum = 1; foreach (var row in rows1) { // Report.Info("Row: " + rowNum); // Report.Info(row.GetInnerHtml().ToString()); IList <TdTag> cols = row.Find <TdTag>("./td"); // int colNum = 1; int colCnt = cols.Count; // Report.Info(" No of cols : " + colCnt.ToString()); if (colCnt == 1) //if there is only one column - //No filtering rule applied! { foreach (TdTag MacCol in cols) { // Report.Info("MacCol: " + colNum); String colVal = MacCol.InnerText.ToString(); // Report.Info("MacCol Info: "+MacCol.InnerText); // Report.Info("MacCol Info: " + colVal); if (colVal.StartsWith("No filtering rule")) { Report.Info("There are No filtering rule !"); //Report.LogHtml(ReportLevel.Info, "Link", "<a href='http://www.ranorex.com/'>Visit www.ranorex.com</a>"); Report.LogHtml(ReportLevel.Info, "Link", "<a href='http://www.virginmedia.com/'>Visit www.virginmedia.com</a>"); //<b>and this is bold text</b> } } } else { String Total_Rules = " There is only " + TotalRows.ToString() + " rule exist"; Ranorex.Report.Success(Total_Rules); } } } else { String Total_Rules = "Totally, There are " + TotalRows.ToString() + " Rules"; //Report.Info(" Ipv4_PortFiltering_Rules",TotalRows.ToString()); // Report.Info(" IP_PortFilter",Total_Rules); Ranorex.Report.Success(Total_Rules); //Ranorex.Report.Failure("Failure Message"); } }
public void Add_Existing_Port_Triggering_Rules() { //Add_Existing_Port_Triggering_Rules WebDocument webDocument = "/dom[@domain='192.168.0.1']"; TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'portTriggeringTable']"); //highlight the new port triggering rule IList <TrTag> rows = myTable.Find <TrTag>("./tbody//tr"); int rowsCnt = rows.Count; Report.Info("Total Rules(After Add)", rowsCnt.ToString()); if (TotalRows > 1 && TotalRows == rowsCnt) // no rows are added { Report.Success("PortTriggerRule", "Unable to add this new rule because of the below reasons !!! "); myTable.EnsureVisible(); Delay.Seconds(5); //Report.Screenshot("PortTriggerRule",myTable.Element,true); Report.Screenshot(); } else { Report.Failure("PortTriggerRule", "Duplicate Rules Area added to the table"); myTable.EnsureVisible(); Delay.Seconds(5); //Report.Screenshot("PortTriggerRule",myTable.Element,true); Report.Screenshot(); } }
private void Validate_Admin_Password__Change_Screen() { Delay.Seconds(30); 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[#'LoginSettings']/table"); //Count the total no of rows IList <TrTag> totalDeviceRows = myTable.Find <TrTag>("./tbody//tr"); int rulesCount = totalDeviceRows.Count; Report.Info(" LoginSettings Password Table Rows : " + rulesCount); // bool isSuccess=true; if (rulesCount == 3) { int rowNum = 1; foreach (var row in totalDeviceRows) { IList <TdTag> cols = row.Find <TdTag>("./td"); int colNum = 1; foreach (TdTag MacCol in cols) { if (colNum == 1) { Report.Info("Col Info: " + MacCol.InnerText); //validate lable values } if (colNum == 2) { IList <SpanTag> spanVals = MacCol.Find <SpanTag>("./span"); if (spanVals.Count == 1) { Report.Success("Password field validation is Success"); } /* * 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 = ""; * } * } */ } colNum++; } //end of Column rowNum++; } //end of ROW } else { Report.Failure("Issue with page display !!"); } }
public int pfRules_Count() { Delay.Seconds(15); WebDocument webDocument1 = "/dom[@domain='192.168.0.1']"; webDocument1.WaitForDocumentLoaded(); // TableTag myTable1 = webDocument1.FindSingle("/dom[@domain='192.168.0.1']//table[#'portTriggeringTable']"); TableTag myTable1 = webDocument1.FindSingle("/dom[@domain='192.168.0.1']//table[#'PortForwardingTable']"); IList <TrTag> rows1 = myTable1.Find <TrTag>("./tbody//tr"); int TotalRows = rows1.Count; // Report.Info(" Total Rules",TotalRows.ToString()); int j = 1; bool isRuleExist = true; if (TotalRows > 0) { IList <TdTag> cols = myTable1.Find <TdTag>("./tbody//td"); foreach (TdTag col in cols) { //if(j == 1 && col.InnerText.StartsWith("No forwarding rule!")){ // R3.6 if (j == 1 && col.InnerText.StartsWith("No forwarding rule applied!")) { isRuleExist = false; //return; Report.Info(" There are no active port forwarding rules "); TotalRows = -1; break; } else { isRuleExist = true; break; } } if (isRuleExist) { Report.Info(" Total Rules", TotalRows.ToString()); } } return(TotalRows); }
private void Init() { // Your recording specific initialization code goes here. WebDocument webDocument1 = "/dom[@domain='192.168.0.1']"; TableTag myTable1 = webDocument1.FindSingle("/dom[@domain='192.168.0.1']//table[#'portTriggeringTable']"); //highlight the new port triggering rule IList <TrTag> rows1 = myTable1.Find <TrTag>("./tbody//tr"); TotalRows = rows1.Count; Report.Info(" TotalRows(Before Add)", TotalRows.ToString()); }
void Count_MAC_Filtering_Lists() { //count total number of port triggering rules // Report.Info("---- Count_MAC_Filtering_Lists -----"); int TotalRows = 0; WebDocument webDocument1 = "/dom[@domain='192.168.0.1']"; webDocument1.WaitForDocumentLoaded(); Delay.Seconds(40); //TableTag myTable1 = webDocument1.FindSingle("/dom[@domain='192.168.0.1']//table[#'macAddressFilterTable']"); TableTag myTable1 = webDocument1.FindSingle("/dom[@domain='192.168.0.1']//table[#'macFilterTable']"); IList <TrTag> rows1 = myTable1.Find <TrTag>("./tbody//tr"); TotalRows = rows1.Count; // if it is just 1 row need to check if it is an invalid filter // Report.Info("---- Total rows : " + TotalRows); if (TotalRows == 1) { IList <TdTag> cols = myTable1.Find <TdTag>("./tbody//td"); foreach (TdTag MacCol in cols) { //Report.Info("Column",j.ToString()); Report.Info(MacCol.InnerText); if (MacCol.InnerText.ToString().StartsWith("No MAC filtering rule")) //No MAC filtering rule! --R3.8 // No MAC filtering rule! //Report.Info("No MAC filtering rule exists !!!"); // Report.Failure("Wireless_Filter ","No MAC filtering rule!!"); { Report.Success("Wireless_Filter ", "No MAC filtering rule!!"); return; } else { break; } } } Report.Info("MAC_Filtering", TotalRows.ToString()); }
private void Init() { // Your recording specific initialization code goes here. Delay.Seconds(15); WebDocument webDocument1 = "/dom[@domain='192.168.0.1']"; TableTag myTable1 = webDocument1.FindSingle("/dom[@domain='192.168.0.1']//table[#'macAddressFilterTable']"); //highlight the new MACFiltering rule IList <TrTag> rows1 = myTable1.Find <TrTag>("./tbody//tr"); TotalRows = rows1.Count; Report.Info("------Inside Init()------ TotalRows", TotalRows.ToString()); }
public void CountRowsWithFind() { TableTag myTable = "/dom[@domain>'edgewordstraining.co.uk']//div[#'formResults']/table"; int numRows = myTable.Find(".//tr").Count; // Note ".//tr" *not* "//tr" - which would start the search from root, instead of inside table // //Find returns a collection so the above is equivalent to: // IList<Ranorex.Adapter> myCollection = myTable.Find(".//tr"); // int numRows = myCollection.Count; Report.Info("Num rows = " + numRows); }
private void Init() { // Your recording specific initialization code goes here. Delay.Seconds(30); WebDocument webDocument1 = "/dom[@domain='192.168.0.1']"; webDocument1.WaitForDocumentLoaded(); TableTag myTable1 = webDocument1.FindSingle("/dom[@domain='192.168.0.1']//table[#'PortForwardingTable']"); // As per R3.11 (9.1.116BA) // TableTag myTable1 = webDocument1.FindSingle("/dom[@domain='192.168.0.1']//table[#'portTriggeringTable']"); //As per R3.5 (9.1.116J) //Report.Screenshot("New Port Triggering Rule", myTable.Element,true); //highlight the new port triggering rule IList <TrTag> rows1 = myTable1.Find <TrTag>("./tbody//tr"); TotalRows = rows1.Count; //Report.Info("------Inside Init()------ TotalRows(init)----- : " ,TotalRows.ToString()); Report.Info("TotalRules(Before)", TotalRows.ToString()); IList <TdTag> cols = myTable1.Find <TdTag>("./tbody//td"); colCnts = cols.Count; Report.Info("colCnts :", colCnts.ToString()); }
private void Init() { // Your recording specific initialization code goes here. WebDocument webDocument1 = "/dom[@domain='192.168.0.1']"; webDocument1.WaitForDocumentLoaded(); Delay.Seconds(60); TableTag myTable1 = webDocument1.FindSingle("/dom[@domain='192.168.0.1']//table[#'ipv6FilterTable']"); //count the rows IList <TrTag> rows1 = myTable1.Find <TrTag>("./tbody//tr"); TotalRows1 = rows1.Count; // Report.Info("IPv6 Port Filter(init) ",TotalRows1.ToString()); }
private void Init() { // Your recording specific initialization code goes here. Report.Info("Inside init() of Choose_All_Port_Trigger_Rules "); Delay.Seconds(40); WebDocument webDocument1 = "/dom[@domain='192.168.0.1']"; webDocument1.WaitForDocumentLoaded(); TableTag myTable1 = webDocument1.FindSingle("/dom[@domain='192.168.0.1']//table[#'portTriggeringTable']"); //highlight the new port triggering rule IList <TrTag> rows1 = myTable1.Find <TrTag>("./tbody//tr"); TotalRows = rows1.Count; //Report.Info(" TotalRows(Before Add)",TotalRows.ToString()); }
private void Init() { // Your recording specific initialization code goes here. // Your recording specific initialization code goes here. WebDocument webDocument1 = "/dom[@domain='192.168.0.1']"; TableTag myTable1 = webDocument1.FindSingle("/dom[@domain='192.168.0.1']//table[#'PortForwardingTable']"); //Report.Screenshot("New Port Triggering Rule", myTable.Element,true); //highlight the new port triggering rule IList <TrTag> rows1 = myTable1.Find <TrTag>("./tbody//tr"); TotalRows = rows1.Count; Report.Info("------Inside Init()------ TotalRows(init)----- : ", TotalRows.ToString()); }
private void Init() { // Your recording specific initialization code goes here. Delay.Seconds(15); WebDocument webDocument1 = "/dom[@domain='192.168.0.1']"; TableTag myTable1 = webDocument1.FindSingle("/dom[@domain='192.168.0.1']//table[#'dhcpClientsTable']"); //dhcpClientsTable //Report.Screenshot("New Port Triggering Rule", myTable.Element,true); //highlight the new port triggering rule IList <TrTag> rows1 = myTable1.Find <TrTag>("./tbody//tr"); TotalRows = rows1.Count; Report.Info("------Inside Init() of DHCP_Reservation_Add_Reservation ----- "); Report.Info("TotalRows(Before):", TotalRows.ToString()); }
private void Init() { // Your recording specific initialization code goes here. Delay.Seconds(5); WebDocument webDocument1 = "/dom[@domain='192.168.0.1']"; webDocument1.WaitForDocumentLoaded(); TableTag myTable1 = webDocument1.FindSingle("/dom[@domain='192.168.0.1']//table[#'macAddressFilterTable']"); TableTag myTable2 = webDocument1.FindSingle("/dom[@domain='192.168.0.1']//table[#'AttachedDevicesTable']"); //count the rows IList <TrTag> rows1 = myTable1.Find <TrTag>("./tbody//tr"); IList <TrTag> rows2 = myTable2.Find <TrTag>("./tbody//tr"); TotalRows1 = rows1.Count; TotalRows2 = rows2.Count; }
public void View_Cablemodem_Status() { Delay.Seconds(30); WebDocument webDocument = "/dom[@domain='192.168.0.1']"; webDocument.WaitForDocumentLoaded(); TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'cableModemStatus']"); IList <TrTag> totalRows = myTable.Find <TrTag>("./tbody//tr"); int rowsCount = totalRows.Count; string totalRowsCnt = "Total Rows : " + rowsCount.ToString(); Report.Info("Total Items ", totalRowsCnt); Report.Screenshot("CableModem Status", myTable.Element); Delay.Seconds(2); }
public void Choose_Wireless_Device_For_Rename() { // /dom[@domain='192.168.0.1']//table[#'wireless_Device'] WebDocument webDocument = "/dom[@domain='192.168.0.1']"; TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'wireless_Device']"); //count the rows IList <TrTag> rows = myTable.Find <TrTag>("./tbody//tr"); int rowsCnt = rows.Count; //Report.Info("Total rowsCnt",rowsCnt.ToString()); Report.Info("Total Rows", rowsCnt.ToString()); if (rowsCnt == 0) { //Mouse.ScrollWheel(150); Report.Failure("Device Rename ", "There are no connected wireless devices to rename !!"); TestSuite.Current.GetTestCase("Verify_Renamed_Wireless_Device_Name").Checked = false; return; } else { //Choose_Wireless_Device_For_Rename if (rowsCnt > 0) { Report.Info(" There are " + rowsCnt.ToString() + " devices attached to this router !!! "); } int rowNum = 1; foreach (var row in rows) { Report.Info("Row: " + rowNum); Report.Info(row.GetInnerHtml().ToString()); IList <TdTag> cols = row.Find <TdTag>("./td"); Report.Info(" Total Columns(Devices) : ", 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()); colNum++; } rowNum++; } } }
public void View_Cablemodem_Status() { Delay.Seconds(30); WebDocument webDocument = "/dom[@domain='192.168.0.1']"; webDocument.WaitForDocumentLoaded(); TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'cableModemStatus']"); IList <TrTag> totalRows = myTable.Find <TrTag>("./tbody//tr"); int rowsCount = totalRows.Count; string totalRowsCnt = "Total Rows : " + rowsCount.ToString(); Report.Info("Rows ", totalRowsCnt); Report.Screenshot("CableModem Status", myTable.Element); //validate the table rows & columns if (rowsCount >= 1) { int rowNum = 1; foreach (var row in totalRows) { Report.Info("Row # " + rowNum); Report.Info(row.GetInnerHtml()); IList <TdTag> cols = row.Find <TdTag>("./td"); int colsCnt = cols.Count; Report.Info("Total Columns (colsCnt) in this Row", colsCnt.ToString()); foreach (TdTag col in cols) { // Report.Info(col.GetInnerHtml().ToString()); // Report.Info("col value:", col.InnerText); IList <DivTag> divTags = col.Find <DivTag>("./div"); Report.Info(divTags.Count.ToString()); IList <SpanTag> spanVals = col.Find <SpanTag>("./span"); Report.Info(spanVals.Count.ToString()); foreach (SpanTag spanVal in spanVals) { string colValue = spanVal.InnerText; // Report.Info(spanVal.InnerText); Report.Info(colValue); } } rowNum++; } } Delay.Seconds(2); }
public Choose_All_Port_Forwarding_Rules_To_Enable() { // Do not delete - a parameterless constructor is required! WebDocument webDocument1 = "/dom[@domain='192.168.0.1']"; webDocument1.WaitForDocumentLoaded(); Delay.Seconds(45); //TableTag myTable1 = webDocument1.FindSingle("/dom[@domain='192.168.0.1']//table[#'portTriggeringTable']"); //As per R3.5 (9.1.116J) TableTag myTable = webDocument1.FindSingle("/dom[@domain='192.168.0.1']//table[#'PortForwardingTable']"); //As per R 3,11.1 //Report.Screenshot("New Port Triggering Rule", myTable.Element,true); //highlight the new port triggering rule //IList<TrTag> rows1 = myTable1.Find<TrTag>("./tbody//tr"); IList <TrTag> rows1 = myTable.Find <TrTag>("./tbody//tr"); TotalRows = rows1.Count; Report.Info(" TotalRows(Before Add)", TotalRows.ToString()); }
private void Init() { // Your recording specific initialization code goes here. Delay.Seconds(20); WebDocument webDocument1 = "/dom[@domain='192.168.0.1']"; webDocument1.WaitForDocumentLoaded(); // Delay.Seconds(40); // TableTag myTable1 = webDocument1.FindSingle("/dom[@domain='192.168.0.1']//table[#'portTriggeringTable']"); TableTag myTable1 = webDocument1.FindSingle("/dom[@domain='192.168.0.1']//table[#'PortForwardingTable']"); //R3.11 ///dom[@domain='192.168.0.1']//table[#'portTriggeringTable'] //Report.Screenshot("New Port Triggering Rule", myTable.Element,true); //highlight the new port triggering rule IList <TrTag> rows1 = myTable1.Find <TrTag>("./tbody//tr"); TotalRows = rows1.Count; Report.Info(" TotalRows(Before Add)", TotalRows.ToString()); }
/// <summary> /// Verify the records in Table /// </summary> /// <param name="ObjTable">TableTag Object</param> /// <param name="strCellData">Values To Verify in Table</param> /// <returns>Bool Value</returns> public static bool VerifyRecordInTable(TableTag ObjTable, params string[] strCellData) { bool flag = false; bool TestFlag = false; string strCellValue = null; try { foreach (var item in strCellData) { foreach (TrTag tr in ObjTable.Find(".//tr")) { foreach (TdTag td in tr.Find(".//td")) { strCellValue = td.InnerText.ToString(); if (strCellValue == item.ToString() || strCellValue.Contains(item.ToString())) { flag = true; TestFlag = true; break; } } if (TestFlag == true) { break; } } if (flag == false) { break; } } } catch (Exception ex) { Report.Info("Fail to VerifyrecordInTable ", ex.Message); } return(flag); }
public void ModemMode_Device_Info() {//validate modem - Hub 3.0 device information /* * Standard specification compliant: DOCSIS 3.0 * Hardware version: 10 * Software version: 9.1.116.608 * Cable MAC address: C0:05:C2:46:17:0B * Cable modem serial number: AAAP60920652 * System up time: 0 days 1h:1m:49s * Network access: Allowed */ Report.Info(" Hub 3.0 device information - Modem Mode "); // /dom[@caption='Hub 3.0' and @page='' and @path='/' and @browsername='IE' and @pageurl='http://192.168.100.1/?device_status&mid=Info']//div[#'Hub 3.0 device information']/table // common_table_2 Delay.Seconds(15); WebDocument webDocument = "/dom[@domain='192.168.100.1']"; // TableTag myTable = webDocument.FindSingle("/dom[@caption='Hub 3.0' and @page='' and @path='/' and @browsername='IE' and @pageurl='http://192.168.100.1/?device_status&mid=Info']//div[#'Hub 3.0 device information']//table[#'common_table_2']"); TableTag myTable = webDocument.FindSingle("/dom[@caption='Hub 3.0' and @page='' and @path='/' and @browsername='IE' and @pageurl='http://192.168.100.1/?device_status&mid=Info']//div[#'Hub 3.0 device information']/table"); IList <TrTag> rows = myTable.Find <TrTag>("./tbody//tr"); int rowsCnt = rows.Count; Report.Info("Total Rules(RowsCnt)-Now :", rowsCnt.ToString()); }
public void Choose_Attached_DHCPv6_Device_To_Reserved_List(string argument1, string argument2, string argument3, string argument4, string argument5, string argument6, string argument7) { //choose IPv6 devices to reserve ////choose device from the attached list //This method is to select any MAC filter rules to delete //argument1 - MAC Address1, argument2- MAC Address2 //argument3 - MAC Address3, argument4 - MAC Address4 //argument5 - MAC Address5, argument6 - MAC Address6 //argument7 - Device Name Delay.Seconds(30); // to load the pages WebDocument webDocument = "/dom[@domain='192.168.0.1']"; webDocument.WaitForDocumentLoaded(); //Report.Info(webDocument.GetHtml()); //DHCP lease table TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'AttachedDevicesTable']"); //Count the total no of IPv4 port Filter rules (rows) IList <TrTag> totalDHCPClients = myTable.Find <TrTag>("./tbody//tr"); //Row int rulesCount = totalDHCPClients.Count; string totalDHCPAttached = "Total Rules : " + rulesCount.ToString(); Report.Info("Active Attached Devices ", totalDHCPAttached); if (rulesCount == 0) { //Mouse.ScrollWheel(150); Report.Failure("DHCP List", "There are no devices to add !!"); return; } else { //if there any rules? then choose appropriate radio button Report.Info(" There are " + rulesCount.ToString() + " devices attached to this router !!! "); int rowNum = 1; //int addCheck = 1; Boolean isMatch = false, isMacAddressMatch = false; string macAddress = "", macAddress1 = "", IPAddress = "", devName = "", Wifi_Freq = ""; string IPAddressSubStr = ""; macAddress = argument1 + ":" + argument2 + ":" + argument3 + ":" + argument4 + ":" + argument5 + ":" + argument6; foreach (var row in totalDHCPClients) { Report.Info("Row : " + rowNum); // Report.Info(row.GetInnerHtml().ToString()); IList <TdTag> cols = row.Find <TdTag>("./td"); //column Report.Info(" Total Columns in the Row : ", cols.Count.ToString()); int colNum = 1; String radiobuttonPath = ""; // Ranorex.InputTag MACFilterAttachedDeviceTag = null; // String newPath = ""; foreach (TdTag MacCol in cols) { //1- Radiobutton, 2-Device name,3-MAC address,4-IP Address,5-Lease time,6-Connected to Report.Info("MacCol: " + colNum); // Report.Info("MacCol Info: "+MacCol.InnerText); if (colNum == 1) { radiobuttonPath = MacCol.GetPath().ToString(); } else if (colNum == 2) { devName = MacCol.InnerText; Report.Info("devName : " + devName); } else if (colNum == 3) //MAC Address { IList <SpanTag> spanVals = MacCol.Find <SpanTag>("./span"); //Report.Info("span count : "+spanVals.Count); foreach (SpanTag spanVal in spanVals) { macAddress1 = spanVal.InnerText; if (macAddress == macAddress1) { Report.Info(" The device with MAC Address - " + macAddress1 + " - is attached to the Hub"); // Report.Info(" Wifi_Freq : ",Wifi_Freq); // Report.Info("Device Name : ", devName); // Report.Info("MAC Address to Add :", macAddress1); isMacAddressMatch = true; /* * // isMatch = true; * String newPath = ""; * int radVal = rowNum -1; * newPath = radiobuttonPath + "/input[@name='attachedDevicesGroup' and @type='radio' and @value='"+radVal+"']"; * Ranorex.InputTag MACFilterAttachedDeviceTag = newPath; * // MACFilterAttachedDeviceTag = newPath; * Report.Info("MACFilterAttachedDeviceTag PATH : ", newPath); * * // Delay.Seconds(1); * MACFilterAttachedDeviceTag.PerformClick(); //MACFilterAttachedDeviceTag.Checked = "True"; * //MACFilterAttachedDeviceTag.TagValue ="2"; * Delay.Seconds(1); * // string rst = "The following DHCP Client is added to the reserved list !!!";Report.Success(rst); * Report.Success("The following DHCP Client is added to the reserved list !!!"); * Report.Screenshot("DHCP_Reserved_List",MacCol.Element,true); * //Report.Screenshot("DHCP_Reserved_List",row.Element,true); * //break; */ } } } else if (colNum == 4) //Ip Address { IPAddress = MacCol.InnerText; //check if the IP Address is IPv6 type,if yes then click the radio button Report.Info(" IPAddress : " + IPAddress); // Report.Info(" IPAddress length : " + IPAddress.Length); if (IPAddress.Length <= 0) { Report.Failure("InValid IPv4/v6 Address"); } else if (IPAddress.Length > 0) { Report.Info(" IPAddressLength : " + IPAddress.Length); IPAddressSubStr = IPAddress.Substring(0, IPAddress.Length - 3); Report.Info("IPAddressSubStr : " + IPAddressSubStr); } //parse the IPv4 address Boolean CheckIPAddress = this.CheckIPv4AddressValid(IPAddressSubStr.Trim()); if (CheckIPAddress) { Report.Success("Valid IP v4/v6 Address"); int isIPv4 = IPAddressSubStr.IndexOf('.'); // Report.Info(isIPv4.ToString()); if (isIPv4 == -1) // it is IPv6 { if (isMacAddressMatch) { isMatch = true; Report.Info("It is IPv6 "); //choose the device and add to the reserve list String newPath = ""; int radVal = rowNum - 1; newPath = radiobuttonPath + "/input[@name='attachedDevicesGroup' and @type='radio' and @value='" + radVal + "']"; Ranorex.InputTag MACFilterAttachedDeviceTag = newPath; Report.Info("MACFilterAttachedDeviceTag PATH : ", newPath); Delay.Seconds(1); MACFilterAttachedDeviceTag.Click(); MACFilterAttachedDeviceTag.PerformClick(); Delay.Seconds(2); Report.Screenshot("DHCPv6_Reserved_List", MacCol.Element, true); Report.Success("The DHCPv6 Client is added to the reserved list !!!"); } } else { Report.Info("It is IPv4 "); } } else { //IPAddress is v6 Report.Failure("InValid IPv4/v6 Address"); } } else if (colNum == 6) // frequency connected to //IList<SpanTag> spanVals = MacCol.Find<SpanTag>("./span"); //foreach(SpanTag spanVal in spanVals){ //Wifi_Freq = spanVal.InnerText; //} { Wifi_Freq = MacCol.InnerText; // Report.Info("Wifi_Freq : " + Wifi_Freq); /* * if(isMatch){ * break; * } */ } colNum++; } //end of forloop - cols if (isMatch) //is device attached and radio button clicked ?? { Report.Info("Wifi_Frequency : ", Wifi_Freq); if (Wifi_Freq.Trim().StartsWith("Wi-Fi 2.4G")) { Report.Info("This device is connected to WI-FI 2.4G"); //choose the device and click radio button break; } else if (Wifi_Freq.Trim().StartsWith("Wi-Fi 5G")) { Report.Info("This device is connected to WI-FI 5G"); break; } else if (Wifi_Freq.Trim().StartsWith("Ethernet")) { Report.Info("This device is connected to Ethernet"); break; } else { Report.Info("This device is NOT connected to WI-FI 2.4G /WI-FI 5G"); break; } //break; } rowNum++; } //end of forloop - totalDHCPClients if (!isMatch) { string rst = "The device : " + devName + "(" + macAddress + ")" + " does not exist in the attached list "; Report.Failure("DHCPv6_Reserved_List", rst); TestSuite.Current.GetTestCase("Add_Device_To_DHCPv6_Reserved_List").Checked = false; //Add_Device_To_DHCP_Reserved_List } else { TestSuite.Current.GetTestCase("Add_Device_To_DHCPv6_Reserved_List").Checked = true; //Add_Device_To_DHCP_Reserved_List } } //end of if-else } //end of method
public void Select_Ipv4_Port_Filter_To_Enable() { // code to select all the rows in IP Port Filter table Report.Info("---inside Select_Ipv4_Port_Filter_To_Enable --- "); Delay.Seconds(40); WebDocument webDocument = "/dom[@domain='192.168.0.1']"; //Report.Info(webDocument.GetHtml()); TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'ipv4FilterTable']"); //Count the total no of IPv4 port Filter rules (rows) IList <TrTag> totalIPv4Rules = myTable.Find <TrTag>("./tbody//tr"); int rulesCount = totalIPv4Rules.Count; string totalPortRules = "Total Rules : " + rulesCount.ToString(); Report.Info("IPv4 Port Filter ", totalPortRules); if (rulesCount == 0) { //Mouse.ScrollWheel(150); Report.Failure("IPv4 Port Filter ", "There are no active IP Port rules to Enable !!"); TestSuite.Current.GetTestCase("Enable_All_IPv4Port_Filtering_Rules").Checked = false; return; } else { Report.Info(" There are " + rulesCount.ToString() + " IPv4 Port Filter Rules to Enable !!! "); IList <TdTag> cols = myTable.Find <TdTag>("./tbody//td"); int colsCount = cols.Count; Report.Info("Total colsCount", colsCount.ToString()); int j = 1; int delCount = 0; int delCheck = 0; int rowCount = 1; foreach (TdTag MacCol in cols) { //Report.Info("------Row : ",rowCount.ToString()); //Report.Info("---------Column : ",j.ToString()); //Report.Info(MacCol.InnerText); if (j == 6) //enable or disable ? //Report.Info("---Checking enabled box ---"); { String newPath = ""; //newPath = MacCol.GetPath() + "/input[#'ipv4FilterTable-Enabled-"+delCheck+"']"; newPath = "/dom[@domain='192.168.0.1']//input[#'ipv4FilterTable-Enabled-" + delCheck + "']"; Ranorex.InputTag IP4PortFilterTableEnabledTag = newPath; if (IP4PortFilterTableEnabledTag.Checked.ToString() == "False") { // IP4PortFilterTableEnabledTag is disabled ? //Report.Info("----------------- IP4PortFilterTableEnabledTag was false ---"); //Delay.Seconds(1); //IP4PortFilterTableEnabledTag.Checked = "True"; //check the checkbox to enable IP4PortFilterTableEnabledTag.PerformClick(); Delay.Seconds(1); string rst = "The following MACFilter_Filtering rule is enabled permanently !!!"; Report.Success(rst); } else { //IP4PortFilterTableEnabledTag is already enabled Report.Info(" IP4PortFilterTableEnabledTag is already enabled "); } Delay.Seconds(1); //Report.Screenshot("MACFilter_Filtering",macAddress.Element,true); Report.Screenshot("Ip4PortFilter_Filtering", MacCol.Element, true); delCount++; delCheck++; } if (j == 7) //delete checkbox? { j = 0; rowCount++; } j++; } //end of for-loop if (delCount == rulesCount) { // to check whether it selected all rows for enable string rst = "The following " + rulesCount.ToString() + " IP4 Port Filtering rules are enabled permanently !!!"; Report.Success(rst); Delay.Seconds(1); Report.Screenshot("Ip4PortFilter_Filtering", myTable.Element, true); } else { Report.Info(" All IP4 Port Filtering rules are not enabled !!! "); } } //end of if-else }
public void Delete_Any_Port_Trigger_Rule(string argument1, string argument2, string argument3, string argument4) { //Implemented based on R2.4.2 (9.1.88S) //identify the rules to delete Report.Info("--------Inside Delete_Any_Port_Trigger_Rule -------"); string triggerRangeStartPort = "", triggerRangeEndPort = "", targetRangeStartPort = "", targetRangeEndPort = ""; Delay.Seconds(30); WebDocument webDocument = "/dom[@domain='192.168.0.1']"; TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'portTriggeringTable']"); //count the rows IList <TrTag> rows = myTable.Find <TrTag>("./tbody//tr"); int rowsCnt = rows.Count; //Report.Info("Total rowsCnt",rowsCnt.ToString()); Report.Info("Total Rules", rowsCnt.ToString()); /** * //Walkthrough rows and columns * int rowNum = 1; * foreach (var row in rows) * { * Report.Info("==========================="); * Report.Info("Row: " + rowNum); * var cells = row.FindDescendants<TdTag>(); * foreach (var cell in cells) * { * Report.Info("Cell: " + cell.InnerText); * } * rowNum++; * } **/ //walkthrough the column values IList <TdTag> cols = myTable.Find <TdTag>("./tbody//td"); int colsCount = cols.Count; Report.Info("Total colsCount", colsCount.ToString()); int j = 1; bool isRuleExist = false; String portTriggerRule = ""; foreach (TdTag col in cols) { //Report.Info(col.InnerText); if (j == 1 && (!(col.InnerText.Equals("No triggering rule!")))) //if there are port trigger rules //triggerRangeStartPort { triggerRangeStartPort = col.InnerText; } else if (j == 2) { //triggerRangeEndPort triggerRangeEndPort = col.InnerText; } else if (j == 3) { //targetRangeStartPort targetRangeStartPort = col.InnerText; } else if (j == 4) { //targetRangeEndPort targetRangeEndPort = col.InnerText; } if (j == 7) { //perfrom validation if ((triggerRangeStartPort == argument1) && (triggerRangeEndPort == argument2) && (targetRangeStartPort == argument3) && (targetRangeEndPort == argument4)) { //Delay.Seconds(5); //click the delete checkbox WebElement webElement = col.Element; webElement.Click(); Delay.Seconds(3); //Report.Info("Clicked"); //portTriggerRule = "triggerRangeStartPort :: "+ triggerRangeStartPort + "||"+"triggerRangeEndPort :: "+triggerRangeEndPort+"||"+"targetRangeStartPort :: "+targetRangeStartPort+ "||"+"targetRangeEndPort :: "+targetRangeEndPort; portTriggerRule = "triggerRangeStartPort :: " + argument1 + "||" + "triggerRangeEndPort :: " + argument2 + "||" + "targetRangeStartPort :: " + argument3 + "||" + "targetRangeEndPort :: " + argument4; Report.Log(ReportLevel.Success, "PortTriggerRule", portTriggerRule); //Report.Info("<---This port forwarding rule is deleted from the list--->"); Report.Log(ReportLevel.Success, "PortTriggerRule", "This port triggering rule is deleted from the list"); //Report.Snapshot(myTable); //Report.Snapshot("PortTriggerRule",myTable); //Report.Screenshot("PortTriggerRule",myTable,true); //Report.Screenshot("PortTriggerRule",webElement,true); int rowNum = 1; foreach (var row in rows) { var cells = row.FindDescendants <TdTag>(); int colNum = 1; string triggerStart = "", triggerEnd = "", targetStart = "", targetEnd = ""; foreach (var cell in cells) { // Report.Info("Cell: " + cell.InnerText); if (colNum == 1) { //triggerRangeStartPort triggerStart = cell.InnerText; } else if (colNum == 2) { //triggerRangeEndPort triggerEnd = cell.InnerText; } else if (colNum == 3) { //targetRangeStartPort targetStart = cell.InnerText; } else if (colNum == 4) { //targetRangeEndPort targetEnd = cell.InnerText; } colNum++; } if (triggerStart == triggerRangeStartPort && triggerEnd == triggerRangeEndPort && targetStart == targetRangeStartPort && targetEnd == targetRangeEndPort) { Report.Screenshot("PortTriggerRule", row.Element, true); break; } rowNum++; } isRuleExist = true; break; } j = 0; } j++; } //end of foreach if (!isRuleExist) { portTriggerRule = "triggerRangeStartPort :: " + argument1 + "||" + "triggerRangeEndPort :: " + argument2 + "||" + "targetRangeStartPort :: " + argument3 + "||" + "targetRangeEndPort :: " + argument4; Report.Log(ReportLevel.Failure, "PortTriggerRule", portTriggerRule); Report.Log(ReportLevel.Failure, "PortTriggerRule", "This port triggering rule does not exist"); } }