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 Validate_Renamed_Ethernet_Connected_Device_Name(string argument1, string argument2) { Report.Info("------ Validate_Renamed_Ethernet_Connected_Device_Name --------"); // Validate old & new Ethernet names in connected devices screen Delay.Seconds(20); WebDocument webDocument = "/dom[@domain='192.168.0.1']"; TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'AttachedDevicesTable']"); //R3.8 Report.Screenshot("Devices Connected", myTable.Element, true); // print the devices table Report.Screenshot(); //Count the rows(total no of devices) IList <TrTag> rows = myTable.Find <TrTag>("./tbody//tr"); int rowsCount = rows.Count; Report.Info("Total Devices Connected", rowsCount.ToString()); if (rowsCount == 0) { //Mouse.ScrollWheel(150); Report.Failure("Device Rename ", "There are no connected wireless devices to rename !!"); return; } else { int rowNum = 1; Boolean isWirelessMatch = false, isEthernetMatch = false; int wirelessCnt = 0, ethernetCnt = 0; foreach (var row in rows) { Report.Info("Row: " + rowNum); Report.Info(row.GetInnerHtml().ToString()); IList <TdTag> cols = row.Find <TdTag>("./td"); int colCnt = cols.Count; int colNum = 1; string deviceName = "", connectionType = ""; foreach (TdTag MacCol in cols) { Report.Info("MacCol: " + colNum); Report.Info("MacCol Info: " + MacCol.InnerText); Report.Info(MacCol.GetInnerHtml().ToString()); //column1 - device name //column5 - Wi-Fi 2.4G _VM0365087_2G / Wi-Fi 5G _VM0365087_5G / Ethernet if (colNum == 1) { deviceName = MacCol.InnerText.Trim(); } else if (colNum == 5) { connectionType = MacCol.InnerText.Trim(); if (argument2.Trim() == deviceName) { Report.Info("connectionType : " + connectionType); // if(connectionType.StartsWith("Wi-Fi")){ // if(connectionType.StartsWith("Wireless frequency")){ //added on 02/11/17 to test code 9.1.116.600 if ((connectionType.StartsWith("Wi-Fi")) || (connectionType.StartsWith("Wireless frequency"))) // added on 15/01/18 to test code 9.1.116.604 { Report.Info("Rename Wireless Connected Device Name is Successfull"); isWirelessMatch = true; wirelessCnt++; //break; } else if (connectionType.StartsWith("Ethernet")) { // Report.Info("Rename Ethernet Device Name is Successfull"); Report.Info("Rename Ethernet Connected Device Name is Successfull"); isEthernetMatch = true; ethernetCnt++; } } //end of IF-deviceName } //end of if-else : column5 colNum++; } rowNum++; } if (isWirelessMatch) { Report.Info("wirelessCnt", wirelessCnt.ToString()); if (wirelessCnt == 1) { // Report.Success("Rename Wireless Connected Device Name is Successfull"); Report.Failure(" One Wireless Connected Device Name is Renamed instead Ethernet device"); } else { Report.Failure("More than one Wireless Connected Device Renamed"); } } else if (isEthernetMatch) { Report.Info("ethernetCnt", ethernetCnt.ToString()); if (ethernetCnt == 1) { // Report.Failure("One Ethernet Connected Device Name is Renamed instead of Wireless Device"); Report.Success("Rename Ethernet Connected Device Name is Successfull"); } else { // Report.Failure("More than one Ethernet Connected Device Renamed instead of one(1) Wireless Device"); Report.Failure("More than one Ethernet Connected Device Renamed "); } } Report.Screenshot(); } }
public void Validate_Connected_Device_Name(string argument1) { //check if the device name is shown in connceted devices list Report.Info("Inside Validate_Connected_Device_Name "); Delay.Seconds(20); WebDocument webDocument = "/dom[@domain='192.168.0.1']"; TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'AttachedDevicesTable']"); //R3.8 Report.Screenshot("Devices Connected", myTable.Element, true); // print the devices table //Count the rows(total no of devices) IList <TrTag> rows = myTable.Find <TrTag>("./tbody//tr"); int rowsCount = rows.Count; Report.Info("Total Devices Connected", rowsCount.ToString()); if (rowsCount == 0) { //Mouse.ScrollWheel(150); Report.Failure("Device Rename ", "There are no connected wireless devices to rename !!"); return; } else { int rowNum = 1; Boolean isWirelessMatch = false, isEthernetMatch = false; int wirelessCnt = 0, ethernetCnt = 0, connectCount = 0; foreach (var row in rows) { Report.Info("Row: " + rowNum); Report.Info(row.GetInnerHtml().ToString()); IList <TdTag> cols = row.Find <TdTag>("./td"); int colCnt = cols.Count; int colNum = 1; string deviceName = "", connectionType = ""; foreach (TdTag MacCol in cols) { Report.Info("MacCol: " + colNum); Report.Info("MacCol Info: " + MacCol.InnerText); Report.Info(MacCol.GetInnerHtml().ToString()); //column1 - device name //column5 - Wi-Fi 2.4G _VM0365087_2G / Wi-Fi 5G _VM0365087_5G / Ethernet if (colNum == 1) { deviceName = MacCol.InnerText.Trim(); } else if (colNum == 5) { connectionType = MacCol.InnerText.Trim(); Report.Info(" deviceName : " + deviceName + "and " + "connectionType : " + connectionType); if (argument1.Trim() == deviceName.Trim()) { // isConnected = true; connectCount++; // Report.Info("connectionType : " + connectionType); Report.Success(" Device : " + deviceName + " is in connected list "); // if(connectionType.StartsWith("Wi-Fi")){ // if(connectionType.StartsWith("Wireless frequency")){ //added on 02/11/17 to test code 9.1.116.600 if ((connectionType.StartsWith("Wi-Fi")) || (connectionType.StartsWith("Wireless frequency"))) // added on 15/01/18 to test code 9.1.116.604 { Report.Success(" Wireless Connected Device Name is Successfull"); isWirelessMatch = true; wirelessCnt++; break; } else //failure condition { Report.Info("Ethernet Device Name "); isEthernetMatch = true; ethernetCnt++; } } /*else{ * // Report.Info(" The Device " + argument1 + " is not connected again " ); * // Report.Failure("The Device " + argument1 + " is not connected again "); * // isConnected = false; * }//end of IF-deviceName */ } //end of if-else : column5 colNum++; } rowNum++; } //end of iF-ELSE row if (isWirelessMatch) { Report.Info("wirelessCnt", wirelessCnt.ToString()); if (wirelessCnt == 1) { Report.Info(" One device exist in conencted device table and it is connected via Wireless network "); } else { Report.Info(" Multiple devices exist in conencted device table and it is Connected via Wireless network "); } } if (isEthernetMatch) { Report.Info("ethernetCnt", ethernetCnt.ToString()); if (ethernetCnt == 1) { Report.Info("One device is connected via ethernet "); } else { Report.Info("More than one device is connected via Ethernet"); } } if (connectCount > 0) { Report.Success(" The Device " + argument1 + " is connected to the CPE "); } else { Report.Failure(" The Device " + argument1 + " is not yet connected "); } Report.Screenshot(); } //end of IF-ELSE }