public void Capture_Screen_For_Result() { WebDocument webDocument = "/dom[@domain='192.168.0.1']"; Ranorex.DivTag WirelessFrequencyTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'WirelessFrequency']"); //Report.Info(WirelessFrequencyTag.GetInnerHtml().ToString()); //Report.Info(TestSuite.Current.GetTestCase); // string tcName = TestCase.Current.Name; //obsolete in 6.x string tcName = TestCaseNode.Current.Name; //Report.Info(tcName); if (tcName == "Confirm_Enable_Guest_Network") { //Report.Log(ReportLevel.Info,"Guest Network Enabled Successfully !!!"); Report.Success("Guest Network Enabled Successfully !!!"); } else if (tcName == "Disable_Guest") { //Report.Log(ReportLevel.Info,"Guest Network Disabed Successfully !!!"); Report.Success("Guest Network Disabed Successfully !!!"); } Report.Screenshot("WirelessFrequency", WirelessFrequencyTag.Element, true); /* * WebDocument webDocument = "/dom[@domain='192.168.0.1']"; * Ranorex.TableTag WirelessFrequencyTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'strengthBar_Passphrase']/table"); * //Report.Info(WirelessFrequencyTag.GetInnerHtml().ToString()); * Report.Screenshot("WirelessFrequency",WirelessFrequencyTag.Element,true); */ }
public void Validate_SorryThereWasAnErrorWhileUpdating() { /* * Report.Log(ReportLevel.Info, "Validation", "(Optional Action)\r\nValidating AttributeEqual (InnerText='Sorry! There was an error while updating your settings. Please try again a bit later.') on item 'WebDocumentIE.SorryThereWasAnErrorWhileUpdating'.", repo.WebDocumentIE.SorryThereWasAnErrorWhileUpdatingInfo); * Validate.Attribute(repo.WebDocumentIE.SorryThereWasAnErrorWhileUpdatingInfo, "InnerText", "Sorry! There was an error while updating your settings. Please try again a bit later.", Validate.DefaultMessage, false); */ WebDocument webDocument = "/dom[@domain='192.168.0.1']"; Ranorex.DivTag confirmWizardDivTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'confirm-wizard']"); // /dom[@page='' and @path='/' and @browsername='IE' and @pageurl='http://192.168.0.1/?change_password&mid=ChangePassword']//div[#'confirm-wizard'] // Div --> errClose-NewPassword13,errClose-CurrentPassword, errClose-ReenterPassword string confirmWizardPath = confirmWizardDivTag.GetPath().ToString(); // Report.Info("confirmWizardPath : " + confirmWizardPath); IList <DivTag> confirmWizardDivTags = confirmWizardDivTag.Find <DivTag>(confirmWizardPath); int rulesCount = confirmWizardDivTags.Count; // Report.Info(rulesCount.ToString()); string rst = ""; if (rulesCount > 0) { foreach (var row in confirmWizardDivTags) { IList <DivTag> cols = row.Find <DivTag>("./Div"); foreach (DivTag col in cols) { //IList<DivTag> spanVals = row.Find<DivTag>("./Div"); rst = col.InnerText; Report.Info(rst); Report.Screenshot(); Report.Screenshot(confirmWizardDivTag.Element, true); } } } if (rst.StartsWith("Your settings have been updated")) { Report.Failure("Incorrect validation"); } else if (rst.StartsWith("Sorry! There was an error while updating your settings. Please try again a bit later.")) { //Sorry! There was an error while updating your settings. Please try again a bit later. Report.Success("Successful Validation"); } }
public void New_and_Current_Password_Validation() { WebDocument webDocument = "/dom[@domain='192.168.0.1']"; Ranorex.DivTag confirmWizardDivTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'confirm-wizard']"); string confirmWizardPath = confirmWizardDivTag.GetPath().ToString(); // Report.Info("confirmWizardPath : " + confirmWizardPath); IList <DivTag> confirmWizardDivTags = confirmWizardDivTag.Find <DivTag>(confirmWizardPath); int rulesCount = confirmWizardDivTags.Count; // Report.Info(rulesCount.ToString()); string rst = ""; if (rulesCount > 0) { foreach (var row in confirmWizardDivTags) { IList <DivTag> cols = row.Find <DivTag>("./Div"); foreach (DivTag col in cols) { //IList<DivTag> spanVals = row.Find<DivTag>("./Div"); rst = col.InnerText; Report.Info(rst); Report.Screenshot(); Report.Screenshot(confirmWizardDivTag.Element, true); } } } if (rst.StartsWith("Your settings have been updated")) { // Report.Success("Successful Validation"); Report.Failure("Incorrect validation"); } else if (rst.StartsWith("Sorry! There was an error while updating your settings. Please try again a bit later.")) { //Sorry! There was an error while updating your settings. Please try again a bit later. // Report.Failure("Incorrect validation"); Report.Success("Successful Validation, New password cannot be same as current password"); } }
public void Validate_ConfirmWizard() { Report.Log(ReportLevel.Info, "Validation", "Validating AttributeEqual (Id='confirm-wizard') on item 'WebDocumentIE.ConfirmWizard1.ConfirmWizard'.", repo.WebDocumentIE.ConfirmWizard1.ConfirmWizardInfo); Validate.Attribute(repo.WebDocumentIE.ConfirmWizard1.ConfirmWizardInfo, "Id", "confirm-wizard"); WebDocument webDocument = "/dom[@domain='192.168.0.1']"; Ranorex.DivTag confirmWizardDivTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'confirm-wizard']"); string confirmWizardPath = confirmWizardDivTag.GetPath().ToString(); // Report.Info("confirmWizardPath : " + confirmWizardPath); IList <DivTag> confirmWizardDivTags = confirmWizardDivTag.Find <DivTag>(confirmWizardPath); int rulesCount = confirmWizardDivTags.Count; // Report.Info(rulesCount.ToString()); string rst = ""; if (rulesCount > 0) { foreach (var row in confirmWizardDivTags) { IList <DivTag> cols = row.Find <DivTag>("./Div"); foreach (DivTag col in cols) { //IList<DivTag> spanVals = row.Find<DivTag>("./Div"); rst = col.InnerText; Report.Info(rst); } } } if (rst.StartsWith("Your settings have been updated")) { Report.Failure("Incorrect validation"); } else if (rst.StartsWith("Sorry! There was an error while updating your settings. Please try again a bit later.")) { //Sorry! There was an error while updating your settings. Please try again a bit later. Report.Success("Successful Validation"); } }
public void Verify_Validate_or_Change_SSID_Name() { //verify & Validate or Chnage SSIDs Name string Wifi2_4G = "", Wifi5G = ""; Delay.Seconds(25); WebDocument webDocument = "/dom[@domain='192.168.0.1']"; Ranorex.DivTag divTag = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'tr_SSID']"); //Report.Info(divTag.GetInnerHtml().ToString()); foreach (Ranorex.InputTag inputTag in divTag.Find(".//input")) { Wifi2_4G = inputTag.Value.ToString(); Report.Info("Wifi2_4G Name", Wifi2_4G); } Ranorex.DivTag divTag1 = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'tr_SSID50']"); //Report.Info(divTag1.GetInnerHtml().ToString()); foreach (Ranorex.InputTag inputTag1 in divTag1.Find(".//input")) { Wifi5G = inputTag1.Value.ToString(); Report.Info("Wifi5G Name", Wifi5G); } //compare SSIDs name,if both are same we need to change Wifi 5GHz SSID name before performing password validation if (Wifi2_4G == Wifi5G) { Report.Info("SSIDs names are same"); // enable testcase to change the SSID name TestSuite.Current.GetTestCase("Change_WiFi5GHz_SSID_Name").Checked = true; repo.WebDocument19216801.SSID50.Value = Wifi5G + "_T"; } else { Report.Info("SSIDs names are different"); } }
public void Validate_Firewall_Page_Default_Settings() { //Validate firewall fields //IPv4 firewall protection - Enable //Block fragmented IP packets - Enable //Port scan detection - Disable //IP flood detection - Enable bool FirewallProtect = false, BlockFragment = false, PortScan = false, PFloodDetect = false; Delay.Seconds(2); WebDocument webDocument = "/dom[@domain='192.168.0.1']"; webDocument.WaitForDocumentLoaded(); Ranorex.InputTag IPv4FirewallProtectTag = "/dom[@domain='192.168.0.1']//div[#'tr_EnableFirewall']/input[#'EnableFirewall']"; Ranorex.InputTag BlockFragmentTag = "/dom[@domain='192.168.0.1']//div[#'tr_EnableBlockFramentedPkts']/input[#'EnableBlockFramentedPkts']"; Ranorex.InputTag PortScanTag = "/dom[@domain='192.168.0.1']//div[#'tr_EnablePortScanDetection']/input[#'EnablePortScanDetection']"; Ranorex.InputTag IPFloodDetectTag = "/dom[@domain='192.168.0.1']//div[#'tr_EnableIPFloodDetection']/input[#'EnableIPFloodDetection']"; //Report.Info("FirewallProtectTag(Default) : "+IPv4FirewallProtectTag.Checked.ToString()); if (IPv4FirewallProtectTag.Checked.ToString() == "True") { FirewallProtect = true; } else { FirewallProtect = false; } //Report.Info("BlockFragmentTag(Default) : "+BlockFragmentTag.Checked.ToString()); if (BlockFragmentTag.Checked.ToString() == "True") { BlockFragment = true; } else { BlockFragment = false; } //Report.Info("PortScanTag(Default) : " + PortScanTag.Checked.ToString()); if (PortScanTag.Checked.ToString() == "True") { PortScan = true; } else { PortScan = false; } //Report.Info("IPFloodDetectTag(Default) : " + IPFloodDetectTag.Checked.ToString()); if (IPFloodDetectTag.Checked.ToString() == "True") { PFloodDetect = true; } else { PFloodDetect = false; } if (FirewallProtect && !BlockFragment && PortScan && PFloodDetect) { Report.Success(" All default settings are valid and it is as expected "); } else { Report.Failure("Some of Firewall_Page_Default_Settings are wrong "); } Ranorex.DivTag FirewallTag = "/dom[@domain='192.168.0.1']//div[#'IPv4Firewall']"; Report.Screenshot("Firewall_Page_Default_Settings", FirewallTag.Element); Report.Screenshot(); //Validate.ContainsImage(repo.WebDocument19216801.FmChbxEnableFirewallInfo, FmChbxEnableFirewall_Screenshot1, FmChbxEnableFirewall_Screenshot1_Options); Delay.Milliseconds(2); }