public void Validate_Devices_In_Wireless_List1() { //This method is to check whether the MACFilter rules are addded successfully Delay.Seconds(15); WebDocument webDocument = "/dom[@domain='192.168.0.1']"; TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'macAddressFilterTable']"); IList <TrTag> rows = myTable.Find <TrTag>("./tbody//tr"); int rowsCnt = rows.Count; Report.Info("Total Rules(RowsCnt)", rowsCnt.ToString()); if (TotalRows == 1 && TotalRows == rowsCnt) { Report.Info("//-------------------- TotalRows == 1 && TotalRows == rowsCnt--------// "); int rowNum = 1; foreach (var row in rows) { //Report.Info("Row: " + rowNum); /* * IList<TdTag> cols = row.Find<TdTag>("./td"); * foreach(TdTag MacCol in cols){ * Report.Info(MacCol.InnerText.ToString()); * } */ if (rowNum == rowsCnt) //to get the last added rule (row) { Report.Info("//-------------------- rowNum == rowsCnt ------------------------// "); Mouse.ScrollWheel(10); row.EnsureVisible(); //Report.Info("Valid... New MAC Filtering Rule is added!"); Report.Success("Valid... New MAC Filtering Rule is added!"); Report.Screenshot("macAddressFilterTable", row.Element, true); break; } rowNum++; } } else if (TotalRows > 1 && TotalRows == rowsCnt) // no rows are added { Report.Info("//-------------------- TotalRows>1 and TotalRows== rowsCnt ------------------------// "); /* * TableTag errorTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'AddFilterRule']/table"); * Report.Failure("macFilterTable","Unable to add this new rule !!! "); * Delay.Seconds(5); * errorTable.EnsureVisible(); * Report.Screenshot("macFilterTable",errorTable.Element,false); */ //DivTag errorTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'AddFilterRule']"); DivTag errorTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'errTip_MACAddress']"); Report.Failure("macAddressFilterTable", "Unable to add this new rule because of the below mentioned error!!! "); Delay.Seconds(5); errorTable.EnsureVisible(); Report.Screenshot("macAddressFilterTable", errorTable.Element, true); return; } else // difference in rows { Report.Info("//-------------------- Rules are added -----------------//"); int rowNum = 1; foreach (var row in rows) { if (rowNum == rowsCnt) //to get the last added rule (row) { Report.Info("//-------------------- rowNum == rowsCnt ------------------------// "); Mouse.ScrollWheel(10); row.EnsureVisible(); //Report.Info("Valid... New MAC Filtering Rule is added!"); Report.Success("Valid... New MAC Filtering Rule is added!"); Report.Screenshot("macAddressFilterTable", row.Element, true); break; } rowNum++; } //end of for-loop } //end of if-else } //end of
public void Validate_Devices_In_Wireless_List() { //This method is to check whether the MACFilter rules are addded successfully Delay.Seconds(30); WebDocument webDocument = "/dom[@domain='192.168.0.1']"; TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'macAddressFilterTable']"); IList <TrTag> rows = myTable.Find <TrTag>("./tbody//tr"); int rowsCnt = rows.Count; Report.Info("Total Rules(RowsCnt)", rowsCnt.ToString()); if (TotalRows == 1 && TotalRows == rowsCnt) { if (initColCount == 1) { Report.Info("//-------------------- TotalRows == 1 && TotalRows == rowsCnt--------// "); int rowNum = 1; foreach (var row in rows) { Report.Info("Row: " + rowNum); IList <TdTag> cols = row.Find <TdTag>("./td"); int currentColCnt = cols.Count; Report.Info("currentColCnt : " + currentColCnt.ToString()); foreach (TdTag MacCol in cols) { Report.Info(MacCol.InnerText.ToString()); } if ((rowNum == rowsCnt) && (currentColCnt == 1)) { Report.Failure("Unable to add the selected device to the Wireless MAC Filtering list "); Report.Screenshot(); break; } else if (rowNum == rowsCnt) //to get the last added rule (row) { Report.Info("//-------------------- rowNum == rowsCnt ------------------------// "); Mouse.ScrollWheel(10); row.EnsureVisible(); //Report.Info("Valid... New MAC Filtering Rule is added!"); Report.Success("Valid... New MAC Filtering Rule is added!"); Report.Screenshot("macAddressFilterTable", row.Element, true); break; } rowNum++; } } else { Report.Failure("Unable to add this Wireless MAC Filtering Rule "); Report.Screenshot(); } } else if (TotalRows > 1 && TotalRows == rowsCnt) // no rows are added { Report.Info("//-------------------- TotalRows == rowsCnt ------------------------// "); /* * DivTag errorTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'errTip_MACAddress']"); * Report.Failure("macAddressFilterTable","Unable to add this new rule because of the below mentioned error!!! "); * Delay.Seconds(5); * errorTable.EnsureVisible(); * Report.Screenshot("macAddressFilterTable",errorTable.Element,true); * return; */ //if(TotalRows >=32){ // Report.Failure("macAddressFilterTable","Maximum number devices (32) is already added for this band "); // Delay.Seconds(5); // Report.Screenshot(); // return; //}else{ //} // if No.of 2.4GHz is equal to 32 or No.of 5GHz is equal to 32, if it is true display filter full message else display error message if (rowsCnt >= 32) { Report.Info("The total number MAC filters are more than 32"); this.Validate_MACAddressIsAlreadyInUse(); Report.Screenshot(); } else { DivTag errorTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'errTip_MACAddress']"); //Device already in filter list Report.Failure("macAddressFilterTable", "Unable to add this new rule because of the below mentioned error!!! "); Delay.Seconds(5); errorTable.EnsureVisible(); Report.Screenshot("macAddressFilterTable", errorTable.Element, true); Report.Screenshot(); return; } } else // there are difference in rows { Report.Info("//-------------------- Rules are added -----------------//"); int rowNum = 1; foreach (var row in rows) { if (rowNum == rowsCnt) //to get the last added rule (row) { Report.Info("//-------------------- rowNum == rowsCnt ------------------------// "); Mouse.ScrollWheel(10); row.EnsureVisible(); //Report.Info("Valid... New MAC Filtering Rule is added!"); Report.Success("Valid... New MAC Filtering Rule is added!"); Report.Screenshot("macAddressFilterTable", row.Element, true); Report.Screenshot(); break; } rowNum++; } //end of for-loop } //end of if-else } //end of method Validate_Devices_In_Wireless_List