How to use pin method of org.openqa.selenium.Interface JavascriptExecutor class

Best Selenium code snippet using org.openqa.selenium.Interface JavascriptExecutor.pin

Source:TestActions.java Github

copy

Full Screen

...524 String URLofthepage = "https://myt.sealand.apmoller.net/portaluser/#login?originalUrl=https%3A%2F%2Fmyt.sealand.apmoller.net%3A443%2Fdashboard";525 System.out.println(currentURLofthepage);526 if (username.contains("AAS181")) {527 if (env.equals("SIT")) {528 WebElement pin = driver.findElement(By.xpath("//*[@id='pin']"));529 pin.sendKeys("1234");530 WebElement continue_pin = driver.findElement(By.xpath("//*[@id='submitBtn']"));531 continue_pin.click();532 Thread.sleep(2000);533 input(custCodeProperty, customerCode, "Login", "Login");534 waitFor(" ", "2000", "Login Page");535 javaClick(selectBtnProperty, " ", "Login", "Login");536 }537 }538 else if (username.contains("testuser90")) {539 WebElement custmerCodeRadio = driver.findElement(540 By.xpath("//input[contains(@id,'customerCode') and @value='" + customerCode + "']"));541 Thread.sleep(2000);542 custmerCodeRadio.click();543 }544 else if (username.contains("spotuser.ex.mul.cc.booking")) {545 WebElement logo = driver.findElement(By.xpath("//*[@id='ign-navbar']/a[3]/img"));546 Thread.sleep(2000);547 logo.click();548 }549 else if (username.contains("testuser21@xleap")) {550 if (brand.equalsIgnoreCase("sea")) {551 WebElement logo = driver.findElement(By.xpath("//*[@id='ign-navbar']/a[3]"));552 Thread.sleep(2000);553 logo.click();554 waitFor("txtbx_Code", "5000", "Login Page");555 javaClick(custCodeProperty, " ", "Login", "Login");556 input(custCodeProperty, customerCode, "Login", "Login");557 Thread.sleep(2000);558 javaClick(selectBtnProperty, " ", "Login", "Login");559 }560 else {561 WebElement logo = driver.findElement(By.xpath("//*[@id='ign-navbar']/a[3]/img"));562 Thread.sleep(2000);563 logo.click();564 waitFor("txtbx_Code", "5000", "Login Page");565 javaClick(custCodeProperty, " ", "Login", "Login");566 input(custCodeProperty, customerCode, "Login", "Login");567 Thread.sleep(2000);568 javaClick(selectBtnProperty, " ", "Login", "Login");569 }570 }571 else if (username.contains("testuser22@xleap")) {572 if (brand.equalsIgnoreCase("sea")) {573 WebElement logo = driver.findElement(By.xpath("//*[@id='ign-navbar']/a[3]"));574 Thread.sleep(2000);575 logo.click();576 waitFor("txtbx_Code", "5000", "Login Page");577 input(custCodeProperty, customerCode, "Login", "Login");578 waitFor(" ", "3000", "Login Page");579 javaClick(selectBtnProperty, " ", "Login", "Login");580 } else {581 WebElement logo = driver.findElement(By.xpath("//*[@id='ign-navbar']/a[3]/img"));582 Thread.sleep(2000);583 logo.click();584 waitFor("txtbx_Code", "5000", "Login Page");585 input(custCodeProperty, customerCode, "Login", "Login");586 waitFor(" ", "3000", "Login Page");587 javaClick(selectBtnProperty, " ", "Login", "Login");588 }589 }590 else if (username.contains("mccuser21@xleap")) {591 WebElement logo = driver.findElement(By.xpath("//*[@id='ign-navbar']/a[3]"));592 Thread.sleep(2000);593 logo.click();594 waitFor("txtbx_Code", "5000", "Login Page");595 input(custCodeProperty, customerCode, "Login", "Login");596 Thread.sleep(2000);597 javaClick(selectBtnProperty, " ", "Login", "Login");598 }599 else if (username.contains("safuser21@xleap")) {600 WebElement logo = driver.findElement(By.xpath("//*[@id='ign-navbar']/a[3]"));601 Thread.sleep(2000);602 logo.click();603 waitFor("txtbx_Code", "5000", "Login Page");604 input(custCodeProperty, customerCode, "Login", "Login");605 Thread.sleep(2000);606 javaClick(selectBtnProperty, " ", "Login", "Login");607 }608 else if (username.contains("sgluser21@xleap")) {609 WebElement logo = driver.findElement(By.xpath("//*[@id='ign-navbar']/a[3]"));610 Thread.sleep(2000);611 logo.click();612 waitFor("txtbx_Code", "5000", "Login Page");613 input(custCodeProperty, customerCode, "Login", "Login");614 Thread.sleep(2000);615 javaClick(selectBtnProperty, " ", "Login", "Login");616 }617 else if (currentURLofthepage.equals(URLofthepage)) {618 WebElement logo = driver.findElement(By.xpath("//*[@id='logoImage']"));619 Thread.sleep(2000);620 logo.click();621 waitFor("txtbx_Code", "5000", "Login Page");622 input(custCodeProperty, customerCode, "Login", "Login");623 waitFor(" ", "3000", "Login Page");624 javaClick(selectBtnProperty, " ", "Login", "Login");625 }626 else if (username.contains("testuser201") || username.contains("spotusertst.in")) {627 }628 else if (username.contains("testuser10@xleap") || username.contains("mccuser10@xleap")629 || username.contains("mccuser10@xleap") || username.contains("safuser10@xleap")630 || username.contains("sgluser10@xleap")) {631 WebElement logo = driver.findElement(By.xpath("//*[@id='ign-navbar']/a[3]"));632 Thread.sleep(2000);633 logo.click();634 }635 else if (username.contains("ssibtestuser1")) {636 if (env.equals("PP")) {637 waitFor(" ", "5000", "customerCode");638 driver.findElement(By.xpath(639 "//td[div[contains(text(),'DK:" + customerCode + "')]]/following-sibling::td[2]"))640 .click();641 }642 else {643 driver.findElement(By.xpath(644 "//*[@id='GCSS BOOKED BY , PAKHUS D, 2ND FLOOR , DAMPFAERGEVEJ , COPENHAGEN , DK:10000007951']/a"))645 .click();646 }647 }648 else {649 waitFor("txtbx_Code", "5000", "Login Page");650 System.out.println("Navigate to the url: " + applicationUrl + " successfully");651 //input(custCodeProperty, customerCode, "Login", "Login");652 653 654 driver.findElement(By.xpath("//*[@id='customerCode']")).sendKeys(customerCode);655 656 Thread.sleep(2000);657 //javaClick(selectBtnProperty, " ", "Login", "Login");658 659 660 661 662 663// WebElement CustomerElement = getObject(getObjectLocator(selectBtnProperty));664// JavascriptExecutor executor = (JavascriptExecutor) driver;665// executor.executeScript("arguments[0].click();", CustomerElement);666// 667 //getObject(getObjectLocator(selectBtnProperty)).click();668 669 670 driver.findElement(By.xpath("//*[@id='set-customer-code-form']/button")).click();671 672 WebDriverWait waitforpopup = new WebDriverWait(driver, 20);673 waitforpopup.until(ExpectedConditions.visibilityOfElementLocated(674 By.xpath("//*[@class='nfd-modal__window__close']"))).click();675 //driver.switchTo().defaultContent();676 driver.navigate().refresh();677 System.out.println("Successfully navigate to " + driver.getCurrentUrl());678 679 680 }681 testRunner.testStepResult = true;682 683 684 } catch (Exception e) {685 log_testActions.error("Not able to login to " + env + " successfully. Exception = " + e.getMessage());686 //testRunner.loginResult = false;687 testRunner.testStepResult = false;688 }689 }690 }*/691 692 693 /*694 * *****************************************************************************695 * ************************************** Method : changeToEnglish Description :696 * Changing Application language to English Author: Ashok Date:697 **********************************************************************************************************************698 */699 public void changeToEnglish(String object, String data, String pageName, String stepName) {700 driver.navigate().to(driver.getCurrentUrl());701 try {702 log_testActions.info("Changing language to English");703 moveClick(object, data, pageName, stepName);704 } catch (Exception e) {705 testRunner.beforeTestException = e.getMessage();706 log_testActions.error("Not able to Changing language to English" + testRunner.beforeTestException);707 testRunner.testStepResult = false;708 }709 }710 /*711 * *****************************************************************************712 * ************************************** Method : logout Description : Used to713 * Logout from The Application Author: Ashok Date:714 **********************************************************************************************************************715 */716 public static void logout(String object, String data, String pageName, String stepName) {717 log_testActions.info("Logging out of the application");718 try {719 if (testRunner.testName.contains("_MML_")) {720 // IGNnavigateMenu("Maersk_SSP_IGN_lnk_loginlink;Maersk_SSP_IGN_lnk_logout","Logout","Booking_Page","Logout721 // from Application");722 String url = driver.getCurrentUrl();723 String[] split_URL = url.split("/");724 String brandName = split_URL[2];725 driver.navigate().to("https://" + brandName + "/logout");726 log_testActions.info("The application is logout");727 System.out.println("The application is Logout");728 } else {729 String url = driver.getCurrentUrl();730 String[] split_URL = url.split("/");731 String brandName = split_URL[2];732 driver.navigate().to("https://" + brandName + "/logout");733 log_testActions.info("The application is logout");734 System.out.println("The application is Logout");735 Thread.sleep(10000);736 String pageTitle = driver.getTitle();737 if (pageTitle.contains("Certificate") || pageTitle.contains("Certificate")) {738 javaClick("lnk_CertificateErrorIE", "", "", "Click on continue certificate error");739 Thread.sleep(10000);740 }741 if (pageTitle.contains("Acceptable Usage Policy")) {742 javaClick("btn_IAcceptError", "", "", "Click on I Accept Button");743 Thread.sleep(10000);744 }745 testRunner.testStepResult = true;746 System.out.println("Log out from the application successfully");747 }748// driver.manage().deleteAllCookies();749// System.out.println("clearing the cookies");750 } catch (Exception e) {751 752 testRunner.beforeTestException = e.getMessage();753 log_testActions.error("Not able to Logging out of the application" + testRunner.beforeTestException);754 testRunner.testStepResult = false;755 }756 }757 /*758 ********************************************************************************************************************759 * Method : waitForEnable Description : Wait for till Enable the WebElement760 * Author: Ashok761 **********************************************************************************************************************762 */763 public static void waitForEnable(WebElement ele) {764 try {765 while (!ele.isEnabled()) {766 log_testActions.info("disabled");767 Thread.sleep(1000);768 }769 } catch (InterruptedException e) {770 // TODO Auto-generated catch block771 log_testActions.info("Exception=" + e.getMessage());772 }773 log_testActions.info("Enabled");774 }775 /*776 ********************************************************************************************************************777 * Method : input Description : Enter the text value to the text box Author:778 * Ashok779 **********************************************************************************************************************780 */781 public static void input(String object, String data, String pageName, String StepName) {782 String txtData = null;783 WebElement ele = null;784 SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");785 Date todayDate = Calendar.getInstance().getTime();786 constants.Current_Date = formatter.format(todayDate);787 waitForVisible(object);788 try {789 log_testActions.info("Entering the text in " + object + " in " + pageName);790 System.out.println("Entered value in " + object + "in" + pageName);791 txtData = data;792 if (object.equals("txtbx_Con1_length") || object.equals("txtbx_Con1_width")793 || object.equals("txtbx_Con1_height")) {794 JavascriptExecutor executor1 = (JavascriptExecutor) driver;795 executor1.executeScript("document.getElementById('oversized-details-modal').style.display='block';");796 executor1.executeScript("document.getElementById('clone').style.display='block';");797 }798 if (object.equals("txtbx_Con2_heigth") || object.equals("txtbx_Con2_width")799 || object.equals("txtbx_Con2_height")) {800 JavascriptExecutor executor2 = (JavascriptExecutor) driver;801 executor2.executeScript("document.getElementById('oversized-details-modal').style.display='block';");802 executor2.executeScript("document.getElementById('clone').style.display='block';");803 Thread.sleep(1000);804 }805 if (txtData.equals("currDate")) {806 txtData = constants.Current_Date;807 }808 if (txtData.equals("currDate+1")) {809 txtData = constants.Current_Date;810 Date dt = new Date();811 Calendar c = Calendar.getInstance();812 c.setTime(dt);813 c.add(Calendar.DATE, 1);814 dt = c.getTime();815 }816 if (txtData.equals("<<RTD_BookingNumber>>")) {817 txtData = constants.Booking_Number;818 }819 if (txtData.equals("<<GTD_TestData_B1>>")) {820 }821 waitForVisible(object);822 if (isTestElementPresent(object)) {823 log_testActions.info("Element Found. Entering value of " + object + " i= " + txtData);824 System.out.println("Element Found. Entering value of " + object + " i= " + txtData);825 ele = getObject(getObjectLocator(object));826 /* ele.clear(); */827 ele.sendKeys(txtData);828 // ele.sendKeys(Keys.TAB);829 Thread.sleep(1000);830 log_testActions.info("Entered " + txtData + " value in " + object);831 System.out.println("Entered " + txtData + " value in " + object);832 testRunner.testStepResult = true;833 } 834 835 else {836 log_testActions.info("Element Not Found for " + object);837 System.out.println("Element Not Found for " + object);838 testRunner.testStepResult = false;839 }840 841 842 } catch (Exception e) {843 testRunner.stepException = e.getMessage();844 log_testActions.error("Not able to enter the text in " + pageName + "--- " + e.getMessage());845 testRunner.testStepResult = false;846 }847 }848 /*849 ********************************************************************************************************************850 * Method : setTextTab Description : Enter the text value to the text baox and851 * handled down and Enter and TAB key events Author: Ashok852 **********************************************************************************************************************853 */854 public static void setTextTab(String object, String data, String pageName, String StepName) {855 String[] input = data.split("~");856 String inputValue = input[0];857 String tabEvent = input[1];858 String txtData = null;859 WebElement ele = null;860 try {861 log_testActions.info("Entering the text in " + object + " in " + pageName);862 System.out.println("Entering the text in " + object + " in " + pageName);863 txtData = inputValue;864 ele = getObject(getObjectLocator(object));865 waitForVisible(object);866 if (isTestElementPresent(object)) {867 log_testActions.info("Element Found. Entering value of " + object + " i= " + txtData);868 System.out.println("Element Found. Entering value of " + object + " i= " + txtData);869 ele = getObject(getObjectLocator(object));870 ele.clear();871 ele.sendKeys(txtData);872 Thread.sleep(2000);873 ele.sendKeys(Keys.TAB);874 Thread.sleep(1000);875 log_testActions.info("Entered " + txtData + " value in " + object);876 System.out.println("Entered " + txtData + " value in " + object);877 testRunner.testStepResult = true;878 } else {879 log_testActions.info("Element Not Found for " + object);880 System.out.println("Element Not Found for " + object);881 testRunner.testStepResult = false;882 }883 } catch (Exception e) {884 testRunner.stepException = e.getMessage();885 log_testActions.error("Not able to enter the text in " + pageName + "--- " + e.getMessage());886 testRunner.testStepResult = false;887 }888 }889 /*890 ********************************************************************************************************************891 * Method : getInnerTextValue Description : used to get the inner text value892 * from DOM Author: Ashok893 **********************************************************************************************************************894 */895 public static String getInnerTextValue(String object, String data, String pageName, String StepName) {896 String eleValue = "";897 try {898 log_testActions.info("Getting the value of " + object + " in " + pageName);899 if (isTestElementPresent(object)) {900 log_testActions.info("Element Found. Getting value of " + object);901 eleValue = getObject(getObjectLocator(object)).getText();902 log_testActions.info("Element value = " + eleValue);903 testRunner.testStepResult = true;904 } else {905 log_testActions.info("Element Not Found for " + object);906 testRunner.testStepResult = false;907 }908 } catch (Exception e) {909 testRunner.stepException = e.getMessage();910 log_testActions.error("Not able to enter the text in " + pageName + "--- " + e.getMessage());911 testRunner.testStepResult = false;912 }913 return eleValue;914 }915 /*916 ********************************************************************************************************************917 * Method : getTextboxValue Description : Used to Get the Existing value in the918 * text box Author: Ashok919 **********************************************************************************************************************920 */921 public static String getTextboxValue(String object, String data, String pageName, String StepName) {922 String eleValue = "";923 try {924 log_testActions.info("Getting the value of " + object + " in " + pageName);925 if (isTestElementPresent(object)) {926 log_testActions.info("Element Found. Getting value of " + object);927 eleValue = getObject(getObjectLocator(object)).getAttribute("value");928 log_testActions.info("Element value = " + eleValue);929 testRunner.testStepResult = true;930 } else {931 log_testActions.info("Element Not Found for " + object);932 testRunner.testStepResult = false;933 }934 } catch (Exception e) {935 testRunner.stepException = e.getMessage();936 log_testActions.error("Not able to get the value in " + pageName + "--- " + e.getMessage());937 testRunner.testStepResult = false;938 }939 return eleValue;940 }941 /*942 ********************************************************************************************************************943 * Method : getSelectedOption Description : Used to Get the Existing Selected944 * value by the drop down Author: Ashok945 **********************************************************************************************************************946 */947 public static String getSelectedOption(String object, String data, String pageName, String StepName) {948 String eleValue = "";949 WebElement ele;950 try {951 log_testActions.info("Getting the value of " + object + " in " + pageName);952 if (isTestElementPresent(object)) {953 log_testActions.info("Element Found. Getting value of " + object);954 ele = getObject(getObjectLocator(object));955 Select dpdnSelect = new Select(ele);956 eleValue = dpdnSelect.getFirstSelectedOption().getText();957 log_testActions.info("Element value = " + eleValue);958 testRunner.testStepResult = true;959 } else {960 log_testActions.info("Element Not Found for " + object);961 testRunner.testStepResult = false;962 }963 } catch (Exception e) {964 testRunner.stepException = e.getMessage();965 log_testActions.error("Not able to get the value in " + pageName + "--- " + e.getMessage());966 testRunner.testStepResult = false;967 }968 return eleValue;969 }970 /*971 ********************************************************************************************************************972 * Method : getRadioValue Description : Used to Get the DOM value of the Radio973 * value Author: Ashok974 **********************************************************************************************************************975 */976 public static String getRadioValue(String object, String data, String pageName, String StepName) {977 String eleValue = "";978 waitForVisible(object);979 try {980 log_testActions.info("Getting the value of " + object + " in " + pageName);981 if (isTestElementPresent(object)) {982 log_testActions.info("Element Found. Getting value of " + object);983 List<WebElement> eles = getObjects(getObjectLocator(object));984 for (int i = 0; i < eles.size(); i++) {985 WebElement ele = eles.get(i);986 if (ele.isSelected()) {987 eleValue = ele.getAttribute("value");988 constants.radioBtnAttributeValue = eleValue;989 testRunner.reportLogger.log(LogStatus.PASS,990 "The Radio button value is " + constants.radioBtnAttributeValue,991 constants.KEYWORD_PASS);992 }993 }994 log_testActions.info("Element value = " + eleValue);995 testRunner.testStepResult = true;996 } else {997 log_testActions.info("Element Not Found for " + object);998 testRunner.testStepResult = false;999 }1000 } catch (Exception e) {1001 testRunner.stepException = e.getMessage();1002 log_testActions.error("Not able to get the value in " + pageName + "--- " + e.getMessage());1003 testRunner.testStepResult = false;1004 }1005 return eleValue;1006 }1007 /*1008 ********************************************************************************************************************1009 * Method : verifyElementExist Description : Used to verify the WebElement is1010 * Exist on the page Author: Ashok1011 **********************************************************************************************************************1012 */1013 public static boolean verifyElementExist(String object, String data, String pageName, String StepName) {1014 log_testActions.info("Before Verifying " + object + " in " + pageName);1015 try {1016 if (isTestElementPresent(object)) {1017 testRunner.testStepResult = true;1018 log_testActions.info("Verifying " + object + " in " + pageName + " found");1019 System.out.println("Verifying " + object + " in " + pageName + " found");1020 return true;1021 } else {1022 1023 log_testActions.info("Verifying " + object + " in " + pageName + " Not found");1024 System.out.println("Verifying " + object + " in " + pageName + " Not found");1025 testRunner.testStepResult = false;1026 return false;1027 }1028 } catch (Exception e) {1029 testRunner.stepException = e.getMessage();1030 log_testActions.error("Not able to verify the presence of the element");1031 testRunner.testStepResult = false;1032 return false;1033 }1034 }1035 /*1036 ********************************************************************************************************************1037 * Method : verifyElementExist Description : Used to verify the WebElement is1038 * not Exist on the page Author: Ashok1039 **********************************************************************************************************************1040 */1041 public static boolean verifyElementNotExist(String object, String data, String pageName, String StepName) {1042 log_testActions.info("Before Verifying " + object + " in " + pageName);1043 try {1044 if (!isTestElementPresent(object)) {1045 testRunner.testStepResult = true;1046 log_testActions.info("Verifying " + object + " in " + pageName + " not found");1047 System.out.println("Verifying " + object + " in " + pageName + " not found");1048 return true;1049 } else {1050 1051 log_testActions.info("Verifying " + object + " in " + pageName + " found");1052 System.out.println("Verifying " + object + " in " + pageName + " found");1053 testRunner.testStepResult = false;1054 return false;1055 }1056 } catch (Exception e) {1057 testRunner.stepException = e.getMessage();1058 log_testActions.error("Not able to verify the presence of the element");1059 testRunner.testStepResult = false;1060 return false;1061 }1062 }1063 /*1064 ********************************************************************************************************************1065 * Method : comparePageText Description : Used to verify page text is displayed1066 * on the page Author: Ashok1067 **********************************************************************************************************************1068 */1069 public static void comparePageText(String object, String data, String pageName, String StepName) {1070 log_testActions.info("Before compareValue " + object + " in " + pageName);1071 System.out.println("Before compareValue " + object + " in " + pageName);1072 try {1073 String actual;1074 WebElement ele = null;1075 if (data.contains("~"))1076 {1077 String testdata[] = data.split("~");1078 String referenceText = testdata[0];1079 String expectedText = testdata[1];1080 String ActualTextXapth = "(//*[contains(text(),'" + referenceText + "')]/following::*[contains(text(),'"1081 + expectedText + "')])[1]";1082 String ActualText = driver.findElement(By.xpath(ActualTextXapth)).getText();1083 if (ActualText.contains(expectedText)) {1084 testRunner.testStepResult = true;1085 log_testActions.info("Expected =" + expectedText + " and Actual =" + ActualText + " values equal");1086 System.out.println("Expected =" + expectedText + " and Actual =" + ActualText + " values equal");1087 }1088 } else {1089 String eleXpath = "//*[contains(text(),'" + data + "')]";1090 ele = driver.findElement(By.xpath(eleXpath));1091 actual = ele.getText();1092 if (actual.contains(data)) {1093 testRunner.testStepResult = true;1094 log_testActions.info("Expected =" + data + " and Actual =" + actual + " values equal");1095 System.out.println("Expected =" + data + " and Actual =" + actual + " values equal");1096 }1097 }1098 } catch (Exception e) {1099 testRunner.stepException = e.getMessage();1100 log_testActions.error("Not able to compareValue");1101 testRunner.testStepResult = false;1102 }1103 }1104 /*1105 ********************************************************************************************************************1106 * Method : compareValue Description : Used to compare page text is displayed on1107 * the page Author: Ashok1108 **********************************************************************************************************************1109 */1110 public static boolean compareValue(String object, String data, String pageName, String StepName) {1111 WebElement ele;1112 int i, j = 1, k, l, m, n;1113 boolean blnfound = true;1114 String strTempValue[], strNewDatVal;1115 String strTemp, strTemp1, strdate, strDate1, strDate2;1116 log_testActions.info("Before compareValue " + object + " in " + pageName);1117 System.out.println("Before compareValue " + object + " in " + pageName);1118 try {1119 if (!object.contains("")) 1120 {1121 ele = getObject(getObjectLocator(object));1122 boolean expectedresult = ele.isDisplayed();1123 testRunner.testStepResult = true;1124 return expectedresult;1125 }1126 else { 1127 if (data.contains("<<RTD_radioBtnAttributeValue>>")) {1128 data = constants.radioBtnAttributeValue;1129 }1130 if (data.contains("currDate")) {1131 data = constants.Current_Date;1132 }1133 1134 1135 String subValues[] = data.split(";");1136 String strInnerHTML = driver.getPageSource();1137 n = 0;1138 m = 0;1139 //blnfound=true;1140 for (i = 0; i < subValues.length; i++) {1141 if (strInnerHTML.contains(subValues[i])) {1142 blnfound = true;1143 testRunner.testStepResult = true;1144 log_testActions.info("Expected text " + subValues[i] + " is dispalyed in " + pageName);1145 System.out.println("Expected text " + subValues[i] + " is dispalyed in " + pageName);1146 //break;1147 } else {1148 1149 testRunner.testStepResult = false;1150 log_testActions.info("Expected text " + subValues[i] + " is not dispalyed in " + pageName);1151 System.out.println("Expected text " + subValues[i] + " is not dispalyed in " + pageName);1152 blnfound = false;1153 break;1154 }1155 }1156 1157 return blnfound; 1158 }1159 1160 } catch (Exception e) {1161 testRunner.stepException = e.getMessage();1162 log_testActions.error("Not able to compareValue");1163 testRunner.testStepResult = false;1164 return false;1165 }1166 }1167 /*1168 ********************************************************************************************************************1169 * Method : verify Description : Used to verify page text is displayed on the1170 * page Author: Ashok1171 **********************************************************************************************************************1172 */1173 public static boolean verify(String object, String data, String pageName, String StepName) {1174 WebElement ele = null;1175 log_testActions.info("Before compareValue " + object + " in " + pageName);1176 try {1177 String actual;1178 if (object.contains("error")) {1179 String newErrorFieldXpath = "//lable[contains(" + data + ")]";1180 ele = driver.findElement(By.xpath(newErrorFieldXpath));1181 actual = ele.getText();1182 } else {1183 JavascriptExecutor jse = (JavascriptExecutor) driver;1184 String script = "return document.getElementByXPath(\"(//*/text()[preceding-sibling::br and following-sibling::br])[1]'\").getText();";1185 actual = ((JavascriptExecutor) driver).executeScript(script).toString();1186 }1187 if (actual.contains(data)) {1188 testRunner.testStepResult = true;1189 log_testActions.info("Expected =" + data + " and Actual =" + actual + " values equal");1190 return true;1191 } else {1192 1193 log_testActions.info("Expected =" + data + " and Actual =" + actual + " values not equal");1194 testRunner.testStepResult = false;1195 return false;1196 }1197 } catch (Exception e) {1198 testRunner.stepException = e.getMessage();1199 log_testActions.error("Not able to compareValue");1200 testRunner.testStepResult = false;1201 return false;1202 }1203 }1204 /*1205 ********************************************************************************************************************1206 * Method : verifyPageText Description : Used to verify multiple text values1207 * were displayed on the page Author: Ashok1208 **********************************************************************************************************************1209 */1210 public static boolean verifyPageText(String object, String data, String pageName, String StepName) {1211 log_testActions.info("Before compareValue " + object + " in " + pageName);1212 int i, j = 1, k, l, m, n;1213 boolean blnfound = true;1214 String strTempValue[], strNewDatVal;1215 String strTemp, strTemp1, strdate, strDate1, strDate2;1216 try {1217 String subValues[] = data.split("~");1218 String strInnerHTML = driver.getPageSource();1219 n = 0;1220 m = 0;1221 for (i = 0; i < subValues.length; i++) {1222 if (strInnerHTML.contains(subValues[i])) {1223 blnfound = true;1224 testRunner.testStepResult = true;1225 // break;1226 } else {1227 blnfound = false;1228 testRunner.testStepResult = false;1229 break;1230 }1231 }1232 return blnfound;1233 } catch (Exception e) {1234 testRunner.stepException = e.getMessage();1235 log_testActions.error("Not able to compareValue");1236 testRunner.testStepResult = false;1237 return false;1238 }1239 }1240 /*1241 ********************************************************************************************************************1242 * Method : getText Description : Used to get text of the WebElement Author:1243 * Ashok1244 **********************************************************************************************************************1245 */1246 public static String getText(String object, String data, String pageName, String StepName) {1247 WebElement ele = null;1248 log_testActions.info("Before compareValue " + object + " in " + pageName);1249 try {1250 String actual;1251 actual = getObject(getObjectLocator(object)).getText();1252 return actual;1253 } catch (Exception e) {1254 testRunner.stepException = e.getMessage();1255 log_testActions.error("Not able to compareValue");1256 return "testRunner.stepException";1257 }1258 }1259 /*1260 ********************************************************************************************************************1261 * Method : verifyErrorMsg Description : Used to verify the Error Message1262 * Author: Ashok1263 **********************************************************************************************************************1264 */1265 public static boolean verifyErrorMsg(String object, String data, String pageName, String StepName) {1266 WebElement ele = null;1267 try {1268 String expectedErrorText = data;1269 String newErrorFieldXpath = "(//*[contains(text(),'" + data + "')])[1]";1270 String actualerrorText = driver.findElement(By.xpath(newErrorFieldXpath)).getAttribute("innerHTML");1271 if (actualerrorText.contains(expectedErrorText)) {1272 testRunner.testStepResult = true;1273 log_testActions1274 .info("Expected =" + expectedErrorText + " and Actual =" + actualerrorText + " values equal");1275 return true;1276 } else {1277 1278 log_testActions.info(1279 "Expected =" + expectedErrorText + " and Actual =" + actualerrorText + " values not equal");1280 testRunner.testStepResult = false;1281 return false;1282 }1283 } catch (Exception e) {1284 testRunner.stepException = e.getMessage();1285 log_testActions.error("Not able to compareValue");1286 testRunner.testStepResult = false;1287 return false;1288 }1289 }1290 /*1291 ********************************************************************************************************************1292 * Method : verifySelectedElementText Description : Used to verify selected1293 * element text Author: Ashok1294 **********************************************************************************************************************1295 */1296 public static boolean verifySelectedElementText(String object, String data, String pageName, String StepName) {1297 WebElement ele = null;1298 try {1299 String actual;1300 ele = getObject(getObjectLocator(object));1301 String ElementText = ele.getAttribute("innerHTML");1302 if (ElementText.contains(data)) {1303 testRunner.testStepResult = true;1304 log_testActions.info("Expected =" + data + " and Actual =" + ElementText + " values equal");1305 return true;1306 } else {1307 1308 log_testActions.info("Expected =" + data + " and Actual =" + ElementText + " values not equal");1309 testRunner.testStepResult = false;1310 return false;1311 }1312 } catch (Exception e) {1313 testRunner.stepException = e.getMessage();1314 log_testActions.error("Not able to compareValue");1315 testRunner.testStepResult = false;1316 return false;1317 }1318 }1319 /*1320 ********************************************************************************************************************1321 * Method : verifySelectedElementText Description : Used to verify no error1322 * message Author: Ashok1323 **********************************************************************************************************************1324 */1325 public static boolean verifyNoErrorMsg(String object, String data, String pageName, String StepName) {1326 String input[] = data.split("~");1327 String inputType = input[0];1328 String errMsg = input[1];1329 WebElement ele = null;1330 try {1331 String actual;1332 String newErrorFieldXpath = "//label[contains(text(),'" + errMsg + "')]";1333 ele = driver.findElement(By.xpath(newErrorFieldXpath));1334 if (ele == (null)) {1335 testRunner.testStepResult = true;1336 log_testActions.info("Expected =" + errMsg + " Should not be exist");1337 return true;1338 } else {1339 1340 log_testActions.info("Expected step getting failed");1341 testRunner.testStepResult = false;1342 return false;1343 }1344 } catch (Exception e) {1345 testRunner.stepException = e.getMessage();1346 log_testActions.error("Not able to compareValue");1347 testRunner.testStepResult = false;1348 return false;1349 }1350 }1351 /*1352 ********************************************************************************************************************1353 * Method : goToUrl Description :used to navigate to URL Author: Ashok1354 **********************************************************************************************************************1355 */1356 public static void goToUrl(String object, String data, String pageName, String stepName) {1357 log_testActions.info("Before goToURL in " + pageName);1358 testRunner.testStepResult = false;1359 try {1360 1361 1362 driver.get(data);1363 Thread.sleep(10000);1364 String pageTitle = driver.getTitle();1365 if (pageTitle.contains("Certificate") || pageTitle.contains("Certificate")) {1366 javaClick("lnk_CertificateErrorIE", "", "", "Click on continue certificate error");1367 Thread.sleep(5000);1368 }1369 if (pageTitle.contains("Acceptable Usage Policy")) {1370 javaClick("btn_IAcceptError", "", "", "Click on I Accept Button");1371 Thread.sleep(5000);1372 }1373 System.out.println("Navigate url : " + data + " successfully");1374 testRunner.testStepResult = true;1375 } catch (Exception e) {1376 1377 testRunner.stepException = e.getMessage();1378 log_testActions.info("Go to URL Function Failed " + object + " in " + pageName + " --- " + e.getMessage());1379 testRunner.testStepResult = false;1380 }1381 }1382 /*1383 ********************************************************************************************************************1384 * Method : goToUrl Description :used to navigate to URL Author: Ashok1385 **********************************************************************************************************************1386 */1387 public static void navigateToUrl(String object, String data, String pageName, String stepName) {1388 log_testActions.info("Before goToURL in " + pageName);1389 testRunner.testStepResult = false;1390 try {1391 driver.get(data);1392 String pageTitle = driver.getTitle();1393 if (pageTitle.contains("Certificate") || pageTitle.contains("Certificate")) {1394 javaClick("lnk_CertificateErrorIE", "", "", "Click on continue certificate error");1395 Thread.sleep(10000);1396 }1397 testRunner.testStepResult = true;1398 } catch (Exception e) {1399 1400 testRunner.stepException = e.getMessage();1401 log_testActions.info("Go to URL Function Failed " + object + " in " + pageName + " --- " + e.getMessage());1402 testRunner.testStepResult = false;1403 }1404 }1405 public static void navigateBack(String object, String data, String pageName, String stepName) {1406 log_testActions.info("Before goToURL in " + pageName);1407 testRunner.testStepResult = false;1408 try {1409 driver.navigate().back();1410 Thread.sleep(1000);1411 testRunner.testStepResult = true;1412 } catch (Exception e) {1413 1414 testRunner.stepException = e.getMessage();1415 log_testActions.info("Go to URL Function Failed " + object + " in " + pageName + " --- " + e.getMessage());1416 testRunner.testStepResult = false;1417 }1418 }1419 /*1420 ********************************************************************************************************************1421 * Method : isTestElementPresent Description :Verify is WebElement is present on1422 * WebPage Author: Ashok1423 **********************************************************************************************************************1424 */1425 public static boolean isTestElementPresent(String object) throws Exception {1426 if (getObject(getObjectLocator(object)) != null) {1427 log_testActions.info("element found for " + object);1428 testRunner.testStepResult = true;1429 return true;1430 }1431 else {1432 log_testActions.info("element not found for " + object);1433 testRunner.testStepResult = false;1434 return false;1435 }1436 }1437 public static WebElement getObject(By Locator) throws Exception {1438 WebElement ele = null;1439 try {1440 log_testActions.info("Locator in get object method = " + Locator.toString());1441 ele = driver.findElement(Locator);1442 log_testActions.info("Able to find the element for BY = " + Locator.toString());1443 testRunner.testStepResult = true;1444 } catch (Exception e) {1445 testRunner.stepException = e.getMessage();1446 1447 1448 log_testActions.error("Not able to find the element for BY = " + Locator.toString() + " Exception="1449 + testRunner.stepException);1450 testRunner.testStepResult = false;1451 1452 }1453 return ele;1454 }1455 public static List<WebElement> getObjects(By Locator) throws Exception {1456 List<WebElement> ele = null;1457 try {1458 ele = driver.findElements(Locator);1459 } catch (NoSuchElementException e) {1460 1461 testRunner.stepException = e.getMessage();1462 log_testActions.error(1463 "Not able to find the elements for BY = " + Locator + " Exception=" + testRunner.stepException);1464 testRunner.testStepResult = false;1465 }1466 return ele;1467 }1468 public static String[] getLocatorTypeValues(String objectName) throws Exception {1469 log_testActions.info("Before locator values for object " + objectName);1470 String[] locatorTypeValues = new String[2];1471 String locatorTypeValuesString = ObjectReader.OR.getProperty(objectName);1472 log_testActions.info("Locator Property=" + locatorTypeValuesString.toString());1473 String locatorType = locatorTypeValuesString.split(";")[0];1474 String locatorValues = locatorTypeValuesString.split(";")[1];1475 locatorTypeValues[0] = locatorType;1476 locatorTypeValues[1] = locatorValues;1477 log_testActions.info("locatorType = " + locatorType);1478 log_testActions.info("locatorValues = " + locatorValues);1479 return locatorTypeValues;1480 }1481 public static By getObjectLocator(String locatorType, String locatorValue) throws Exception {1482 By locator = null;1483 switch (locatorType) {1484 case "Id":1485 locator = By.id(locatorValue);1486 break;1487 case "className":1488 locator = By.className(locatorValue);1489 break;1490 case "Name":1491 locator = By.name(locatorValue);1492 break;1493 case "CssSelector":1494 locator = By.cssSelector(locatorValue);1495 break;1496 case "LinkText":1497 locator = By.linkText(locatorValue);1498 break;1499 case "PartialLinkText":1500 locator = By.partialLinkText(locatorValue);1501 break;1502 case "TagName":1503 locator = By.tagName(locatorValue);1504 break;1505 case "Xpath":1506 locator = By.xpath(locatorValue);1507 break;1508 }1509 log_testActions.info("locator = " + locator);1510 return locator;1511 }1512 public static By getObjectLocator(String objectName) throws Exception {1513 String locatorProperty = null;1514 if (!objectName.contains(";")) {1515 locatorProperty = ObjectReader.OR.getProperty(objectName);1516 log_testActions.info("Locator Property=" + locatorProperty);1517 } else {1518 locatorProperty = objectName;1519 }1520 String locatorType = locatorProperty.split(";")[0];1521 String locatorValue = locatorProperty.split(";")[1];1522 log_testActions.info("locatorType = " + locatorType);1523 log_testActions.info("locatorValue = " + locatorValue);1524 By locator = null;1525 switch (locatorType) {1526 case "Id":1527 locator = By.id(locatorValue);1528 break;1529 case "Name":1530 locator = By.name(locatorValue);1531 break;1532 case "CssSelector":1533 locator = By.cssSelector(locatorValue);1534 break;1535 case "LinkText":1536 locator = By.linkText(locatorValue);1537 break;1538 case "PartialLinkText":1539 locator = By.partialLinkText(locatorValue);1540 break;1541 case "TagName":1542 locator = By.tagName(locatorValue);1543 break;1544 case "Xpath":1545 locator = By.xpath(locatorValue);1546 break;1547 }1548 log_testActions.info("locator = " + locator);1549 return locator;1550 }1551 /*1552 ********************************************************************************************************************1553 * Method : waitFor Description :Wait for specified time for presence web1554 * element Author: Ashok1555 **********************************************************************************************************************1556 */1557 public static void waitFor(String object, String data, String pageName) throws Exception {1558 try {1559 if (data.contains("~")) {1560 String[] testData = data.split("~");1561 String waitTime = testData[1];1562 Thread.sleep(Long.valueOf(waitTime));1563 testRunner.testStepResult = true;1564 } else {1565 log_testActions.info("Wait for object " + object + " in " + pageName + " for " + data + "Seconds");1566 Thread.sleep(Long.valueOf(data));1567 testRunner.testStepResult = true;1568 }1569 } catch (Exception e) {1570 testRunner.stepException = e.getMessage();1571 log_testActions.error("Not able to Wait --- " + testRunner.stepException);1572 testRunner.testStepResult = false;1573 }1574 }1575 public void waitForElement(String object, String data, String StepName, String pageName) throws Exception {1576 int actualWaitTime;1577 try {1578 String[] testData = data.split("~");1579 String testdata = testData[0];1580 String waitTime = testData[1];1581 actualWaitTime = Integer.parseInt(waitTime) * 1000;1582 if (object.contains("Maersk_SSP_PriceROE")) {1583 WebDriverWait wait = new WebDriverWait(driver, 80);1584 wait.until(ExpectedConditions.visibilityOfElementLocated(1585 By.xpath("//*[contains(text(),'Rate of exchange used for calculation')]")));1586 }1587 else {1588 System.out.println("object is not present");1589 Thread.sleep(Long.valueOf(actualWaitTime));1590 }1591 testRunner.testStepResult = true;1592 } catch (Exception e) {1593 testRunner.stepException = e.getMessage();1594 log_testActions.error("Not able to Wait --- " + testRunner.stepException);1595 testRunner.testStepResult = false;1596 }1597 }1598 /*1599 ********************************************************************************************************************1600 * Method : waitForVisible Description :Wait for specified time for until the1601 * specified condition get satisfied(Condition wait) Author: Ashok1602 **********************************************************************************************************************1603 */1604 public static boolean waitForVisible(String object) {1605 boolean success = false;1606 try {1607 log_testActions.info("Waiting for the Element to visible...");1608 //WebDriverWait wait = new WebDriverWait(driver, 65);1609 WebDriverWait wait = new WebDriverWait(driver, 20);1610 wait.until(ExpectedConditions.visibilityOf(getObject(getObjectLocator(object))));1611 success = true;1612 testRunner.testStepResult = true;1613 } catch (Exception e) {1614 log_testActions.info("Unable to find Element to visible--- " + e);1615 success = false;1616 testRunner.testStepResult = false;1617 }1618 return success;1619 }1620 /*1621 ********************************************************************************************************************1622 * Method : selectOption Description :Used to select Dropdown option Author:1623 * Ashok1624 **********************************************************************************************************************1625 */1626 public static void selectOption(String dpdn, String data, String pageName, String stepName) {1627 try {1628 if (data.equals("")) {1629 log_testActions.info(stepName);1630 WebElement dpdnEle = getObject(getObjectLocator(dpdn));1631 Select selectDPDN = new Select(dpdnEle);1632 List<WebElement> listOptions = selectDPDN.getOptions();1633 selectDPDN.selectByIndex(1);1634 } else {1635 log_testActions.info(stepName);1636 WebElement dpdnEle = getObject(getObjectLocator(dpdn));1637 Select selectDPDN = new Select(dpdnEle);1638 List<WebElement> listOptions = selectDPDN.getOptions();1639 selectDPDN.selectByVisibleText(data);1640 }1641 testRunner.testStepResult = true;1642 } catch (Exception e) {1643 testRunner.stepException = e.getMessage();1644 log_testActions.error("Not able to select --- " + testRunner.stepException);1645 testRunner.testStepResult = false;1646 }1647 }1648 /*1649 * *****************************************************************************1650 * ***************** Method: selectOptionByValue Author: Ashok Description:1651 * Select the dropdown value using value1652 * *****************************************************************************1653 * ****************1654 */1655 public static void selectOptionByValue(String dpdn, String data, String pageName, String stepName) {1656 try {1657 log_testActions.info(stepName);1658 WebElement dpdnEle = getObject(getObjectLocator(dpdn));1659 Select selectDPDN = new Select(dpdnEle);1660 List<WebElement> listOptions = selectDPDN.getOptions();1661 selectDPDN.selectByValue(data);1662 testRunner.testStepResult = true;1663 } catch (Exception e) {1664 testRunner.stepException = e.getMessage();1665 log_testActions.error("Not able to select --- " + testRunner.stepException);1666 testRunner.testStepResult = false;1667 }1668 }1669 /*1670 * *****************************************************************************1671 * ***************** Method: selectOptionUsingPartialText Author: Ashok1672 * Description: Select the drop down value using Partial text1673 * *****************************************************************************1674 * ****************1675 */1676 public static void selectOptionUsingPartialText(String dpdn, String data, String pageName, String stepName) {1677 String txtData = data;1678 try {1679 log_testActions.info(stepName);1680 if (dpdn.contains("Maersk_ssp_imo_number")) {1681 Thread.sleep(2000);1682 }1683 WebElement dpdnEle = getObject(getObjectLocator(dpdn));1684 Select selectDPDN = new Select(dpdnEle);1685 List<WebElement> listOptions = selectDPDN.getOptions();1686 // List<WebElement> listOptions=selectDPDN.getAllSelectedOptions();1687 System.out.println("Print otions:" + listOptions);1688 for (int i = 0; i <= listOptions.size(); i++) {1689 String sValue = listOptions.get(i).getText();1690 if (sValue.contains(txtData)) {1691 selectDPDN.selectByIndex(i);1692 testRunner.testStepResult = true;1693 break;1694 }1695 }1696 } catch (Exception e) {1697 testRunner.stepException = e.getMessage();1698 log_testActions.error("Not able to select --- " + testRunner.stepException);1699 testRunner.testStepResult = false;1700 }1701 }1702 /*1703 ********************************************************************************************************************1704 * Method : moveClick Description :Used to move cursor and click on web element1705 * Author: Santhosh1706 **********************************************************************************************************************1707 */1708 public static void moveClick(String object, String data, String pageName, String stepName) {1709 try {1710 Thread.sleep(5000);1711 log_testActions.info("Moving on main menu " + object);1712 String[] locaotrsTypeValues = getLocatorTypeValues(object);1713 String locatorType = locaotrsTypeValues[0];1714 String locatorValue1 = locaotrsTypeValues[1].split("&")[0];1715 String locatorValue2 = locaotrsTypeValues[1].split("&")[1];1716 log_testActions.info("locatorValue1 " + locatorValue1);1717 log_testActions.info("locatorValue2 " + locatorValue2);1718 log_testActions.info("Before clicking main menu");1719 WebElement menu = getObject(getObjectLocator(locatorType, locatorValue1));1720 Actions action = new Actions(driver);1721 action.moveToElement(menu).moveToElement(getObject(getObjectLocator(locatorType, locatorValue2))).click()1722 .build().perform();1723 testRunner.testStepResult = true;1724 } catch (Exception e) {1725 testRunner.stepException = e.getMessage();1726 log_testActions.error("Not able to move --- " + testRunner.stepException);1727 testRunner.testStepResult = false;1728 }1729 }1730 /*1731 * *****************************************************************************1732 * ***************** Method: verifyList Author: Ashok Description: verify the1733 * List items in Dropdown1734 * *****************************************************************************1735 * ****************1736 */1737 public static void verifyList(String object, String data, String pageName, String StepName) {1738 log_testActions.info("Before Verifying " + object + " in " + pageName);1739 ArrayList<String> inList;1740 ArrayList<String> outList;1741 ArrayList<WebElement> eleList;1742 String[] inArray;1743 try {1744 if (isTestElementPresent(object)) {1745 inArray = data.split(",");1746 inList = new ArrayList<String>(Arrays.asList(inArray));1747 eleList = (ArrayList<WebElement>) getObjects(getObjectLocator(object));1748 outList = new ArrayList<String>(eleList.size());1749 boolean success = true;1750 for (WebElement ele : eleList) {1751 outList.add(ele.getText());1752 }1753 int inListSize = inList.size();1754 int outListSize = outList.size();1755 if (inListSize == outListSize) {1756 for (int i = 0; i < inListSize; i++) {1757 if (inList.contains(outList.get(i))) {1758 log_testActions.info("The inList item = " + inList.get(i) + " Equal to The outList item="1759 + outList.get(i));1760 success = true;1761 i++;1762 } else {1763 log_testActions.info("The inList item = " + inList.get(i)1764 + " Not Equal to The outList item=" + outList.get(i));1765 success = false;1766 break;1767 }1768 }1769 } else {1770 log_testActions.info("The size of inList=" + inListSize + " The size of outList=" + outListSize);1771 success = false;1772 }1773 if (success) {1774 testRunner.testStepResult = true;1775 log_testActions.info("Verifying List of" + object + " in " + pageName + " Success");1776 } else {1777 log_testActions.info("Verifying List of" + object + " in " + pageName + " Fail");1778 testRunner.testStepResult = false;1779 }1780 } else {1781 testRunner.testStepResult = false;1782 log_testActions.info("Verifying " + object + " in " + pageName + " Not found");1783 }1784 } catch (Exception e) {1785 testRunner.stepException = e.getMessage();1786 log_testActions.error("Not able to verify the presence of the element");1787 testRunner.testStepResult = false;1788 }1789 }1790 /*1791 * *****************************************************************************1792 * ***************** Method: getcustomerCode Author: Ashok Description: Getting1793 * custmer code1794 * *****************************************************************************1795 * ****************1796 */1797 public static String getcustomerCode(String object) {1798 log_testActions.info("Before getcustomerCode");1799 String customerCode = "";1800 try {1801 customerCode = getInnerTextValue(object, "", "", "");1802 } catch (Exception ex) {1803 log_testActions.info("Exception=" + ex.getMessage());1804 }1805 return customerCode;1806 }1807 /*1808 * *****************************************************************************1809 * ***************** Method: getbokingNumber Author: Ashok Description: Getting1810 * runtime booking number1811 * *****************************************************************************1812 * ****************1813 */1814 public static String getbokingNumber(String object, String data, String pageName, String StepName) {1815 log_testActions.info("Before getcustomerCode");1816 String bookinNumber = "";1817 try {1818 /*1819 * bookingNumber =getInnerTextValue(object,"","","");1820 * 1821 * bookingNumber=constants.Booking_Number;1822 */1823 bookinNumber = driver.findElement(By.xpath("//*[contains(text(),'Your booking has number')]")).getText();1824 String partialBooking_Number = bookinNumber.replaceAll("\\D", "");1825 String example = bookinNumber;1826 String AllWords[] = example.split(" ");1827 for (int i = 0; i < AllWords.length; i++) {1828 if (AllWords[i].contains(partialBooking_Number)) {1829 constants.Booking_Number = AllWords[i];1830 constants.Booking_Number = constants.Booking_Number.replaceAll("[.]", "");1831 // System.out.println("Booking number1832 // "+constants.Booking_Number.replaceAll("[.]", ""));1833 break;1834 }1835 }1836 System.out.println(constants.Booking_Number);1837 log_testActions.info(" Shipment Booking Number = " + constants.Booking_Number);1838 log_testActions.info("napBooking Success ");1839 testRunner.testStepResult = true;1840 testRunner.reportLogger.log(LogStatus.PASS, "Your Booking Number is: " + constants.Booking_Number,1841 constants.KEYWORD_PASS);1842 } catch (Exception ex) {1843 log_testActions.info("Exception=" + ex.getMessage());1844 testRunner.testStepResult = false;1845 }1846 return bookinNumber;1847 }1848 /*1849 * *****************************************************************************1850 * ***************** Method: clearTextBox Author: Ashok Description: Clear the1851 * existing text value1852 * *****************************************************************************1853 * ****************1854 */1855 public static void clearTextBox(String object, String data, String pageName, String StepName) {1856 try {1857 log_testActions.info("Clearing the text in " + object + " in " + pageName);1858 waitForVisible(object);1859 log_testActions.info("Element Found. Clearing value of " + object);1860 getObject(getObjectLocator(object)).clear();1861 testRunner.testStepResult = true;1862 } catch (Exception e) {1863 testRunner.stepException = e.getMessage();1864 log_testActions.error("Not able to Clear the text in " + pageName + "--- " + e.getMessage());1865 testRunner.testStepResult = false;1866 }1867 }1868 /*1869 ***********************************************************************************************1870 * Method: verifyCharCount Author: Ashok Description: Used to verify Character1871 * count1872 ***********************************************************************************************1873 */1874 public static void verifyCharCount(String object, String data, String pageName, String StepName) {1875 try {1876 String WebElementText = getObject(getObjectLocator(object)).getAttribute("value");1877 // String s = "...";1878 int counter = 0;1879 for (int i = 0; i < WebElementText.length(); i++) {1880 if (Character.isLetter(WebElementText.charAt(i)))1881 counter++;1882 }1883 System.out.println(counter);1884 int expectedCount = Integer.parseInt(data);1885 if (counter == expectedCount) {1886 testRunner.testStepResult = true;1887 } else {1888 log_testActions.info("Character count accepted " + object);1889 testRunner.testStepResult = false;1890 }1891 } catch (Exception e) {1892 testRunner.stepException = e.getMessage();1893 log_testActions.error("Not able to Clear the text in " + pageName + "--- " + e.getMessage());1894 testRunner.testStepResult = false;1895 }1896 }1897 /*1898 * *****************************************************************************1899 * ***************** Method: selectDPDNValue Author: Ashok Description: Select1900 * list value1901 * *****************************************************************************1902 * ****************1903 */1904 public static void selectDPDNValue(String dpdnElement, String dpdnTextBox, String invalue1, String inValue2,1905 String pageName, String dpdnName) throws Exception {1906 String dpdnListValue;1907 String input = invalue1;1908 try {1909 if (dpdnName.equals("Commodity")) {1910 dpdnListValue = "Xpath;//*[text()='" + input + "']/parent::div";1911 } else if (dpdnName.equals("ContainerType")) {1912 String conCategory = input.split("-")[0];1913 String conSizeType = input.split("-")[1];1914 String conSize = conSizeType.substring(0, 2);1915 String conType = conSizeType.substring(4);1916 input = conSizeType;1917 if (conCategory.contains("Shipper")) {1918 if (conType.contains("Reefer"))1919 dpdnListValue = "Xpath;//div[contains(text(),'" + conCategory1920 + "')]/parent::li[contains(@class,'shippersownReefer')]";1921 else1922 dpdnListValue = "Xpath;//div[contains(text(),'" + conCategory1923 + "')]/parent::li[contains(@class,'shippersownOversized')]";1924 } else {1925 dpdnListValue = "Xpath;//div[contains(text(),'" + conCategory + "')]/parent::li";1926 }1927 } else {1928 dpdnListValue = "Xpath;//*[text()='" + input + "']/parent::div[text()='" + inValue2 + "']";1929 }1930 // clickElement(dpdnElement, "", pageName, "Click on " + dpdnName + "1931 // dropdown");1932 // input(dpdnTextBox, input, pageName, "Enter value in " + dpdnName + "1933 // textbox");1934 // clickElement(dpdnListValue, "", pageName, "Select value " + dpdnName + "1935 // dropdown");1936 WebElement dropdown = getObject(getObjectLocator(dpdnElement));1937 dropdown.click();1938 input(dpdnTextBox, input, pageName, "Enter value in " + dpdnName + " textbox");1939 WebElement lsitvalue = getObject(getObjectLocator(dpdnListValue));1940 lsitvalue.click();1941 testRunner.testStepResult = true;1942 } catch (Exception ex) {1943 log_testActions.info(" napBooking Failure. Exception = " + ex.getMessage());1944 testRunner.testStepResult = false;1945 }1946 }1947 /*1948 * *****************************************************************************1949 * ***************** Method: checkSelected Author: Ashok Description: Verify the1950 * Check box is Selected1951 * *****************************************************************************1952 * ****************1953 */1954 public static String checkSelected(String object, String data, String pageName, String StepName) {1955 log_testActions.info("checking checkbox selection " + object + " in " + pageName);1956 WebElement ele = null;1957 String selected = "";1958 try {1959 ele = getObject(getObjectLocator(object));1960 if (ele.isSelected()) {1961 testRunner.testStepResult = true;1962 selected = "checked";1963 } else {1964 testRunner.testStepResult = false;1965 selected = "notchecked";1966 }1967 } catch (Exception e) {1968 testRunner.stepException = e.getMessage();1969 log_testActions.error(object + " Not able to Check. Exception = " + testRunner.stepException);1970 testRunner.testStepResult = false;1971 }1972 return selected;1973 }1974 /*1975 * *****************************************************************************1976 * ***************** Method: checkDisabled Author: Ashok Description: Verify the1977 * Check Box is Disabled1978 * *****************************************************************************1979 * ****************1980 */1981 public static String checkDisabled(String object, String data, String pageName, String StepName) {1982 log_testActions.info("checking checkbox disabled " + object + " in " + pageName);1983 WebElement ele = null;1984 String disabled = "";1985 try {1986 ele = getObject(getObjectLocator(object));1987 if (!ele.isEnabled()) {1988 testRunner.testStepResult = true;1989 disabled = "disabled";1990 } else {1991 testRunner.testStepResult = false;1992 disabled = "enabled";1993 }1994 } catch (Exception e) {1995 testRunner.stepException = e.getMessage();1996 log_testActions.error(object + " Not able to Check. Exception = " + testRunner.stepException);1997 testRunner.testStepResult = false;1998 }1999 return disabled;2000 }2001 /*2002 * *****************************************************************************2003 * ***************** Method: OOGShipperownSingleCargoBooking Author: Ashok2004 * Description: Creating OOGShipperownSingleCargoBooking2005 * *****************************************************************************2006 * ****************2007 */2008 public static void OOGShipperownSingleCargoBooking(String object, String data, String pageName, String StepName)2009 throws Exception {2010 try {2011 String[] objectValue = object.split(";");2012 String MainMenu = objectValue[0];2013 String subMenu = objectValue[1];2014 String[] testData = data.split(";");2015 log_testActions.info("Before OOG Shipper own Single Cargo Booking ");2016 String fromValue1 = testData[0];2017 String fromValue2 = testData[1];2018 String toValue1 = testData[2];2019 String toValue2 = testData[3];2020 String conType = testData[4];2021 String commValue = testData[5];2022 String contCount = testData[6];2023 String conTypeValue = testData[7];2024 String weight = testData[8];2025 String contractTariff = testData[9];2026 // String contactPerson = testData[10];2027 String reference = testData[10];2028 String exportType = testData[11];2029 String importType = testData[12];2030 String haulage_Instructions = testData[13];2031 String loadAddress = testData[14];2032 SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");2033 Date todayDate = Calendar.getInstance().getTime();2034 String todayDateString = formatter.format(todayDate);2035 String[] cont1LoadDetails = testData[15].split("/");2036 String cont1LoadFromDate = cont1LoadDetails[0].equals("today") ? todayDateString : cont1LoadDetails[0];2037 String cont1LoadFromTime = cont1LoadDetails[1];2038 String cont1LoadToDate = cont1LoadDetails[2].equals("today") ? todayDateString : cont1LoadDetails[2];2039 String cont1LoadToTime = cont1LoadDetails[3];2040 String cont1LoadRef = cont1LoadDetails[4];2041 String[] cont1Dimention1 = testData[16].split("/");2042 String length1 = cont1Dimention1[0];2043 String width1 = cont1Dimention1[1];2044 String height1 = cont1Dimention1[2];2045 // String CargoDetails = testData[19];2046 String additionalRefType = testData[17];2047 String additionalRefValue = testData[18];2048 String Temparature = testData[19];2049 log_testActions.info("After getting input values");2050 /*2051 * navigateToUrl("", "https://myt.apmoller.net/booking/new", "Booking_Page",2052 * "navigated to new booking page");2053 */2054 /*2055 * navigateMenu(2056 * "Maersk_SSP_Menu_BOOK;Maersk_SSP_subMenu_NewBookShipment","BOOK~New BookShipment"2057 * ,"Booking_Page","Nvaigate to new Booking page");2058 * log_testActions.info("After Booking page");2059 */2060 if (testRunner.testName.contains("_MML_")) {2061 IGNnavigateMenu("Maersk_SSP_IGN_btn_Book;Maersk_SSP_IGN_lnk_BookNewShipment", "BOOK~New BookShipment",2062 "Booking_Page", "Nvaigate to new Booking page");2063 } else {2064 /*2065 * navigateToUrl("", "https://myt.apmoller.net/shipmentbinder/", "Booking_Page",2066 * "navigated to new booking page");2067 */2068 navigateMenu("Maersk_SSP_Menu_BOOK;Maersk_SSP_subMenu_NewBookShipment", "BOOK~New BookShipment",2069 "Booking_Page", "Nvaigate to new Booking page");2070 }2071 waitForVisible("txt_BookingPage1");2072 compareValue("txt_BookingPage1", "Booked By", "Booking_Page", "Verify Booking Page");2073 selectDPDNValue("dpdn_From_BP", "txtbx_From_BP", fromValue1, fromValue2, "Booking_Page", "From");2074 selectDPDNValue("dpdn_To_BP", "txtbx_To_BP", toValue1, toValue2, "Booking_Page", "To");2075 // New changes2076 if (exportType.equals("SD")) {2077 waitForVisible("radio_Export_SD");2078 clickElement("radio_Export_SD", "", "Booking_Page2", "Select Export SD mode");2079 }2080 selectDPDNValue("dpdn_Commodity_BP", "txtbx_Commodity_BP", commValue, "", "Booking_Page", "Commodity");2081 selectDPDNValue("dpdn_Container_BP", "txtbx_Container_BP", conTypeValue, "", "Booking_Page",2082 "ContainerType");2083 /*2084 * if(conType.contains("Oversized")){2085 * 2086 * clickElement("chk_cargoOversized", "", "Booking_Page",2087 * "Select Cargo Oversized");2088 * 2089 * }2090 */2091 // Added by Ashok2092 clickElement("Maersk_SSP_chk_Shippers1stContainer", "", "Booking_Page",2093 "Select Shippers1stContainer checkbox");2094 input("txtbx_Weight_BP", weight, "Booking_Page", "Enter weight");2095 clickElement("Maersk_SSP_chk_iamPriceOwner", "", "Booking_Page", "Click on iam price owner check box");2096 // clickElement("chkbx_tariff", "", "Booking_Page", "Select Tariff");2097 // input("txtbx_contract_BP", contractTariff, "Booking_Page", "Enter Contract2098 // number");2099 // New changes2100 selectOptionUsingPartialText("Maersk_SSP_lst_PriceOwner", "Gcss Booked By, Copenhagen", pageName, StepName);2101 clickElement("btn_Continue_Book", "", "Booking_Page", "Click Continue");2102 waitForVisible("txt_BookingPage2");2103 compareValue("txt_BookingPage2", "Configure your booking details below", "Booking_Page2",2104 "Verify Booking Page2");2105 input("txtbx_BookedbyReference", reference, "Booking_Page2", "Enter Booked by Reference");2106 javaClick("Maersk_SSP_lnk_addHaulage1", "", "Booking page2", "Click on add haulage link");2107 // selectOption("select_LoadAddress", loadAddress, "Booking_Page2", "Select Load2108 // Address");2109 if (conType.contains("Oversized")) {2110 selectOptionUsingPartialText("dpdn_ReleaseDepotCity", loadAddress, "Booking_Page2",2111 "Select Load Address");2112 input("txtbx_releaseDate", "currDate", "Booking_Page2", "Enter Booked by Reference");2113 input("txtbx_releaseTime", "1000", "Booking_Page2", "Enter Booked by Reference");2114 } else {2115 selectOptionUsingPartialText("select_LoadAddress", loadAddress, "Booking_Page2", "Select Load Address");2116 }2117 // input("txtbx_HaulageInstructions", haulage_Instructions, "Booking_Page2",2118 // "Enter Booked by Reference");2119 if (conTypeValue.contains("Reefer")) {2120 input("txtbx_Temerature", Temparature, "Booking_Page2", "Enter Temparature value");2121 }2122 if (exportType.equals("SD")) {2123 input("txtbx_Cont1LoadFromDate", cont1LoadFromDate, "Booking_Page2", "Enter Container1 Load From Date");2124 input("txtbx_Cont1LoadFromTime", cont1LoadFromTime, "Booking_Page2", "Enter Container1 Load From Time");2125 input("txtbx_Cont1LoadToDate", cont1LoadToDate, "Booking_Page2", "Enter Container1 Load To Date");2126 input("txtbx_Cont1LoadToTime", cont1LoadToTime, "Booking_Page2", "Enter Container1 Load To Time");2127 input("txtbx_Cont1LoadRef", cont1LoadRef, "Booking_Page2", "Enter Container1 Load To Time");2128 }2129 if (conType.contains("Oversized")) {2130 javaClick("Maersk_SSP_lnk_AddOverSizedCargoDetails", "", "Booking_Page2", "Click on AddOversized link");2131 input("Maersk_SSP_txtbx_QuoteReference", "oversized", "Booking_Page2", "Enter length of container1");2132 input("Maersk_SSP_txtbx_Container1Length", length1, "Booking_Page2", "Enter length of container1");2133 input("Maersk_SSP_txtbx_Container1Width", width1, "Booking_Page2", "Enter width of container1");2134 input("Maersk_SSP_txtbx_Container1Hight", height1, "Booking_Page2", "Enter height of container1");2135 input("Maersk_SSP_txtbx_Container1Wieght", "500", "Booking_Page2", "Enter height of container1");2136 javaClick("Maersk_SSP_lnk_ApplyAddOverSizedDetails", "", "Booking_Page2", "Click on Apply button");2137 }2138 selectOption("select_AdditionalReference", "Export License Received", "Booking_Page2",2139 "Select Export License Received");2140 input("select_YesNo", "Yes", "Booking_Page2", "Select Yes value");2141 clickElement("lnk_AdditionalReferences", "", "Booking_Page2", "Click Add additional reference link");2142 selectOption("select_AdditionalReference2", "OOG-BB Quote Reference Number", "Booking_Page2",2143 "OOG-BB Quote Reference Number");2144 input("txtbx_AdditionalReference2", "11111", "Booking_Page2", "enter value 11111");2145 clickElement("lnk_AdditionalReferences", "", "Booking_Page2", "Click Add additional reference link");2146 selectOption("select_AdditionalReference3", "UCR (Shipper Unique Consignment Ref)", "Booking_Page2",2147 "UCR (Shipper Unique Consignment Ref)");2148 input("txtbx_AdditionalReference3", "22222", "Booking_Page2", "enter value 22222");2149 clickElement("btn_BookShipment", "", "Booking_Page2", "Click Book Shipment");2150 javaClick("btn_PlaceBooking", "", "Booking_Page2", "Click Place Booking");2151 compareValue("txt_BookingSuccessMessage", "Your booking has number", "Booking_Page",2152 "Verify Booking Page2");2153 String bookinNumber = driver.findElement(By.xpath("//*[contains(text(),'Your booking has number')]"))2154 .getText();2155 constants.Booking_Number = bookinNumber.replaceAll("\\D", "");2156 if (testRunner.testName.contains("_SGL_")) {2157 constants.Booking_Number = "SGL" + constants.Booking_Number;2158 }2159 if (testRunner.testName.contains("_SEA_")) {2160 constants.Booking_Number = "SLD" + constants.Booking_Number;2161 }2162 if (testRunner.testName.contains("_MCC_")) {2163 constants.Booking_Number = "MCB" + constants.Booking_Number;2164 }2165 System.out.println(constants.Booking_Number);2166 log_testActions.info(" Shipment Booking Number = " + constants.Booking_Number);2167 testRunner.reportLogger.log(LogStatus.PASS,2168 "B5 OOGShipperownSingleCargoBooking number " + constants.Booking_Number, constants.KEYWORD_PASS);2169 log_testActions.info("OOGShipperownSingleCargoBooking Booking Success ");2170 }2171 catch (Exception ex) {2172 log_testActions.info(" OOGShipperownDGMultiCargo Booking Failure. Exception = " + ex.getMessage());2173 testRunner.testStepResult = false;2174 }2175 }2176 /*2177 * *****************************************************************************2178 * ***************** Method: checkEnabled Author: Ashok Description: To Verify2179 * Check box enabled2180 * *****************************************************************************2181 * ****************2182 */2183 public static String checkEnabled(String object, String data, String pageName, String StepName) {2184 log_testActions.info("checking checkbox Enabled " + object + " in " + pageName);2185 WebElement ele = null;2186 String disabled = "";2187 try {2188 ele = getObject(getObjectLocator(object));2189 if (ele.isEnabled()) {2190 testRunner.testStepResult = true;2191 disabled = "enabled";2192 } else {2193 testRunner.testStepResult = false;2194 disabled = "disabled";2195 }2196 } catch (Exception e) {2197 testRunner.stepException = e.getMessage();2198 log_testActions.error(object + " Not able to Check. Exception = " + testRunner.stepException);2199 testRunner.testStepResult = false;2200 }2201 return disabled;2202 }2203 /*2204 * *****************************************************************************2205 * ***************** Method: checkUnSelected Author: Ashok Description: To2206 * Verify Check box is unchecked2207 * *****************************************************************************2208 * ****************2209 */2210 public static String checkUnSelected(String object, String data, String pageName, String StepName) {2211 log_testActions.info("checking checkbox selection " + object + " in " + pageName);2212 WebElement ele = null;2213 String notSelected = "";2214 try {2215 ele = getObject(getObjectLocator(object));2216 if (ele.isSelected()) {2217 testRunner.testStepResult = false;2218 notSelected = "no";2219 } else {2220 testRunner.testStepResult = true;2221 notSelected = "yes";2222 }2223 } catch (Exception e) {2224 testRunner.stepException = e.getMessage();2225 log_testActions.error(object + " Not able to Check. Exception = " + testRunner.stepException);2226 testRunner.testStepResult = false;2227 }2228 return notSelected;2229 }2230 /*2231 * *****************************************************************************2232 * ***************** Method: napBooking Author: Ashok Description: To create2233 * normal booking2234 * *****************************************************************************2235 * ****************2236 */2237 public void napBooking(String object, String data, String pageName, String StepName) throws Exception {2238 constants.Booking_Number = null;2239 try {2240 String[] testData = data.split(";");2241 int length = testData.length;2242 log_testActions.info("Before napBooking ");2243 String fromValue1 = testData[0];2244 String fromValue2 = testData[1];2245 String toValue1 = testData[2];2246 String toValue2 = testData[3];2247 String conType = testData[4];2248 String commValue = testData[5];2249 String contCount = testData[6];2250 String conTypeValue = testData[7];2251 String weight = testData[8];2252 String contractTariff = testData[9];2253 String contactPerson = testData[10];2254 String reference = testData[11];2255 String exportType = testData[12];2256 String importType = testData[13];2257 String priceOwner = testData[14];2258 // navigateMenu("Maersk_SSP_Menu_BOOK;Maersk_SSP_subMenu_NewBookShipment","BOOK~New2259 // BookShipment","Booking_Page","Nvaigate to new Booking page");2260 if (testRunner.testName.contains("_MML_")) {2261 IGNnavigateMenu("Maersk_SSP_IGN_btn_Book;Maersk_SSP_IGN_lnk_BookNewShipment", "BOOK~New BookShipment",2262 "Booking_Page", "Nvaigate to new Booking page");2263 } else {2264 /*2265 * navigateToUrl("", "https://myt.apmoller.net/shipmentbinder/", "Booking_Page",2266 * "navigated to new booking page");2267 */2268 navigateMenu("Maersk_SSP_Menu_BOOK;Maersk_SSP_subMenu_NewBookShipment", "BOOK~New BookShipment",2269 "Booking_Page", "Nvaigate to new Booking page");2270 }2271 waitForVisible("txt_BookingPage1");2272 compareValue("txt_BookingPage1", "Book New Shipments", "Booking_Page", "Verify Booking Page");2273 selectDPDNValue("dpdn_From_BP", "txtbx_From_BP", fromValue1, fromValue2, "Booking_Page", "From");2274 log_testActions.info(" From Address Selected as = " + fromValue1);2275 selectDPDNValue("dpdn_To_BP", "txtbx_To_BP", toValue1, toValue2, "Booking_Page", "To");2276 log_testActions.info(" To Address Selected as = " + toValue1);2277 selectDPDNValue("dpdn_Commodity_BP", "txtbx_Commodity_BP", commValue, "", "Booking_Page", "Commodity");2278 selectDPDNValue("dpdn_Container_BP", "txtbx_Container_BP", conTypeValue, "", "Booking_Page",2279 "ContainerType");2280 input("txtbx_Weight_BP", weight, "Booking_Page", "Enter weight");2281 clickElement("Maersk_SSP_chk_iamPriceOwner", "", "Booking_Page", "Click on iam price owner check box");2282 // functinality changed as R382283 // clickElement("chkbx_tariff", "", "Booking_Page", "Select Tariff");2284 selectOptionUsingPartialText("Maersk_SSP_lst_PriceOwner", priceOwner, pageName, StepName);2285 clickElement("btn_Continue_Book", "", "Booking_Page", "Click Continue");2286 waitForVisible("txt_BookingPage2");2287 compareValue("txt_BookingPage2", "Configure your booking details below", "Booking_Page2",2288 "Verify Booking Page2");2289 input("txtbx_BookedbyReference", reference, "Booking_Page2", "Enter Booked by Reference");2290 javaClick("btn_BookShipment", "", "Booking_Page2", "Click Book Shipment");2291 javaClick("btn_PlaceBooking", "", "Booking_Page2", "Click Place Booking");2292 // driver.getPageSource().contains("Text which you looking for");2293 compareValue("txt_BookingSuccessMessage", "Your booking has number", "Booking_Page",2294 "Verify Booking Page2");2295 String bookinNumber = driver.findElement(By.xpath("//*[contains(text(),'Your booking has number')]"))2296 .getText();2297 String partialBooking_Number = bookinNumber.replaceAll("\\D", "");2298 String example = bookinNumber;2299 String AllWords[] = example.split(" ");2300 for (int i = 0; i < AllWords.length; i++) {2301 if (AllWords[i].contains(partialBooking_Number)) {2302 constants.Booking_Number = AllWords[i];2303 constants.Booking_Number = constants.Booking_Number.replaceAll("[.]", "");2304 // System.out.println("Booking number2305 // "+constants.Booking_Number.replaceAll("[.]", ""));2306 break;2307 }2308 }2309 System.out.println(constants.Booking_Number);2310 log_testActions.info(" Shipment Booking Number = " + constants.Booking_Number);2311 log_testActions.info("napBooking Success ");2312 testRunner.reportLogger.log(LogStatus.PASS, "B1 Napbooking Number " + constants.Booking_Number,2313 constants.KEYWORD_PASS);2314 testRunner.testStepResult = true;2315 } catch (Exception ex) {2316 log_testActions.info(" napBooking Failure. Exception = " + ex.getMessage());2317 testRunner.testStepResult = false;2318 }2319 }2320 public void preRequisite(String object, String data, String pageName, String StepName) throws Exception {2321 constants.Booking_Number = null;2322 try {2323 String[] testData = data.split(";");2324 int length = testData.length;2325 goToUrl("https://myt.apmoller.net/backoffice2/index", "", "Home_Page",2326 "navigating to the back ofiice page");2327 selectListValue("Maersk_SSP_dpdn_featureList;Maersk_SSP_txtbx_featureList", "DEADLINE_FEATURE;;Other", "",2328 "");2329 javaClick("Maersk_SSP_rdo_Enabled", "", "", "");2330 javaClick("Maersk_SSP_lnk_SelectAll", "", "", "");2331 javaClick("Maersk_SSP_rdo_SubmitBackOffice", "", "", "");2332 selectListValue("Maersk_SSP_dpdn_featureList;Maersk_SSP_txtbx_featureList", "DANGEROUS_DETAILS;;Other", "",2333 "");2334 javaClick("Maersk_SSP_rdo_Disabled", "", "", "");2335 javaClick("Maersk_SSP_lnk_SelectAll", "", "", "");2336 javaClick("Maersk_SSP_rdo_SubmitBackOffice", "", "", "");2337 testRunner.testStepResult = true;2338 } catch (Exception ex) {2339 log_testActions.info(" napBooking Failure. Exception = " + ex.getMessage());2340 testRunner.testStepResult = false;2341 }2342 }2343 /*2344 * *****************************************************************************2345 * ***************** Method: bookingFirstPage Author: Ashok Description: Enter2346 * All values for Booking first page2347 * *****************************************************************************2348 * ****************2349 */2350 public static void bookingFirstPage(String object, String data, String pageName, String StepName) throws Exception {2351 try {2352 String[] testData = data.split(";");2353 int length = testData.length;2354 log_testActions.info("Before napBooking ");2355 String fromValue1 = testData[0];2356 String fromValue2 = testData[1];2357 String toValue1 = testData[2];2358 String toValue2 = testData[3];2359 String conType = testData[4];2360 String commValue = testData[5];2361 String contCount = testData[6];2362 String conTypeValue = testData[7];2363 String weight = testData[8];2364 String contractTariff = testData[9];2365 // String contactPerson = testData[10];2366 String reference = testData[10];2367 String exportType = testData[11];2368 String importType = testData[12];2369 /*2370 * navigateToUrl("", "https://myt.apmoller.net/booking/new", "Booking_Page",2371 * "navigated to new booking page");2372 */2373 /*2374 * navigateMenu("Maersk_SSP_Menu_BOOK;Maersk_SSP_subMenu_NewBookShipment",data,2375 * "Booking_Page","Nvaigate to new Booking page");2376 */2377 if (testRunner.testName.contains("_MML_")) {2378 // IGNnavigateMenu("Maersk_SSP_IGN_btn_Book;Maersk_SSP_IGN_lnk_BookNewShipment","BOOK~New2379 // BookShipment","Booking_Page","Nvaigate to new Booking page");2380 clickElement("Maersk_SSP_lnk_BookNewShipments", "BOOK~New BookShipment", "Booking_Page",2381 "Nvaigate to new Booking page");2382 } else {2383 /*2384 * navigateToUrl("", "https://myt.apmoller.net/shipmentbinder/", "Booking_Page",2385 * "navigated to new booking page");2386 */2387 // navigateMenu("Maersk_SSP_Menu_BOOK;Maersk_SSP_subMenu_NewBookShipment","BOOK~New2388 // BookShipment","Booking_Page","Nvaigate to new Booking page");2389 clickElement("Maersk_SSP_lnk_BookNewShipments", "BOOK~New BookShipment", "Booking_Page",2390 "Nvaigate to new Booking page");2391 }2392 waitForVisible("txt_BookingPage1");2393 // javaClick("Maersk_btn_AcceptCookies","","Booking_Page","Click on Accept2394 // cookies");2395 compareValue("", "Book New Shipments", "Booking_Page", "Verify Booking Page");2396 selectDPDNValue("dpdn_From_BP", "txtbx_From_BP", fromValue1, fromValue2, "Booking_Page", "From");2397 log_testActions.info(" From Address Selected as = " + fromValue1);2398 selectDPDNValue("dpdn_To_BP", "txtbx_To_BP", toValue1, toValue2, "Booking_Page", "To");2399 log_testActions.info(" To Address Selected as = " + toValue1);2400 selectRateLookUpRateCaluculationDate(2401 "Maersk_SSP_txtbx_DepartureDate;Maersk_SSP_lst_DepartureMonth;Maersk_SSP_lst_DepartureYear",2402 "days;1;No", "Booking_Page", "");2403 selectDPDNValue("dpdn_Commodity_BP", "txtbx_Commodity_BP", commValue, "", "Booking_Page", "Commodity");2404 selectDPDNValue("dpdn_Container_BP", "txtbx_Container_BP", conTypeValue, "", "Booking_Page",2405 "ContainerType");2406 input("txtbx_Weight_BP", weight, "Booking_Page", "Enter weight");2407 clickElement("Maersk_SSP_chk_iamPriceOwner", "", "Booking_Page", "Click on iam price owner check box");2408 selectOptionUsingPartialText("Maersk_SSP_lst_PriceOwner", "Gcss Booked By, Copenhagen", pageName, StepName);2409 // clickElement("chkbx_tariff", "", "Booking_Page", "Select Tariff");2410 testRunner.testStepResult = true;2411 } catch (Exception ex) {2412 log_testActions.info(" napBooking Failure. Exception = " + ex.getMessage());2413 testRunner.testStepResult = false;2414 }2415 }2416 /*2417 * *****************************************************************************2418 * ***************** Method: reeferStarfreshSingleCargoBooking Author: Ashok2419 * Description: Creating reeferStarfreshSingleCargoBooking2420 * *****************************************************************************2421 * ****************2422 */2423 public static void reeferStarfreshSingleCargoBooking(String object, String data, String pageName, String StepName)2424 throws Exception {2425 try {2426 String[] testData = data.split(";");2427 int length = testData.length;2428 log_testActions.info("Before reefer Star fresh Single Cargo Booking ");2429 String fromValue1 = testData[0];2430 String fromValue2 = testData[1];2431 String toValue1 = testData[2];2432 String toValue2 = testData[3];2433 String conType = testData[4];2434 String commValue = testData[5];2435 String contCount = testData[6];2436 String conTypeValue = testData[7];2437 String weight = testData[8];2438 String contractTariff = testData[9];2439 // String contactPerson = testData[10];2440 String reference = testData[10];2441 String exportType = testData[11];2442 String importType = testData[12];2443 String reeferConType = testData[13];2444 String reeferTemp = testData[14];2445 String additionalRefType = testData[15];2446 String additionalRefValue = testData[16];2447 log_testActions.info("After getting input values");2448 /*2449 * navigateToUrl("", "https://myt.apmoller.net/booking/new", "Booking_Page",2450 * "navigated to new booking page");2451 */2452 /*2453 * navigateMenu(2454 * "Maersk_SSP_Menu_BOOK;Maersk_SSP_subMenu_NewBookShipment","BOOK~New BookShipment"2455 * ,"Booking_Page","Nvaigate to new Booking page");2456 * log_testActions.info("After Booking page");2457 */2458 if (testRunner.testName.contains("_MML_")) {2459 IGNnavigateMenu("Maersk_SSP_IGN_btn_Book;Maersk_SSP_IGN_lnk_BookNewShipment", "BOOK~New BookShipment",2460 "Booking_Page", "Nvaigate to new Booking page");2461 } else {2462 /*2463 * navigateToUrl("", "https://myt.apmoller.net/shipmentbinder/", "Booking_Page",2464 * "navigated to new booking page");2465 */2466 navigateMenu("Maersk_SSP_Menu_BOOK;Maersk_SSP_subMenu_NewBookShipment", "BOOK~New BookShipment",2467 "Booking_Page", "Nvaigate to new Booking page");2468 }2469 waitForVisible("txt_BookingPage1");2470 if (exportType.equals("SD") && importType.equals("CY")) {2471 javaClick("radio_Export_SD", "", "Booking_page1", "Select export SD radio button");2472 javaClick("radio_Import_CY", "", "Booking_page1", "Select export SD radio button");2473 }2474 compareValue("txt_BookingPage1", "Booked By", "Booking_Page", "Verify Booking Page");2475 selectDPDNValue("dpdn_From_BP", "txtbx_From_BP", fromValue1, fromValue2, "Booking_Page", "From");2476 selectDPDNValue("dpdn_To_BP", "txtbx_To_BP", toValue1, toValue2, "Booking_Page", "To");2477 clickElement("chk_cargoTepControl", "", "Booking_Page", "Select Cargo Requires Temperature control");2478 selectDPDNValue("dpdn_Commodity_BP", "txtbx_Commodity_BP", commValue, "", "Booking_Page", "Commodity");2479 selectDPDNValue("dpdn_Container_BP", "txtbx_Container_BP", conTypeValue, "", "Booking_Page",2480 "ContainerType");2481 input("txtbx_Weight_BP", weight, "Booking_Page", "Enter weight");2482 clickElement("Maersk_SSP_chk_iamPriceOwner", "", "Booking_Page", "Click on iam price owner check box");2483 // clickElement("chkbx_tariff", "", "Booking_Page", "Select Tariff");2484 selectOptionUsingPartialText("Maersk_SSP_lst_PriceOwner", "Gcss Booked By, Copenhagen", pageName, StepName);2485 clickElement("btn_Continue_Book", "", "Booking_Page", "Click Continue");2486 waitForVisible("txt_BookingPage2");2487 compareValue("txt_BookingPage2", "Configure your booking details below", "Booking_Page2",2488 "Verify Booking Page2");2489 input("txtbx_BookedbyReference", reference, "Booking_Page2", "Enter Booked by Reference");2490 if (exportType.equals("SD") && importType.equals("CY")) {2491 // Added new Steps by Ashok2492 selectOption("Maersk_SSP_lst_LoadAddressSDCY", "Kuehne + Nagel (ag & Co) Kg, Cologne",2493 "Select Load address", "Booking Page2");2494 input("txtbx_Cont1LoadFromDate", "currDate", "Enter Laoding from date", "Booking Page2");2495 input("txtbx_Cont1LoadFromTime", "1000", "Enter Laoding from Time", "Booking Page2");2496 input("txtbx_Cont1LoadToDate", "currDate", "Enter Laoding from date", "Booking Page2");2497 input("txtbx_Cont1LoadToTime", "2300", "Enter Laoding to Time", "Booking Page2");2498 input("txtbx_Cont1LoadRef", "1", "Enter Refrence number", "Booking Page2");2499 }2500 clickElement("link_showAdvancedConfigurations", "", "Booking_Page2",2501 "Clicking Show Advanced configuration");2502 clickElement("radio_starfresh", "", "Booking_Page2", "Select Star refresh");2503 log_testActions.info("Select Starfresh passed");2504 input("txtbx_Temerature", reeferTemp, "Booking_Page2", "Enter Temperature");2505 log_testActions.info("Enter Temperature Passed");2506 selectOption("select_AdditionalReference", additionalRefType, "Booking_Page2",2507 "Select Additional Reference");2508 selectOption("select_YesNo", additionalRefValue, "Booking_Page2", "Select Yes Or No");2509 clickElement("btn_BookShipment", "", "Booking_Page2", "Click Book Shipment");2510 JavascriptExecutor jse = (JavascriptExecutor) driver;2511 jse.executeScript("window.scrollBy(0,-250)", "");2512 Thread.sleep(1000);2513 javaClick("btn_PlaceBooking", "", "Booking_Page2", "Click Place Booking");2514 compareValue("txt_BookingSuccessMessage", "Your booking has number", "Booking_Page",2515 "Verify Booking Page2");2516 String bookinNumber = driver.findElement(By.xpath("//*[contains(text(),'Your booking has number')]"))2517 .getText();2518 constants.Booking_Number = bookinNumber.replaceAll("\\D", "");2519 System.out.println(constants.Booking_Number);2520 log_testActions.info(" Shipment Booking Number = " + constants.Booking_Number);2521 testRunner.reportLogger.log(LogStatus.PASS,2522 "B10 reeferStarfreshSingleCargo Booking number " + constants.Booking_Number,2523 constants.KEYWORD_PASS);2524 if (testRunner.testStepResult == true) {2525 log_testActions.info("reeferStarfreshSingleCargo Booking Success ");2526 } else {2527 log_testActions.info("reeferStarfreshSingleCargo Booking failed ");2528 }2529 } catch (Exception ex) {2530 log_testActions.info(" reeferStarfreshSingleCargo Booking Failure. Exception = " + ex.getMessage());2531 testRunner.testStepResult = false;2532 }2533 }2534 /*2535 * *****************************************************************************2536 * ***************** Method: OOGShipperownDGMultiCargoBooking Author: Ashok2537 * Description: Create OOGShipperownDGMultiCargoBooking booking2538 * *****************************************************************************2539 * ****************2540 */2541 public static void OOGShipperownDGMultiCargoBooking(String object, String data, String pageName, String StepName)2542 throws Exception {2543 try {2544 String[] testData = data.split(";");2545 int length = testData.length;2546 log_testActions.info("Before OOG Shipper own DG Multi Cargo Booking ");2547 String fromValue1 = testData[0];2548 String fromValue2 = testData[1];2549 String toValue1 = testData[2];2550 String toValue2 = testData[3];2551 String conType = testData[4];2552 String commValue = testData[5];2553 String contCount = testData[6];2554 String conTypeValue = testData[7];2555 String weight = testData[8];2556 String commValue2 = testData[9];2557 String contCount2 = testData[10];2558 String conTypeValue2 = testData[11];2559 String weight2 = testData[12];2560 String contractTariff = testData[13];2561 // String contactPerson = testData[10];2562 String reference = testData[14];2563 String exportType = testData[15];2564 String importType = testData[16];2565 String[] cont1Dimention1 = testData[17].split("/");2566 String length1 = cont1Dimention1[0];2567 String width1 = cont1Dimention1[1];2568 String height1 = cont1Dimention1[2];2569 String[] cont1Dimention2 = testData[18].split("/");2570 String length2 = cont1Dimention2[0];2571 String width2 = cont1Dimention2[1];2572 String height2 = cont1Dimention2[2];2573 String CargoDetails = testData[19];2574 String additionalRefType = testData[20];2575 String additionalRefValue = testData[21];2576 log_testActions.info("After getting input values");2577 /*2578 * navigateToUrl("", "https://myt.apmoller.net/booking/new", "Booking_Page",2579 * "navigated to new booking page");2580 */2581 // navigateMenu("Maersk_SSP_Menu_BOOK;Maersk_SSP_subMenu_NewBookShipment","BOOK~New2582 // BookShipment","Booking_Page","Nvaigate to new Booking page");2583 if (testRunner.testName.contains("_MML_")) {2584 IGNnavigateMenu("Maersk_SSP_IGN_btn_Book;Maersk_SSP_IGN_lnk_BookNewShipment", "BOOK~New BookShipment",2585 "Booking_Page", "Nvaigate to new Booking page");2586 } else {2587 /*2588 * navigateToUrl("", "https://myt.apmoller.net/shipmentbinder/", "Booking_Page",2589 * "navigated to new booking page");2590 */2591 navigateMenu("Maersk_SSP_Menu_BOOK;Maersk_SSP_subMenu_NewBookShipment", "BOOK~New BookShipment",2592 "Booking_Page", "Nvaigate to new Booking page");2593 }2594 log_testActions.info("After Booking page");2595 waitForVisible("txt_BookingPage1");2596 compareValue("txt_BookingPage1", "Booked By", "Booking_Page", "Verify Booking Page");2597 selectDPDNValue("dpdn_From_BP", "txtbx_From_BP", fromValue1, fromValue2, "Booking_Page", "From");2598 selectDPDNValue("dpdn_To_BP", "txtbx_To_BP", toValue1, toValue2, "Booking_Page", "To");2599 clickElement("chk_cargoDangerous", "", "Booking_Page", "Select Cargo Dangerous");2600 // clickElement("chk_cargoOversized", "", "Booking_Page", "Select Cargo2601 // Oversized");2602 selectDPDNValue("dpdn_Commodity_BP", "txtbx_Commodity_BP", commValue, "", "Booking_Page", "Commodity");2603 selectDPDNValue("dpdn_Container_BP", "txtbx_Container_BP", conTypeValue, "", "Booking_Page",2604 "ContainerType");2605 input("txtbx_Weight_BP", weight, "Booking_Page", "Enter weight");2606 clickElement("Maersk_SSP_chk_iamPriceOwner", "", "Booking_Page", "Click on iam price owner check box");2607 // Added by Ashok2608 clickElement("Maersk_SSP_chk_Shippers1stContainer", "", "Booking_Page", "Select ShippersOwnCheckBox");2609 javaClick("lnk_AddConTypeComm", "", "Booking_Page", "click Add another Container/Commodity");2610 selectDPDNValue("dpdn_Commodity2_BP", "txtbx_Commodity2_BP", commValue2, "", "Booking_Page", "Commodity");2611 selectDPDNValue("dpdn_Container2_BP", "txtbx_Container2_BP", conTypeValue2, "", "Booking_Page",2612 "ContainerType");2613 input("txtbx_Weight2_BP", weight2, "Booking_Page", "Enter weight2");2614 // Added by Ashok2615 clickElement("Maersk_SSP_chk_ShippersOwn2ndContainer", "", "Booking_Page", "Select ShippersOwnCheckBox");2616 // selectCheckbox("chkbx_tariff", "", "Booking_Page", "Select2617 // Tariff");2618 // input("txtbx_contract_BP", contractTariff, "Booking_Page", "Enter Contract2619 // number");2620 selectOptionUsingPartialText("Maersk_SSP_lst_PriceOwner", "Gcss Booked By, Copenhagen", pageName, StepName);2621 clickElement("btn_Continue_Book", "", "Booking_Page", "Click Continue");2622 waitForVisible("txt_BookingPage2");2623 compareValue("txt_BookingPage2", "Configure your booking details below", "Booking_Page2",2624 "Verify Booking Page2");2625 input("txtbx_BookedbyReference", reference, "Booking_Page2", "Enter Booked by Reference");2626 input("txtbx_contract_BP", contractTariff, "Booking_Page", "Enter Contract number");2627 javaClick("lnk_EditContainerDetails", "", "Booking_Page2", "Click Edit container Details");2628 comparePageText("", "Shipper~Yes", "", "");2629 clickElement("btn_CancelEditContainerDetails", "", "Booking_Page2", "Click Edit container Details");2630 // UnCheck("chk_container2Details", "", "Booking_Page2", "Selecting container22631 // details checkbox");2632 javaClick("lnk_AddOversizedcargoDetails1", "", "Booking_Page2", "clicking Add Oversized Details link ");2633 // Added by Ashok2634 input("Maersk_SSP_txtbx_QuoteReference", "abcd", "Booking_Page2", "Enter length of container1");2635 input("Maersk_SSP_txtbx_Container1Length", length1, "Booking_Page2", "Enter length of container1");2636 input("Maersk_SSP_txtbx_Container1Width", width1, "Booking_Page2", "Enter width of container1");2637 input("Maersk_SSP_txtbx_Container1Hight", height1, "Booking_Page2", "Enter height of container1");2638 input("Maersk_SSP_txtbx_Container1Wieght", "1000", "Booking_Page2", "Enter height of container1");2639 javaClick("Maersk_SSP_lnk_AddOversizedDetailsApply", "", "Booking_Page2", "Click Update for container1");2640 // clickElement("chk_container2Details", "", "Booking_Page2", "Selecting2641 // container2 details checkbox");2642 // UnCheck("chk_container1Details", "", "Booking_Page2", "Unselecting container12643 // details checkbox");2644 clickElement("lnk_AddOversizedcargoDetails2", "", "Booking_Page2", "clicking Add Oversized Details link ");2645 input("Maersk_SSP_txtbx_QuoteReference", "abcd", "Booking_Page2", "Enter length of container1");2646 input("Maersk_SSP_txtbx_Container1Length", length1, "Booking_Page2", "Enter length of container1");2647 input("Maersk_SSP_txtbx_Container1Width", width1, "Booking_Page2", "Enter width of container1");2648 input("Maersk_SSP_txtbx_Container1Hight", height1, "Booking_Page2", "Enter height of container1");2649 input("Maersk_SSP_txtbx_Container1Wieght", "1000", "Booking_Page2", "Enter height of container1");2650 clickElement("Maersk_SSP_lnk_AddOversizedDetailsApply", "", "Booking_Page2", "Click Update for container2");2651 // clickElement("chk_container1Details", "", "Booking_Page2", "selecting2652 // container1 details checkbox");2653 input("txtbx_DangerousCargoDetails", CargoDetails, "Booking_Page2", "Enter Dangerous cargo details");2654 selectOption("select_AdditionalReference", "OOG-BB Quote Reference Number", "Booking_Page2",2655 "Select OOG-BB Quote Reference Number");2656 input("txtbx_OOG-BBQuoteRefNum", "Yes", "Booking_Page2", "Enter Yes value");2657 clickElement("btn_BookShipment", "", "Booking_Page2", "Click Book Shipment");2658 javaClick("btn_PlaceBooking", "", "Booking_Page2", "Click Place Booking");2659 compareValue("txt_BookingSuccessMessage", "Your booking has number", "Booking_Page",2660 "Verify Booking Page2");2661 String bookinNumber = driver.findElement(By.xpath("//*[contains(text(),'Your booking has number')]"))2662 .getText();2663 constants.Booking_Number = bookinNumber.replaceAll("\\D", "");2664 System.out.println(constants.Booking_Number);2665 log_testActions.info(" Shipment Booking Number = " + constants.Booking_Number);2666 testRunner.reportLogger.log(LogStatus.PASS,2667 "B2 OOGShipperownDGMultiCargoBooking number " + constants.Booking_Number, constants.KEYWORD_PASS);2668 if (testRunner.testStepResult == true) {2669 log_testActions.info("OOGShipperownDGMultiCargoBooking Booking Success ");2670 } else {2671 log_testActions.info("OOGShipperownDGMultiCargoBooking Booking failed ");2672 }2673 } catch (Exception ex) {2674 log_testActions.info(" OOGShipperownDGMultiCargo Booking Failure. Exception = " + ex.getMessage());2675 testRunner.testStepResult = false;2676 }2677 }2678 /*2679 * *****************************************************************************2680 * ***************** Method: DGReeferStandardMultiCargoBooking Author: Ashok2681 * Description: Create DGReeferStandardMultiCargoBooking booking2682 * *****************************************************************************2683 * ****************2684 */2685 public static void DGReeferStandardMultiCargoBooking(String object, String data, String pageName, String StepName)2686 throws Exception {2687 try {2688 String[] testData = data.split(";");2689 log_testActions.info("Before DG Reefer Standard MultiCargo Booking ");2690 String fromValue1 = testData[0];2691 String fromValue2 = testData[1];2692 String toValue1 = testData[2];2693 String toValue2 = testData[3];2694 String conType = testData[4];2695 String commValue = testData[5];2696 String contCount = testData[6];2697 String conTypeValue = testData[7];2698 String weight = testData[8];2699 String commValue2 = testData[9];2700 String contCount2 = testData[10];2701 String conTypeValue2 = testData[11];2702 String weight2 = testData[12];2703 String contractTariff = testData[13];2704 // String contactPerson = testData[10];2705 String reference = testData[14];2706 String exportType = testData[15];2707 String importType = testData[16];2708 String reeferConType = testData[17];2709 String haulage_Instructions = testData[18];2710 String loadAddress = testData[19];2711 SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");2712 Date todayDate = Calendar.getInstance().getTime();2713 String todayDateString = formatter.format(todayDate);2714 String[] cont1LoadDetails = testData[20].split("/");2715 String cont1LoadFromDate = cont1LoadDetails[0].equals("today") ? todayDateString : cont1LoadDetails[0];2716 String cont1LoadFromTime = cont1LoadDetails[1];2717 String cont1LoadToDate = cont1LoadDetails[2].equals("today") ? todayDateString : cont1LoadDetails[2];2718 String cont1LoadToTime = cont1LoadDetails[3];2719 String cont1LoadRef = cont1LoadDetails[4];2720 String[] cont2LoadDetails = testData[21].split("/");2721 String cont2LoadFromDate = cont2LoadDetails[0].equals("today") ? todayDateString : cont2LoadDetails[0];2722 String cont2LoadFromTime = cont2LoadDetails[1];2723 String cont2LoadToDate = cont2LoadDetails[2].equals("today") ? todayDateString : cont2LoadDetails[2];2724 String cont2LoadToTime = cont2LoadDetails[3];2725 String cont2LoadRef = cont2LoadDetails[4];2726 String CargoDetails = testData[22];2727 String reeferTemp = testData[23];2728 String additionalRefType = testData[24];2729 String additionalRefValue = testData[25];2730 log_testActions.info("After getting input values");2731 /*2732 * navigateToUrl("", "https://myt.apmoller.net/booking/new", "Booking_Page",2733 * "navigated to new booking page");2734 */2735 // navigateMenu("Maersk_SSP_Menu_BOOK;Maersk_SSP_subMenu_NewBookShipment","BOOK~New2736 // BookShipment","Booking_Page","Nvaigate to new Booking page");2737 if (testRunner.testName.contains("_MML_")) {2738 IGNnavigateMenu("Maersk_SSP_IGN_btn_Book;Maersk_SSP_IGN_lnk_BookNewShipment", "BOOK~New BookShipment",2739 "Booking_Page", "Nvaigate to new Booking page");2740 } else {2741 /*2742 * navigateToUrl("", "https://myt.apmoller.net/shipmentbinder/", "Booking_Page",2743 * "navigated to new booking page");2744 */2745 navigateMenu("Maersk_SSP_Menu_BOOK;Maersk_SSP_subMenu_NewBookShipment", "BOOK~New BookShipment",2746 "Booking_Page", "Nvaigate to new Booking page");2747 }2748 log_testActions.info("After Booking page");2749 waitForVisible("txt_BookingPage1");2750 compareValue("txt_BookingPage1", "Booked By", "Booking_Page", "Verify Booking Page");2751 selectDPDNValue("dpdn_From_BP", "txtbx_From_BP", fromValue1, fromValue2, "Booking_Page", "From");2752 selectDPDNValue("dpdn_To_BP", "txtbx_To_BP", toValue1, toValue2, "Booking_Page", "To");2753 javaClick("radio_Export_SD", "", "Booking_Page2", "Select Export SD mode");2754 clickElement("chk_cargoTepControl", "", "Booking_Page", "Select Cargo Requires Temperature control");2755 clickElement("chk_cargoDangerous", "", "Booking_Page", "Select Dangerous control");2756 selectDPDNValue("dpdn_Commodity_BP", "txtbx_Commodity_BP", commValue, "", "Booking_Page", "Commodity");2757 selectDPDNValue("dpdn_Container_BP", "txtbx_Container_BP", conTypeValue, "", "Booking_Page",2758 "ContainerType");2759 input("txtbx_Weight_BP", weight, "Booking_Page", "Enter weight");2760 clickElement("Maersk_SSP_chk_iamPriceOwner", "", "Booking_Page", "Click on iam price owner check box");2761 javaClick("lnk_AddConTypeComm", "", "Booking_Page", "click Add another Container/Commodity");2762 selectDPDNValue("dpdn_Commodity2_BP", "txtbx_Commodity2_BP", commValue2, "", "Booking_Page", "Commodity");2763 selectDPDNValue("dpdn_Container2_BP", "txtbx_Container2_BP", conTypeValue2, "", "Booking_Page",2764 "ContainerType");2765 input("txtbx_Weight2_BP", weight2, "Booking_Page", "Enter weight2");2766 // javaClick("chkbx_tariff", "", "Booking_Page", "Select Tariff");2767 selectOptionUsingPartialText("Maersk_SSP_lst_PriceOwner", "Gcss Booked By, Copenhagen", pageName, StepName);2768 clickElement("btn_Continue_Book", "", "Booking_Page", "Click Continue");2769 waitForVisible("txt_BookingPage2");2770 compareValue("txt_BookingPage2", "Configure your booking details below", "Booking_Page2",2771 "Verify Booking Page2");2772 input("txtbx_BookedbyReference", reference, "Booking_Page2", "Enter Booked by Reference");2773 javaClick("Maersk_SSP_lnk_addHaulage1", "", "Booking_Page", "Click Add haulage container1");2774 selectOption("select_LoadAddress", "Glock Gesmbh, Deutsch Wagram", "Booking_Page2", "Select Load Address");2775 input("txtbx_HaulageInstructions", haulage_Instructions, "Booking_Page2", "Enter Booked by Reference");2776 input("txtbx_Cont1LoadFromDate", cont1LoadFromDate, "Booking_Page2", "Enter Container1 Load From Date");2777 input("txtbx_Cont1LoadFromTime", cont1LoadFromTime, "Booking_Page2", "Enter Container1 Load From Time");2778 input("txtbx_Cont1LoadToDate", cont1LoadToDate, "Booking_Page2", "Enter Container1 Load To Date");2779 input("txtbx_Cont1LoadToTime", cont1LoadToTime, "Booking_Page2", "Enter Container1 Load To Time");2780 input("txtbx_Cont1LoadRef", cont1LoadRef, "Booking_Page2", "Enter Container1 Load To Time");2781 javaClick("Maersk_SSP_lnk_addHaulage2", "", "Booking_Page", "Click Add haulage container2");2782 selectOption("Maersk_SSP_lst_LoadAddressCnt2", "Glock Gesmbh, Deutsch Wagram", "Booking_Page2",2783 "Select Load Address");2784 input("Maersk_SSP_txtbx_HaulageInstructionsCnt2", haulage_Instructions, "Booking_Page2",2785 "Enter Booked by Reference");2786 clearTextBox("txtbx_Cont2LoadFromDate", cont2LoadFromDate, "Booking_Page2",2787 "Clear Container2 Load From Date");2788 clearTextBox("txtbx_Cont2LoadFromTime", cont2LoadFromTime, "Booking_Page2",2789 "Clear Container2 Load From Time");2790 clearTextBox("txtbx_Cont2LoadToDate", cont2LoadToDate, "Booking_Page2", "Clear Container2 Load To Date");2791 clearTextBox("txtbx_Cont2LoadToTime", cont2LoadToTime, "Booking_Page2", "Clear Container2 Load To Date");2792 clearTextBox("txtbx_Cont1LoadRef", cont2LoadRef, "Booking_Page2", "Enter Container1 Load To Time");2793 input("txtbx_Cont2LoadFromDate", cont2LoadFromDate, "Booking_Page2", "Enter Container2 Load From Date");2794 input("txtbx_Cont2LoadFromTime", cont2LoadFromTime, "Booking_Page2", "Enter Container2 Load From Time");2795 input("txtbx_Cont2LoadToDate", cont2LoadToDate, "Booking_Page2", "Enter Container2 Load To Date");2796 input("txtbx_Cont2LoadToTime", cont2LoadToTime, "Booking_Page2", "Enter Container2 Load To Time");2797 input("txtbx_Cont2LoadRef", cont2LoadRef, "Booking_Page2", "Enter Container2 Load To Time");2798 input("txtbx_DangerousCargoDetails", CargoDetails, "Booking_Page2", "Enter Temperature");2799 input("txtbx_Temerature", reeferTemp, "Booking_Page2", "Enter Temperature");2800 selectOption("select_AdditionalReference", additionalRefType, "Booking_Page2",2801 "Select Additional Reference");2802 input("txtbx_OOG-BBQuoteRefNum", additionalRefValue, "Booking_Page2", "Enter Yes");2803 javaClick("btn_BookShipment", "", "Booking_Page2", "Click Book Shipment");2804 javaClick("btn_PlaceBooking", "", "Booking_Page2", "Click Place Booking");2805 compareValue("txt_BookingSuccessMessage", "Your booking has number", "Booking_Page",2806 "Verify Booking Page2");2807 if (testRunner.testStepResult == true) {2808 log_testActions.info("B5 DGReeferStandardMultiCargoBooking Booking Success ");2809 String bookinNumber = driver.findElement(By.xpath("//*[contains(text(),'Your booking has number')]"))2810 .getText();2811 constants.Booking_Number = bookinNumber.replaceAll("\\D", "");2812 System.out.println(constants.Booking_Number);2813 testRunner.reportLogger.log(LogStatus.PASS,2814 "B6 DGReeferStandardMultiCargoBooking number " + constants.Booking_Number,2815 constants.KEYWORD_PASS);2816 log_testActions.info(" Shipment Booking Number = " + constants.Booking_Number);2817 } else {2818 log_testActions.info("DGReeferStandardMultiCargoBooking Booking failed ");2819 }2820 } catch (Exception ex) {2821 log_testActions.info("DG Reefer Standard MultiCargo Booking Failure. Exception = " + ex.getMessage());2822 testRunner.testStepResult = false;2823 }2824 }2825 /*2826 * *****************************************************************************2827 * ***************** Method: serviceContractAffiliateMultiCargoBooking Author:2828 * Ashok Description: Create serviceContractAffiliateMultiCargoBooking booking2829 * *****************************************************************************2830 * ****************2831 */2832 public static void serviceContractAffiliateMultiCargoBooking(String object, String data, String pageName,2833 String StepName) throws Exception {2834 try {2835 String[] testData = data.split(";");2836 log_testActions.info("Before Reefer serviceContractAffiliate MultiCargo Booking ");2837 String fromValue1 = testData[0];2838 String fromValue2 = testData[1];2839 String toValue1 = testData[2];2840 String toValue2 = testData[3];2841 String conType = testData[4];2842 String commValue = testData[5];2843 String contCount = testData[6];2844 String conTypeValue = testData[7];2845 String weight = testData[8];2846 String commValue2 = testData[9];2847 String contCount2 = testData[10];2848 String conTypeValue2 = testData[11];2849 String weight2 = testData[12];2850 String contractTariff = testData[13];2851 // String contactPerson = testData[10];2852 String reference = testData[14];2853 String exportType = testData[15];2854 String importType = testData[16];2855 // String reeferConType = testData[17];2856 String reeferTemp = testData[17];2857 String priceOwner = testData[18];2858 log_testActions.info("After getting input values");2859 /*2860 * navigateToUrl("", "https://myt.apmoller.net/booking/new", "Booking_Page",2861 * "navigated to new booking page");2862 */2863 // navigateMenu("Maersk_SSP_Menu_BOOK;Maersk_SSP_subMenu_NewBookShipment","BOOK~New2864 // BookShipment","Booking_Page","Nvaigate to new Booking page");2865 if (testRunner.testName.contains("_MML_")) {2866 IGNnavigateMenu("Maersk_SSP_IGN_btn_Book;Maersk_SSP_IGN_lnk_BookNewShipment", "BOOK~New BookShipment",2867 "Booking_Page", "Nvaigate to new Booking page");2868 } else {2869 /*2870 * navigateToUrl("", "https://myt.apmoller.net/shipmentbinder/", "Booking_Page",2871 * "navigated to new booking page");2872 */2873 navigateMenu("Maersk_SSP_Menu_BOOK;Maersk_SSP_subMenu_NewBookShipment", "BOOK~New BookShipment",2874 "Booking_Page", "Nvaigate to new Booking page");2875 }2876 log_testActions.info("After Booking page");2877 waitForVisible("txt_BookingPage1");2878 compareValue("txt_BookingPage1", "Booked By", "Booking_Page", "Verify Booking Page");2879 if (testRunner.testStepResult == true) {2880 selectDPDNValue("dpdn_From_BP", "txtbx_From_BP", fromValue1, fromValue2, "Booking_Page", "From");2881 if (testRunner.testStepResult == true) {2882 selectDPDNValue("dpdn_To_BP", "txtbx_To_BP", toValue1, toValue2, "Booking_Page", "To");2883 if (testRunner.testStepResult == true) {2884 if (conType.equals("Reefer/Dangerous")) {2885 clickElement("chk_cargoTepControl", "", "Booking_Page",2886 "Select Cargo Requires Temperature control");2887 clickElement("chk_cargoDangerous", "", "Booking_Page", "Select Dangerous control");2888 }2889 if (testRunner.testStepResult == true) {2890 selectDPDNValue("dpdn_Commodity_BP", "txtbx_Commodity_BP", commValue, "", "Booking_Page",2891 "Commodity");2892 if (testRunner.testStepResult == true) {2893 selectDPDNValue("dpdn_Container_BP", "txtbx_Container_BP", conTypeValue, "",2894 "Booking_Page", "ContainerType");2895 if (testRunner.testStepResult == true) {2896 input("txtbx_Weight_BP", weight, "Booking_Page", "Enter weight");2897 clickElement("Maersk_SSP_chk_iamPriceOwner", "", "Booking_Page",2898 "Click on iam price owner check box");2899 javaClick("lnk_AddConTypeComm", "", "Booking_Page",2900 "click Add another Container/Commodity");2901 if (testRunner.testStepResult == true) {2902 selectDPDNValue("dpdn_Commodity2_BP", "txtbx_Commodity2_BP", commValue2, "",2903 "Booking_Page", "Commodity");2904 selectDPDNValue("dpdn_Container2_BP", "txtbx_Container2_BP", conTypeValue2, "",2905 "Booking_Page", "ContainerType");2906 input("txtbx_Weight2_BP", weight2, "Booking_Page", "Enter weight2");2907 // javaClick("chkbx_tariff", "", "Booking_Page", "Select Tariff");2908 selectOptionUsingPartialText("Maersk_SSP_lst_PriceOwner", priceOwner, pageName,2909 StepName);2910 if (testRunner.testStepResult == true) {2911 clickElement("btn_Continue_Book", "", "Booking_Page", "Click Continue");2912 if (testRunner.testStepResult == true) {2913 waitForVisible("txt_BookingPage2");2914 compareValue("txt_BookingPage2", "Configure your booking details below",2915 "Booking_Page2", "Verify Booking Page2");2916 if (testRunner.testStepResult == true) {2917 input("txtbx_BookedbyReference", reference, "Booking_Page2",2918 "Enter Booked by Reference");2919 if (testRunner.testStepResult == true) {2920 input("txtbx_Temerature", reeferTemp, "Booking_Page2",2921 "Enter Temperature");2922 if (testRunner.testStepResult == true) {2923 clickElement("btn_BookShipment", "", "Booking_Page2",2924 "Click Book Shipment");2925 if (testRunner.testStepResult == true) {2926 javaClick("btn_PlaceBooking", "", "Booking_Page2",2927 "Click Place Booking");2928 if (testRunner.testStepResult == true) {2929 compareValue("txt_BookingSuccessMessage",2930 "Your booking has number", "Booking_Page",2931 "Verify Booking Page2");2932 if (testRunner.testStepResult == true) {2933 log_testActions.info(2934 "ReeferServiceContractAffiliateMultiCargoBooking Booking Success ");2935 String bookinNumber = driver.findElement(By2936 .xpath("//*[contains(text(),'Your booking has number')]"))2937 .getText();2938 constants.Booking_Number = bookinNumber2939 .replaceAll("\\D", "");2940 System.out.println(constants.Booking_Number);2941 log_testActions2942 .info(" Shipment Booking Number = "2943 + constants.Booking_Number);2944 testRunner.reportLogger.log(LogStatus.PASS,2945 "B4 serviceContractAffiliateMultiCargoBooking number "2946 + constants.Booking_Number,2947 constants.KEYWORD_PASS);2948 } else {2949 log_testActions.info(2950 "ReeferServiceContractAffiliateMultiCargoBooking Booking failed ");2951 }2952 }2953 }2954 }2955 }2956 }2957 }2958 }2959 }2960 }2961 }2962 }2963 }2964 }2965 }2966 } catch (Exception ex) {2967 log_testActions2968 .info("Reefer serviceContractAffiliate MultiCargo Booking Failure. Exception = " + ex.getMessage());2969 testRunner.testStepResult = false;2970 }2971 }2972 /*2973 * *****************************************************************************2974 * ***************** Method: reeferMagnumShippersOwnSingleCargoBooking Author:2975 * Ashok Description: Create reeferMagnumShippersOwnSingleCargoBooking booking2976 * *****************************************************************************2977 * ****************2978 */2979 public static void reeferMagnumShippersOwnSingleCargoBooking(String object, String data, String pageName,2980 String StepName) throws Exception {2981 try {2982 String[] testData = data.split(";");2983 log_testActions.info("Before reefer Magnum Shippers Own Single Cargo Booking ");2984 String fromValue1 = testData[0];2985 String fromValue2 = testData[1];2986 String toValue1 = testData[2];2987 String toValue2 = testData[3];2988 String conType = testData[4];2989 String commValue = testData[5];2990 String contCount = testData[6];2991 String conTypeValue = testData[7];2992 String weight = testData[8];2993 String contractTariff = testData[9];2994 // String contactPerson = testData[10];2995 String reference = testData[10];2996 String exportType = testData[11];2997 String importType = testData[12];2998 String reeferConType = testData[13];2999 String reeferTemp = testData[14];3000 String additionalRefType = testData[15];3001 String additionalRefValue = testData[16];3002 log_testActions.info("After getting input values");3003 if (testRunner.testName.contains("_MML_")) {3004 // goToUrl("", "https://myt.apmoller.net/booking/new", "Booking_Page",3005 // "navigated to new booking page");3006 IGNnavigateMenu("Maersk_SSP_IGN_btn_Book;Maersk_SSP_IGN_lnk_BookNewShipment", "BOOK~New BookShipment",3007 "Booking_Page", "Nvaigate to new Booking page");3008 } else {3009 /*3010 * navigateToUrl("", "https://myt.apmoller.net/shipmentbinder/", "Booking_Page",3011 * "navigated to new booking page");3012 */3013 navigateMenu("Maersk_SSP_Menu_BOOK;Maersk_SSP_subMenu_NewBookShipment", "BOOK~New BookShipment",3014 "Booking_Page", "Nvaigate to new Booking page");3015 }3016 log_testActions.info("After Booking page");3017 waitForVisible("txt_BookingPage1");3018 compareValue("txt_BookingPage1", "Booked By", "Booking_Page", "Verify Booking Page");3019 selectDPDNValue("dpdn_From_BP", "txtbx_From_BP", fromValue1, fromValue2, "Booking_Page", "From");3020 selectDPDNValue("dpdn_To_BP", "txtbx_To_BP", toValue1, toValue2, "Booking_Page", "To");3021 clickElement("chk_cargoTepControl", "", "Booking_Page", "Select Cargo Requires Temperature control");3022 selectDPDNValue("dpdn_Commodity_BP", "txtbx_Commodity_BP", commValue, "", "Booking_Page", "Commodity");3023 selectDPDNValue("dpdn_Container_BP", "txtbx_Container_BP", conTypeValue, "", "Booking_Page",3024 "ContainerType");3025 input("txtbx_Weight_BP", weight, "Booking_Page", "Enter weight");3026 clickElement("Maersk_SSP_chk_iamPriceOwner", "", "Booking_Page", "Click on iam price owner check box");3027 // clickElement("chkbx_tariff", "", "Booking_Page", "Select Tariff");3028 selectOptionUsingPartialText("Maersk_SSP_lst_PriceOwner", "Gcss Booked By, Copenhagen", pageName, StepName);3029 clickElement("btn_Continue_Book", "", "Booking_Page", "Click Continue");3030 waitForVisible("txt_BookingPage2");3031 compareValue("txt_BookingPage2", "Configure your booking details below", "Booking_Page2",3032 "Verify Booking Page2");3033 input("txtbx_BookedbyReference", reference, "Booking_Page2", "Enter Booked by Reference");3034 clickElement("link_showAdvancedConfigurations", "", "Booking_Page2",3035 "Clicking Show Advanced configuration");3036 clickElement("radio_magnum", "", "Booking_Page2", "Select Magnum");3037 log_testActions.info("Select Starfresh passed");3038 input("txtbx_Temerature", reeferTemp, "Booking_Page2", "Enter Temperature");3039 selectOption("select_AdditionalReference", additionalRefType, "Booking_Page2",3040 "Select Additional Reference");3041 selectOption("select_YesNo", additionalRefValue, "Booking_Page2", "Select Yes Or No");3042 clickElement("btn_BookShipment", "", "Booking_Page2", "Click Book Shipment");3043 javaClick("btn_PlaceBooking", "", "Booking_Page2", "Click Place Booking");3044 compareValue("txt_BookingSuccessMessage", "Your booking has number", "Booking_Page",3045 "Verify Booking Page2");3046 String bookinNumber = driver.findElement(By.xpath("//*[contains(text(),'Your booking has number')]"))3047 .getText();3048 constants.Booking_Number = bookinNumber.replaceAll("\\D", "");3049 System.out.println(constants.Booking_Number);3050 testRunner.reportLogger.log(LogStatus.PASS,3051 "B7 reeferMagnumShippersOwnSingleCargoBooking " + constants.Booking_Number, constants.KEYWORD_PASS);3052 log_testActions.info(" Shipment Booking Number = " + constants.Booking_Number);3053 log_testActions.info("reeferMagnumShippersOwnSingleCargo Booking Success ");3054 } catch (Exception ex) {3055 log_testActions.info(" reeferMagnumShippersOwnSingleCargo Booking Failure. Exception = " + ex.getMessage());3056 testRunner.testStepResult = false;3057 }3058 }3059 /*3060 * *****************************************************************************3061 * ***************** Method: ReeferStarCareMultiCargoBooking Author: Ashok3062 * Description: Create ReeferStarCareMultiCargoBooking booking3063 * *****************************************************************************3064 * ****************3065 */3066 public static void ReeferStarCareMultiCargoBooking(String object, String data, String pageName, String StepName)3067 throws Exception {3068 try {3069 String[] testData = data.split(";");3070 log_testActions.info("Before Reefer StarCare MultiCargo Booking ");3071 String fromValue1 = testData[0];3072 String fromValue2 = testData[1];3073 String toValue1 = testData[2];3074 String toValue2 = testData[3];3075 String conType = testData[4];3076 String commValue = testData[5];3077 String contCount = testData[6];3078 String conTypeValue = testData[7];3079 String weight = testData[8];3080 String commValue2 = testData[9];3081 String contCount2 = testData[10];3082 String conTypeValue2 = testData[11];3083 String weight2 = testData[12];3084 String contractTariff = testData[13];3085 // String contactPerson = testData[10];3086 String reference = testData[14];3087 String exportType = testData[15];3088 String importType = testData[16];3089 String reeferConType = testData[17];3090 String reeferTemp = testData[18];3091 String additionalRefType = testData[19];3092 String additionalRefValue = testData[20];3093 log_testActions.info("After getting input values");3094 /*3095 * navigateToUrl("", "https://myt.apmoller.net/booking/new", "Booking_Page",3096 * "navigated to new booking page");3097 */3098 // navigateMenu("Maersk_SSP_Menu_BOOK;Maersk_SSP_subMenu_NewBookShipment","BOOK~New3099 // BookShipment","Booking_Page","Nvaigate to new Booking page");3100 if (testRunner.testName.contains("_MML_")) {3101 IGNnavigateMenu("Maersk_SSP_IGN_btn_Book;Maersk_SSP_IGN_lnk_BookNewShipment", "BOOK~New BookShipment",3102 "Booking_Page", "Nvaigate to new Booking page");3103 } else {3104 /*3105 * navigateToUrl("", "https://myt.apmoller.net/shipmentbinder/", "Booking_Page",3106 * "navigated to new booking page");3107 */3108 navigateMenu("Maersk_SSP_Menu_BOOK;Maersk_SSP_subMenu_NewBookShipment", "BOOK~New BookShipment",3109 "Booking_Page", "Nvaigate to new Booking page");3110 }3111 log_testActions.info("After Booking page");3112 waitForVisible("txt_BookingPage1");3113 compareValue("txt_BookingPage1", "Booked By", "Booking_Page", "Verify Booking Page");3114 selectDPDNValue("dpdn_From_BP", "txtbx_From_BP", fromValue1, fromValue2, "Booking_Page", "From");3115 selectDPDNValue("dpdn_To_BP", "txtbx_To_BP", toValue1, toValue2, "Booking_Page", "To");3116 selectDPDNValue("dpdn_Commodity_BP", "txtbx_Commodity_BP", commValue, "", "Booking_Page", "Commodity");3117 selectDPDNValue("dpdn_Container_BP", "txtbx_Container_BP", conTypeValue, "", "Booking_Page",3118 "ContainerType");3119 input("txtbx_Weight_BP", weight, "Booking_Page", "Enter weight");3120 selectRateLookUpRateCaluculationDate(3121 "Maersk_SSP_txtbx_DepartureDate;Maersk_SSP_lst_DepartureMonth;Maersk_SSP_lst_DepartureYear",3122 "days;1;No", "Booking_Page", "");3123 Thread.sleep(2000);3124 // clickElement("Maersk_SSP_chk_iamPriceOwner", "", "Booking_Page", "Click on3125 // iam price owner check box");3126 javaClick("lnk_AddConTypeComm", "", "Booking_Page", "click Add another Container/Commodity");3127 selectDPDNValue("dpdn_Commodity2_BP", "txtbx_Commodity2_BP", commValue2, "", "Booking_Page", "Commodity");3128 selectDPDNValue("dpdn_Container2_BP", "txtbx_Container2_BP", conTypeValue2, "", "Booking_Page",3129 "ContainerType");3130 input("txtbx_Weight2_BP", weight2, "Booking_Page", "Enter weight2");3131 // javaClick("chkbx_tariff", "", "Booking_Page", "Select Tariff");3132 selectOptionUsingPartialText("Maersk_SSP_lst_PriceOwner", "Gcss Booked By, Copenhagen", pageName, StepName);3133 clickElement("chk_cargoTepControl", "", "Booking_Page", "Select Cargo Requires Temperature control");3134 clickElement("btn_Continue_Book", "", "Booking_Page", "Click Continue");3135 waitForVisible("txt_BookingPage2");3136 compareValue("txt_BookingPage2", "Configure your booking details below", "Booking_Page2",3137 "Verify Booking Page2");3138 input("txtbx_BookedbyReference", reference, "Booking_Page2", "Enter Booked by Reference");3139 clickElement("link_showAdvancedConfigurations", "", "Booking_Page2",3140 "Clicking Show Advanced configuration");3141 clickElement("radio_starcare", "", "Booking_Page2", "Select Starcare");3142 input("txtbx_Temerature", reeferTemp, "Booking_Page2", "Enter Temperature");3143 selectOption("select_AdditionalReference", additionalRefType, "Booking_Page2",3144 "Select Additional Reference");3145 selectOption("select_YesNo", additionalRefValue, "Booking_Page2", "Select Additional Reference value");3146 clickElement("btn_BookShipment", "", "Booking_Page2", "Click Book Shipment");3147 javaClick("btn_PlaceBooking", "", "Booking_Page2", "Click Place Booking");3148 compareValue("txt_BookingSuccessMessage", "Your booking has number", "Booking_Page",3149 "Verify Booking Page2");3150 String bookinNumber = driver.findElement(By.xpath("//*[contains(text(),'Your booking has number')]"))3151 .getText();3152 constants.Booking_Number = bookinNumber.replaceAll("\\D", "");3153 System.out.println(constants.Booking_Number);3154 log_testActions.info(" Shipment Booking Number = " + constants.Booking_Number);3155 testRunner.reportLogger.log(LogStatus.PASS,3156 "B9 ReeferStarCareMultiCargoBooking number " + constants.Booking_Number, constants.KEYWORD_PASS);3157 log_testActions.info("ReeferStarcareMultiCargoBooking Booking Success ");3158 }3159 catch (Exception ex) {3160 log_testActions.info("Reefer StarCare MultiCargo Booking Failure. Exception = " + ex.getMessage());3161 testRunner.testStepResult = false;3162 }3163 }3164 /*3165 * *****************************************************************************3166 * ***************** Method: DGReeferSuperFreezerSingleCargoBooking Author:3167 * Ashok Description: Create DGReeferSuperFreezerSingleCargoBooking booking3168 * *****************************************************************************3169 * ****************3170 */3171 public static void DGReeferSuperFreezerSingleCargoBooking(String object, String data, String pageName,3172 String StepName) throws Exception {3173 try {3174 String[] testData = data.split(";");3175 log_testActions.info("Before DG Reefer SuperFreezer Single Cargo Booking ");3176 String fromValue1 = testData[0];3177 String fromValue2 = testData[1];3178 String toValue1 = testData[2];3179 String toValue2 = testData[3];3180 String conType = testData[4];3181 String commValue = testData[5];3182 String contCount = testData[6];3183 String conTypeValue = testData[7];3184 String weight = testData[8];3185 String contractTariff = testData[9];3186 // String contactPerson = testData[10];3187 String reference = testData[10];3188 String exportType = testData[11];3189 String importType = testData[12];3190 String reeferConType = testData[13];3191 String CargoDetails = testData[14];3192 String reeferTemp = testData[15];3193 String additionalRefType = testData[16];3194 String additionalRefValue = testData[17];3195 log_testActions.info("After getting input values");3196 /*3197 * navigateToUrl("", "https://myt.apmoller.net/booking/new", "Booking_Page",3198 * "navigated to new booking page"); navigateMenu(3199 * "Maersk_SSP_Menu_BOOK;Maersk_SSP_subMenu_NewBookShipment","BOOK~New BookShipment"3200 * ,"Booking_Page","Nvaigate to new Booking page");3201 * log_testActions.info("After Booking page");3202 */3203 if (testRunner.testName.contains("_MML_")) {3204 IGNnavigateMenu("Maersk_SSP_IGN_btn_Book;Maersk_SSP_IGN_lnk_BookNewShipment", "BOOK~New BookShipment",3205 "Booking_Page", "Nvaigate to new Booking page");3206 } else {3207 /*3208 * navigateToUrl("", "https://myt.apmoller.net/shipmentbinder/", "Booking_Page",3209 * "navigated to new booking page");3210 */3211 navigateMenu("Maersk_SSP_Menu_BOOK;Maersk_SSP_subMenu_NewBookShipment", "BOOK~New BookShipment",3212 "Booking_Page", "Nvaigate to new Booking page");3213 }3214 waitForVisible("txt_BookingPage1");3215 compareValue("txt_BookingPage1", "Booked By", "Booking_Page", "Verify Booking Page");3216 if (testRunner.testStepResult == true) {3217 selectDPDNValue("dpdn_From_BP", "txtbx_From_BP", fromValue1, fromValue2, "Booking_Page", "From");3218 if (testRunner.testStepResult == true) {3219 selectDPDNValue("dpdn_To_BP", "txtbx_To_BP", toValue1, toValue2, "Booking_Page", "To");3220 if (testRunner.testStepResult == true) {3221 if (conType.equals("Reefer/Dangerous")) {3222 clickElement("chk_cargoTepControl", "", "Booking_Page",3223 "Select Cargo Requires Temperature control");3224 clickElement("chk_cargoDangerous", "", "Booking_Page", "Select Dangerous control");3225 }3226 if (testRunner.testStepResult == true) {3227 selectDPDNValue("dpdn_Commodity_BP", "txtbx_Commodity_BP", commValue, "", "Booking_Page",3228 "Commodity");3229 if (testRunner.testStepResult == true) {3230 selectDPDNValue("dpdn_Container_BP", "txtbx_Container_BP", conTypeValue, "",3231 "Booking_Page", "ContainerType");3232 if (testRunner.testStepResult == true) {3233 input("txtbx_Weight_BP", weight, "Booking_Page", "Enter weight");3234 clickElement("Maersk_SSP_chk_iamPriceOwner", "", "Booking_Page",3235 "Click on iam price owner check box");3236 if (testRunner.testStepResult == true) {3237 // clickElement("chkbx_tariff", "", "Booking_Page", "Select Tariff");3238 selectOptionUsingPartialText("Maersk_SSP_lst_PriceOwner",3239 "Gcss Booked By, Copenhagen", pageName, StepName);3240 if (testRunner.testStepResult == true) {3241 clickElement("btn_Continue_Book", "", "Booking_Page", "Click Continue");3242 if (testRunner.testStepResult == true) {3243 waitForVisible("txt_BookingPage2");3244 compareValue("txt_BookingPage2", "Configure your booking details below",3245 "Booking_Page2", "Verify Booking Page2");3246 if (testRunner.testStepResult == true) {3247 input("txtbx_BookedbyReference", reference, "Booking_Page2",3248 "Enter Booked by Reference");3249 if (testRunner.testStepResult == true) {3250 input("txtbx_DangerousCargoDetails", CargoDetails,3251 "Booking_Page2", "Enter Temperature");3252 if (testRunner.testStepResult == true) {3253 clickElement("link_showAdvancedConfigurations", "",3254 "Booking_Page2",3255 "Clicking Show Advanced configuration");3256 clickElement("radio_superFreezer", "", "Booking_Page2",3257 "Select Super Freezer");3258 if (testRunner.testStepResult == true) {3259 clearTextBox("txtbx_Temerature", "", "Booking_Page2",3260 "Clear Temperatures");3261 input("txtbx_Temerature", reeferTemp, "Booking_Page2",3262 "Enter Temperature");3263 if (testRunner.testStepResult == true) {3264 selectOption("select_AdditionalReference",3265 additionalRefType, "Booking_Page2",3266 "Select Additional Reference");3267 if (testRunner.testStepResult == true) {3268 input("txtbx_OOG-BBQuoteRefNum",3269 additionalRefValue, "Booking_Page2",3270 "Enter Yes");3271 if (testRunner.testStepResult == true) {3272 clickElement("btn_BookShipment", "",3273 "Booking_Page2",3274 "Click Book Shipment");3275 if (testRunner.testStepResult == true) {3276 javaClick("btn_PlaceBooking", "",3277 "Booking_Page2",3278 "Click Place Booking");3279 if (testRunner.testStepResult == true) {3280 compareValue(3281 "txt_BookingSuccessMessage",3282 "Your booking has number",3283 "Booking_Page",3284 "Verify Booking Page2");3285 if (testRunner.testStepResult == true) {3286 log_testActions.info(3287 "DGReeferSuperFreezerSingleCargoBooking Booking Success ");3288 String bookinNumber = driver3289 .findElement(By.xpath(3290 "//*[contains(text(),'Your booking has number')]"))3291 .getText();3292 constants.Booking_Number = bookinNumber3293 .replaceAll("\\D", "");3294 System.out.println(3295 constants.Booking_Number);3296 log_testActions.info(3297 " Shipment Booking Number = "3298 + constants.Booking_Number);3299 testRunner.reportLogger.log(3300 LogStatus.PASS,3301 "B8 DGReeferSuperFreezerSingleCargoBooking number "3302 + constants.Booking_Number,3303 constants.KEYWORD_PASS);3304 } else {3305 log_testActions.info(3306 "DGReeferSuperFreezerSingleCargoBooking Booking failed ");3307 }3308 }3309 }3310 }3311 }3312 }3313 }3314 }3315 }3316 }3317 }3318 }3319 }3320 }3321 }3322 }3323 }3324 }3325 }3326 } catch (Exception ex) {3327 log_testActions.info("DG Reefer Standard MultiCargo Booking Failure. Exception = " + ex.getMessage());3328 testRunner.testStepResult = false;3329 }3330 }3331 /*3332 * *****************************************************************************3333 * ***************** Method: DGReeferSingleCargoBookingSuperFreezer Author:3334 * Ashok Description: Create DGReeferSingleCargoBookingSuperFreezer booking3335 * *****************************************************************************3336 * ****************3337 */3338 public static void DGReeferSingleCargoBookingSuperFreezer(String object, String data, String pageName,3339 String StepName) throws Exception {3340 try {3341 String[] testData = data.split(";");3342 log_testActions.info("Before DG Reefer SuperFreezer Single Cargo Booking ");3343 String fromValue1 = testData[0];3344 String fromValue2 = testData[1];3345 String toValue1 = testData[2];3346 String toValue2 = testData[3];3347 String conType = testData[4];3348 String commValue = testData[5];3349 String contCount = testData[6];3350 String conTypeValue = testData[7];3351 String weight = testData[8];3352 String contractTariff = testData[9];3353 // String contactPerson = testData[10];3354 String reference = testData[10];3355 String exportType = testData[11];3356 String importType = testData[12];3357 String reeferConType = testData[13];3358 String CargoDetails = testData[14];3359 String reeferTemp = testData[15];3360 String additionalRefType = testData[16];3361 String additionalRefValue = testData[17];3362 log_testActions.info("After getting input values");3363 /*3364 * navigateToUrl("", "https://myt.apmoller.net/booking/new", "Booking_Page",3365 * "navigated to new booking page"); navigateMenu(3366 * "Maersk_SSP_Menu_BOOK;Maersk_SSP_subMenu_NewBookShipment","BOOK~New BookShipment"3367 * ,"Booking_Page","Nvaigate to new Booking page");3368 */3369 if (testRunner.testName.contains("_MML_")) {3370 IGNnavigateMenu("Maersk_SSP_IGN_btn_Book;Maersk_SSP_IGN_lnk_BookNewShipment", "BOOK~New BookShipment",3371 "Booking_Page", "Nvaigate to new Booking page");3372 } else {3373 /*3374 * navigateToUrl("", "https://myt.apmoller.net/shipmentbinder/", "Booking_Page",3375 * "navigated to new booking page");3376 */3377 navigateMenu("Maersk_SSP_Menu_BOOK;Maersk_SSP_subMenu_NewBookShipment", "BOOK~New BookShipment",3378 "Booking_Page", "Nvaigate to new Booking page");3379 }3380 log_testActions.info("After Booking page");3381 waitForVisible("txt_BookingPage1");3382 compareValue("txt_BookingPage1", "Booked By", "Booking_Page", "Verify Booking Page");3383 if (testRunner.testStepResult == true) {3384 selectDPDNValue("dpdn_From_BP", "txtbx_From_BP", fromValue1, fromValue2, "Booking_Page", "From");3385 if (testRunner.testStepResult == true) {3386 selectDPDNValue("dpdn_To_BP", "txtbx_To_BP", toValue1, toValue2, "Booking_Page", "To");3387 if (testRunner.testStepResult == true) {3388 if (conType.equals("Reefer/Dangerous")) {3389 clickElement("chk_cargoTepControl", "", "Booking_Page",3390 "Select Cargo Requires Temperature control");3391 clickElement("chk_cargoDangerous", "", "Booking_Page", "Select Dangerous control");3392 }3393 if (testRunner.testStepResult == true) {3394 selectDPDNValue("dpdn_Commodity_BP", "txtbx_Commodity_BP", commValue, "", "Booking_Page",3395 "Commodity");3396 if (testRunner.testStepResult == true) {3397 selectDPDNValue("dpdn_Container_BP", "txtbx_Container_BP", conTypeValue, "",3398 "Booking_Page", "ContainerType");3399 if (testRunner.testStepResult == true) {3400 input("txtbx_Weight_BP", weight, "Booking_Page", "Enter weight");3401 clickElement("Maersk_SSP_chk_iamPriceOwner", "", "Booking_Page",3402 "Click on iam price owner check box");3403 if (testRunner.testStepResult == true) {3404 // clickElement("chkbx_tariff", "", "Booking_Page", "Select Tariff");3405 selectOptionUsingPartialText("Maersk_SSP_lst_PriceOwner",3406 "Gcss Booked By, Copenhagen", pageName, StepName);3407 if (testRunner.testStepResult == true) {3408 clickElement("btn_Continue_Book", "", "Booking_Page", "Click Continue");3409 if (testRunner.testStepResult == true) {3410 waitForVisible("txt_BookingPage2");3411 compareValue("txt_BookingPage2", "Configure your booking details below",3412 "Booking_Page2", "Verify Booking Page2");3413 if (testRunner.testStepResult == true) {3414 input("txtbx_BookedbyReference", reference, "Booking_Page2",3415 "Enter Booked by Reference");3416 if (testRunner.testStepResult == true) {3417 input("txtbx_DangerousCargoDetails", CargoDetails,3418 "Booking_Page2", "Enter Temperature");3419 if (testRunner.testStepResult == true) {3420 clickElement("link_showAdvancedConfigurations", "",3421 "Booking_Page2",3422 "Clicking Show Advanced configuration");3423 clickElement("radio_superFreezer", "", "Booking_Page2",3424 "Select Super Freezer");3425 if (testRunner.testStepResult == true) {3426 clearTextBox("txtbx_Temerature", "", "Booking_Page2",3427 "Clear Temperatures");3428 input("txtbx_Temerature", reeferTemp, "Booking_Page2",3429 "Enter Temperature");3430 if (testRunner.testStepResult == true) {3431 selectOption("select_AdditionalReference",3432 additionalRefType, "Booking_Page2",3433 "Select Additional Reference");3434 if (testRunner.testStepResult == true) {3435 input("txtbx_OOG-BBQuoteRefNum",3436 additionalRefValue, "Booking_Page2",3437 "Enter Yes");3438 if (testRunner.testStepResult == true) {3439 clickElement("btn_BookShipment", "",3440 "Booking_Page2",3441 "Click Book Shipment");3442 if (testRunner.testStepResult == true) {3443 javaClick("btn_PlaceBooking", "",3444 "Booking_Page2",3445 "Click Place Booking");3446 if (testRunner.testStepResult == true) {3447 compareValue(3448 "txt_BookingSuccessMessage",3449 "Your booking has number",3450 "Booking_Page",3451 "Verify Booking Page2");3452 if (testRunner.testStepResult == true) {3453 log_testActions.info(3454 "DGReeferSuperFreezerSingleCargoBooking Booking Success ");3455 String bookinNumber = driver3456 .findElement(By.xpath(3457 "//*[contains(text(),'Your booking has number')]"))3458 .getText();3459 constants.Booking_Number = bookinNumber3460 .replaceAll("\\D", "");3461 System.out.println(3462 constants.Booking_Number);3463 log_testActions.info(3464 " Shipment Booking Number = "3465 + constants.Booking_Number);3466 } else {3467 log_testActions.info(3468 "DGReeferSuperFreezerSingleCargoBooking Booking failed ");3469 }3470 }3471 }3472 }3473 }3474 }3475 }3476 }3477 }3478 }3479 }3480 }3481 }3482 }3483 }3484 }3485 }3486 }3487 }3488 } catch (Exception ex) {3489 log_testActions.info("DG Reefer Standard MultiCargo Booking Failure. Exception = " + ex.getMessage());3490 testRunner.testStepResult = false;3491 }3492 }3493 /*3494 * *****************************************************************************3495 * ***************** Method: trackBooking Author: Ashok Description: To Track3496 * existing booking3497 * *****************************************************************************3498 * ****************3499 */3500 public static void trackBooking(String object, String data, String pageName, String StepName) throws Exception {3501 try {3502 log_testActions.info("Before Track cancel booking ");3503 String bookingNumber = constants.Booking_Number;3504 /*3505 * navigateToUrl("", "https://myt.apmoller.net/shipmentbinder/", "Booking_Page",3506 * "navigated to new booking page");3507 */3508 javaClick("Maersk_SSP_Menu_Track", "TRACK", "Booking_Page", "Nvaigate to Tracking Page");3509 waitForVisible("txt_trackPage1");3510 compareValue("txt_trackPage1", "Track", "Track_Page", "Verify Track Page");3511 waitForVisible("txt_trackPage2");3512 compareValue("txt_trackPage2", "To access a specific shipment", "Track_Page", "Verify Track Page");3513 // input("txtbx_ShipmentNumber", bookingNumber, "Track_Page", "Enter3514 // Booking Number");3515 input("txbx_BLNumber", bookingNumber, "Track_Page", "Enter Booking Number");3516 javaClick("btn_Retrieve", "", "Track_Page", "Click Retrive");3517 clickElement("link_log_ShipmentBinder", "", "ShipmentBinder_Page", "Click Log");3518 waitForVisible("txt_log_Cancellation");3519 log_testActions.info("Track booking Success ");3520 testRunner.testStepResult = true;3521 } catch (Exception ex) {3522 log_testActions.info(" Trac booking Failure. Exception = " + ex.getMessage());3523 testRunner.testStepResult = false;3524 }3525 }3526 /*3527 * *****************************************************************************3528 * ***************** Method: trackShipment Author: Ashok Description: To Track3529 * existing shipment3530 * *****************************************************************************3531 * ****************3532 */3533 3534 public static void trackShipment(String object, String data, String pageName, String StepName) {3535 String[] objectProperties = object.split(";");3536 String TxtTrackShipNo = objectProperties[0];3537 String BtntrackShipNo = objectProperties[1];3538 String binder = objectProperties[2];3539 try {3540 log_testActions.info("Entering the text in " + object + " in " + pageName);3541 System.out.println("Entered value in " + object + "in" + pageName);3542 3543 3544 String url = driver.getCurrentUrl(); 3545 String[] split_URL = url.split("/");3546 String brandName = split_URL[2];3547 String Export_url = "https://" + brandName + "/shipmentoverview/export"; 3548 driver.navigate().to(Export_url);3549 3550 String bookingNumber = data;3551 Thread.sleep(2000); 3552 input(TxtTrackShipNo, bookingNumber, pageName, StepName);3553 javaClick(BtntrackShipNo, "", pageName, StepName);3554 testRunner.testStepResult = true;3555 3556 } catch (Exception e) {3557 testRunner.stepException = e.getMessage();3558 System.out.println("Exception");3559 log_testActions.error("Not able to enter the text in " + pageName + "--- " + e.getMessage());3560 testRunner.testStepResult = false;3561 }3562 }3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 //public void trackShipment(String object, String data, String pageName, String StepName) throws Exception {3575 3576 //try { 3577 3578// String trackObj[] = object.split(";");3579// String txtbx_trackShipNo = trackObj[0];3580// String btn_trackShipNo = trackObj[1];3581// String binder= trackObj[2];3582 3583 3584 //driver.navigate().to("https://demo.maersk.com/shipmentoverview/export");3585 3586 //String bookingNumber = data;3587/* if (bookingNumber.contains("<<RTD_BookingNumber>>")) {3588 bookingNumber = constants.Booking_Number;3589 }3590 3591 System.out.println("In trackShipment Method");3592 String url = driver.getCurrentUrl();3593 System.out.println(url);3594 3595 String[] split_URL = url.split("/");3596 String brandName = split_URL[2];3597 System.out.println("brandName : "+brandName);3598 String Export_url = "https://" + brandName + "/shipmentoverview/export";3599 driver.navigate().to(Export_url);3600 System.out.println(driver.getCurrentUrl());*/3601 3602 //Thread.sleep(2000); 3603 3604 3605 //input(txtbx_trackShipNo, bookingNumber, pageName, stepName);3606 //javaClick(btn_trackShipNo, "", pageName, stepName);3607// WebDriverWait wait = new WebDriverWait(driver, 5);3608// wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(".//*[@id='main']/div[1]/div[1]/h1")));3609//3610// if (compareValue("", "Departing on", pageName, stepName)) {3611//3612// testRunner.testStepResult = true;3613// } else {3614// testRunner.testStepResult = false;3615// }3616//3617// } catch (Exception ex) {3618// 3619// System.out.println("Move to track booking Exception");3620// //testRunner.stepException = ex.getMessage();3621// log_testActions.info(" Trac booking Failure. Exception = " + ex.getMessage());3622// testRunner.testStepResult = false;3623// }3624// }3625 /*3626 * *****************************************************************************3627 * ***************** Method: gotoShipmentBinder Author: Ashok Description: Go to3628 * shipment binder page3629 * *****************************************************************************3630 * ****************3631 */3632 public static void gotoShipmentBinder(String object, String data, String pageName, String StepName)3633 throws Exception {3634 try {3635 log_testActions.info("Before Track booking number ");3636 String bookingNumber = constants.Booking_Number;3637 navigateToUrl("", "https://myt.apmoller.net/shipmentbinder/", "Booking_Page",3638 "navigated to new booking page");3639 input("txbx_BLNumber", data, "Track_Page", "Enter Booking Number");3640 javaClick("btn_Retrieve", "", "Track_Page", "Click Retrive");3641 Thread.sleep(5000);3642 log_testActions.info("Track booking Success ");3643 testRunner.testStepResult = true;3644 } catch (Exception ex) {3645 log_testActions.info(" Trac booking Failure. Exception = " + ex.getMessage());3646 testRunner.testStepResult = false;3647 }3648 }3649 /*3650 * *****************************************************************************3651 * ***************** Method: clickElement Author: Ashok Description: to click on3652 * webelement3653 * *****************************************************************************3654 * ****************3655 */3656 public static void clickElement(String object, String data, String pageName, String StepName) throws Exception3657 // public static void clickElement(String object, String TrigerEvent, String3658 // pageName, String StepName) throws Exception3659 {3660 log_testActions.info("Clicking on " + object + " in " + pageName);3661 WebElement ele = null;3662 waitForVisible(object);3663 try {3664 if (isTestElementPresent(object)) {3665 if ((pageName.equals("Booking_Page") || pageName.equals("Booking_Page2")3666 || pageName.contains("BookingSuccess_Page")) && object.contains(";"))3667 {3668 String ltype = object.split(";")[0];3669 String lvalue = object.split(";")[1];3670 log_testActions.info("locatorType = " + ltype);3671 log_testActions.info("locatorValue = " + lvalue);3672 ele = getObject(getObjectLocator(ltype, lvalue));3673 } else {3674 ele = getObject(getObjectLocator(object));3675 }3676 if (object.equals("lnk_CancelBooking") || object.equals("radio_export_SD"))3677 {3678 waitForEnable(ele);3679 3680 }3681 3682 3683 if (object.equals("btn_DuplicateBooking_Binder"))3684 3685 {3686 3687 waitForEnable(ele);3688 ScrollByPixel("", "down", "", "");3689 }3690 if (object.equals("link_showAdvancedConfigurations") || object.equals("radio_starfresh")3691 || object.equals("radio_magnum") || object.equals("radio_superFreezer")3692 || object.equals("radio_starcare") || object.equals("chk_container1Details")3693 || object.equals("chk_container2Details") || object.equals("lnk_AddOversizedDetails")3694 || object.equals("lnk_EditOversizedDetails") || object.equals("btn_Cancel")3695 || object.contains("lnk_CancelBooking")) {3696 ((JavascriptExecutor) driver).executeScript("arguments[0].click()", ele);3697 Thread.sleep(10000);3698 }3699 else if (object.equals("btn_ContainerClear")) {3700 ScrollByPixel("", "down", "", "");3701 driver.findElement(By.xpath("(//abbr[contains(@class,'select2-search-choice-close')])[4]")).click();3702 }3703 else {3704 3705 3706 WebElement element = getObject(getObjectLocator(object));3707 JavascriptExecutor executor = (JavascriptExecutor) driver;3708 executor.executeScript("arguments[0].scrollIntoView();", element);3709 executor.executeScript("arguments[0].click();", element);3710 // ele.click();3711 }3712 log_testActions.info("Clicked on " + ele + " in " + pageName + "Success");3713 testRunner.testStepResult = true;3714 }3715 } catch (StaleElementReferenceException se) {3716 testRunner.stepException = se.getMessage();3717 log_testActions.error(object + " Not able to click. Exception = " + testRunner.stepException);3718 ele = getObject(getObjectLocator(object));3719 ele.click();3720 testRunner.testStepResult = true;3721 } catch (Exception e) {3722 testRunner.stepException = e.getMessage();3723 log_testActions.error(object + " Not able to click. Exception = " + testRunner.stepException);3724 testRunner.testStepResult = false;3725 }3726 }3727 /*3728 * *****************************************************************************3729 * ***************** Method: serviceContractBooking Author: Ashok Description:3730 * Create serviceContractBooking3731 * *****************************************************************************3732 * ****************3733 */3734 public static void serviceContractBooking(String object, String data, String pageName, String StepName)3735 throws Exception {3736 try {3737 String[] testData = data.split(";");3738 log_testActions.info("Before Reefer serviceContractAffiliate MultiCargo Booking ");3739 String fromValue1 = testData[0];3740 String fromValue2 = testData[1];3741 String toValue1 = testData[2];3742 String toValue2 = testData[3];3743 String conType = testData[4];3744 String commValue = testData[5];3745 String contCount = testData[6];3746 String conTypeValue = testData[7];3747 String weight = testData[8];3748 String commValue2 = testData[9];3749 String contCount2 = testData[10];3750 String conTypeValue2 = testData[11];3751 String weight2 = testData[12];3752 String contractTariff = testData[13];3753 // String contactPerson = testData[10];3754 String reference = testData[14];3755 String exportType = testData[15];3756 String importType = testData[16];3757 // String reeferConType = testData[17];3758 String reeferTemp = testData[17];3759 log_testActions.info("After getting input values");3760 /*3761 * navigateToUrl("", "https://myt.apmoller.net/booking/new", "Booking_Page",3762 * "navigated to new booking page");3763 */3764 // navigateMenu("Maersk_SSP_Menu_BOOK;Maersk_SSP_subMenu_NewBookShipment","BOOK~New3765 // BookShipment","Booking_Page","Nvaigate to new Booking page");3766 if (testRunner.testName.contains("_MML_")) {3767 IGNnavigateMenu("Maersk_SSP_IGN_btn_Book;Maersk_SSP_IGN_lnk_BookNewShipment", "BOOK~New BookShipment",3768 "Booking_Page", "Nvaigate to new Booking page");3769 } else {3770 /*3771 * navigateToUrl("", "https://myt.apmoller.net/shipmentbinder/", "Booking_Page",3772 * "navigated to new booking page");3773 */3774 navigateMenu("Maersk_SSP_Menu_BOOK;Maersk_SSP_subMenu_NewBookShipment", "BOOK~New BookShipment",3775 "Booking_Page", "Nvaigate to new Booking page");3776 }3777 log_testActions.info("After Booking page");3778 waitForVisible("txt_BookingPage1");3779 compareValue("txt_BookingPage1", "Booked By", "Booking_Page", "Verify Booking Page");3780 selectDPDNValue("dpdn_From_BP", "txtbx_From_BP", fromValue1, fromValue2, "Booking_Page", "From");3781 selectDPDNValue("dpdn_To_BP", "txtbx_To_BP", toValue1, toValue2, "Booking_Page", "To");3782 clickElement("chk_cargoTepControl", "", "Booking_Page", "Select Cargo Requires Temperature control");3783 clickElement("chk_cargoDangerous", "", "Booking_Page", "Select Dangerous control");3784 selectDPDNValue("dpdn_Commodity_BP", "txtbx_Commodity_BP", commValue, "", "Booking_Page", "Commodity");3785 selectDPDNValue("dpdn_Container_BP", "txtbx_Container_BP", conTypeValue, "", "Booking_Page",3786 "ContainerType");3787 input("txtbx_Weight_BP", weight, "Booking_Page", "Enter weight");3788 clickElement("Maersk_SSP_chk_iamPriceOwner", "", "Booking_Page", "Click on iam price owner check box");3789 /*3790 * javaClick("lnk_AddConTypeComm", "", "Booking_Page",3791 * "click Add another Container/Commodity");3792 * selectDPDNValue("dpdn_Commodity2_BP", "txtbx_Commodity2_BP", commValue2, "",3793 * "Booking_Page", "Commodity"); selectDPDNValue("dpdn_Container2_BP",3794 * "txtbx_Container2_BP", conTypeValue2, "", "Booking_Page", "ContainerType");3795 * input("txtbx_Weight2_BP", weight2, "Booking_Page", "Enter weight2");3796 */3797 // javaClick("chkbx_tariff", "", "Booking_Page", "Select Tariff");3798 selectOptionUsingPartialText("Maersk_SSP_lst_PriceOwner", "Gcss Booked By, Copenhagen", pageName, StepName);3799 clickElement("btn_Continue_Book", "", "Booking_Page", "Click Continue");3800 waitForVisible("txt_BookingPage2");3801 compareValue("txt_BookingPage2", "Configure your booking details below", "Booking_Page2",3802 "Verify Booking Page2");3803 input("txtbx_BookedbyReference", reference, "Booking_Page2", "Enter Booked by Reference");3804 input("txtbx_contract_BP", contractTariff, "Booking_Page", "enter contract number");3805 input("txtbx_DangerousCargoDetails", "Dangerous", "Booking_Page2", "Enter Temperature");3806 input("txtbx_Temerature", reeferTemp, "Booking_Page2", "Enter Temperature");3807 javaClick("Maersk_SSP_lnk_ShowAdvanceConfig", "", "Booking page2", "Click on advance reefer config");3808 clickElement("Maersk_SSP_rdo_reeferMagnum", "", "Select magnum radio button", "Booking Page 2");3809 javaClick("btn_BookShipment", "", "Booking_Page2", "Click Book Shipment");3810 javaClick("btn_PlaceBooking", "", "Booking_Page2", "Click Place Booking");3811 compareValue("txt_BookingSuccessMessage", "Your booking has number", "Booking_Page",3812 "Verify Booking Page2");3813 if (testRunner.testStepResult == true) {3814 log_testActions.info("ReeferServiceContractAffiliate single CargoBooking Booking Success ");3815 String bookinNumber = driver.findElement(By.xpath("//*[contains(text(),'Your booking has number')]"))3816 .getText();3817 constants.Booking_Number = bookinNumber.replaceAll("\\D", "");3818 System.out.println(constants.Booking_Number);3819 log_testActions.info(" Shipment Booking Number = " + constants.Booking_Number);3820 testRunner.reportLogger.log(LogStatus.PASS,3821 "B3 ReeferServiceContractAffiliateMultiCargoBooking number " + constants.Booking_Number,3822 constants.KEYWORD_PASS);3823 } else {3824 log_testActions.info("ReeferServiceContractAffiliateMultiCargoBooking Booking failed ");3825 }3826 } catch (Exception ex) {3827 log_testActions3828 .info("Reefer serviceContractAffiliate MultiCargo Booking Failure. Exception = " + ex.getMessage());3829 testRunner.testStepResult = false;3830 }3831 }3832 /*----- Method Name: trackAmendmentBooking3833 * ---- Author Name: Ashok3834 * */3835 /*3836 * *****************************************************************************3837 * ***************** Method: trackAmendmentBooking Author: Ashok Description:3838 * Teack amend booking3839 * *****************************************************************************3840 * ****************3841 */3842 public void trackAmendmentBooking(String object, String data, String pageName, String StepName)3843 throws Exception {3844 String bookingNumber = constants.Booking_Number;3845 bookingNumber = data;3846 try {3847 log_testActions.info("Before Track Amend booking ");3848 /*3849 * navigateToUrl("", "https://myt.apmoller.net/shipmentbinder/", "Booking_Page",3850 * "navigated to new booking page");3851 */3852 navigateMenu("Maersk_SSP_Menu_Track", "TRACK", "Booking_Page", "Nvaigate to Tracking Page");3853 Thread.sleep(5000);3854 waitForVisible("txt_trackPage1");3855 compareValue("txt_trackPage1", "Track", "Track_Page", "Verify Track Page");3856 waitForVisible("txt_trackPage2");3857 compareValue("txt_trackPage2", "To access a specific shipment", "Track_Page", "Verify Track Page");3858 // input("txtbx_ShipmentNumber", bookingNumber, "Track_Page", "Enter3859 // Booking Number");3860 input("txbx_BLNumber", bookingNumber, "Track_Page", "Enter Booking Number");3861 clickElement("btn_Retrieve", "", "Track_Page", "Click Retrive");3862 clickElement("link_log_ShipmentBinder", "", "ShipmentBinder_Page", "Click Log");3863 waitForVisible("txt_log_Amendment");3864 log_testActions.info("Track Ammend booking Success ");3865 testRunner.testStepResult = true;3866 } catch (Exception ex) {3867 log_testActions.info(" Trac booking Failure. Exception = " + ex.getMessage());3868 testRunner.testStepResult = false;3869 }3870 }3871 /*3872 * *****************************************************************************3873 * ***************** Method: changeCustomerCode Author: Ashok Description: To3874 * change customer code3875 * *****************************************************************************3876 * ****************3877 */3878 public static void changeCustomerCode(String object, String data, String pageName, String StepName)3879 throws Exception {3880 try {3881 log_testActions.info("Before changeCustomerCode ");3882 String custmerCode = data;3883 navigateToUrl("", "https://myt.apmoller.net/portaluser/#login/set-customer", "Booking_Page",3884 "navigated to new to change custmer code page");3885 Thread.sleep(5000);3886 compareValue("Customer code", "Login_Page", "Login_Page", "Verify text");3887 input("txtbx_Code", custmerCode, "Login_Page", "Enter custmer code Number");3888 clickElement("btn_Continue", "", "Login_Page", "Click continue");3889 log_testActions.info("change custmer code Success ");3890 testRunner.testStepResult = true;3891 } catch (Exception ex) {3892 log_testActions.info(" change custmer code Failure. Exception = " + ex.getMessage());3893 testRunner.testStepResult = false;3894 }3895 }3896 /*3897 * *****************************************************************************3898 * ***************** Method: navigateMenu Author: Ashok Description: used to3899 * Navigate Menu3900 * *****************************************************************************3901 * ****************3902 */3903 public static void IGNnavigateMenu(String object, String data, String pageName, String StepName) throws Exception {3904 String strMenu = null;3905 String strSubMenu = null;3906 try {3907 JavascriptExecutor js = (JavascriptExecutor) driver;3908 Properties property = new Properties();3909 String[] arrMenus = object.split(";");3910 int menuLength = arrMenus.length;3911 // clicking level 13912 /*3913 * strMenu = property.getProperty(strMenu); strMenu = strMenu.split(";")[1];3914 */3915 if (arrMenus.length == 1) {3916 strMenu = arrMenus[0];3917 WebElement wlmMenu = getObject(getObjectLocator(strMenu));3918 js.executeScript("arguments[0].focus();", wlmMenu);3919 Actions builder = new Actions(driver);3920 builder.moveToElement(wlmMenu).perform();3921 wlmMenu.click();3922 Thread.sleep(5000);3923 driver.navigate().refresh();3924 testRunner.testStepResult = true;3925 log_testActions.info("Expected text " + strMenu + " is dispalyed in " + pageName);3926 System.out.println("Expected text " + strMenu + " is dispalyed in " + pageName);3927 }3928 // level23929 if (arrMenus.length == 2) {3930 /*3931 * strMenu = arrMenus[0]; strSubMenu = arrMenus[1]; WebElement wlmMenu =3932 * getObject(getObjectLocator(strMenu));3933 * js.executeScript("arguments[0].focus();", wlmMenu); Actions builder = new3934 * Actions(driver); builder.moveToElement(wlmMenu).perform(); wlmMenu.click();3935 * //strSubMenu = property.getProperty(strSubMenu); WebElement wlmSubMenu =3936 * getObject(getObjectLocator(strSubMenu));3937 * js.executeScript("arguments[0].focus();", wlmSubMenu);3938 * builder.moveToElement(wlmSubMenu).perform(); wlmSubMenu.click(); String3939 * pageTitle = driver.getTitle(); if (pageTitle.contains("Certificate") ||3940 * pageTitle.contains("Certificate")) { javaClick("lnk_CertificateErrorIE", "",3941 * "", "Click on continue certificate error");3942 * 3943 * } if (pageTitle.contains("Acceptable Usage Policy")) {3944 * javaClick("btn_IAcceptError", "", "", "Click on I Accept Button");3945 * 3946 * } log_testActions.info("Expected text " + strSubMenu + " is dispalyed in " +3947 * pageName); System.out.println("Expected text " + strSubMenu +3948 * " is dispalyed in " + pageName); testRunner.testStepResult = true;3949 * driver.navigate().refresh();3950 */3951 // Edited One3952 // ____________3953 strMenu = arrMenus[0];3954 strSubMenu = arrMenus[1];3955 javaClick(strMenu, "", "", "Click on Main Menu");3956 javaClick(strSubMenu, "", "", "Click on SubMenu");3957 // List<WebElement> li = driver.findElements(By.xpath("//*[text()='Manage']"));3958 // System.out.println(li.get(2).getText());3959 // li.get(2).click();3960 // driver.findElement(By.xpath("(//*[@class='ign-header__buttons__elem'])[2]")).click();3961 TestActions.refreshWindow("", "", "", "");3962 testRunner.testStepResult = true;3963 // ____________3964 }3965 }3966 catch (Exception e) {3967 log_testActions.info(" reeferStarfreshSingleCargo Booking Failure. Exception = " + e.getMessage());3968 testRunner.testStepResult = false;3969 System.out.println(e.getMessage());3970 }3971 }3972 /*3973 * *****************************************************************************3974 * ***************** Method: DGReeferShipperownMultiCargoBooking Author: Ashok3975 * Description: Create DGReeferShipperownMultiCargoBooking3976 * *****************************************************************************3977 * ****************3978 */3979 public static void DGReeferShipperownMultiCargoBooking(String object, String data, String pageName, String StepName)3980 throws Exception {3981 try {3982 String[] testData = data.split(";");3983 log_testActions.info("Before DG Reefer Standard MultiCargo Booking ");3984 String fromValue1 = testData[0];3985 String fromValue2 = testData[1];3986 String toValue1 = testData[2];3987 String toValue2 = testData[3];3988 String conType = testData[4];3989 String commValue = testData[5];3990 String contCount = testData[6];3991 String conTypeValue = testData[7];3992 String weight = testData[8];3993 String commValue2 = testData[9];3994 String contCount2 = testData[10];3995 String conTypeValue2 = testData[11];3996 String weight2 = testData[12];3997 String contractTariff = testData[13];3998 // String contactPerson = testData[10];3999 String reference = testData[14];4000 String exportType = testData[15];4001 String importType = testData[16];4002 String reeferConType = testData[17];4003 String haulage_Instructions = testData[18];4004 String loadAddress = testData[19];4005 SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");4006 Date todayDate = Calendar.getInstance().getTime();4007 String todayDateString = formatter.format(todayDate);4008 String[] cont1LoadDetails = testData[20].split("/");4009 String cont1LoadFromDate = cont1LoadDetails[0].equals("today") ? todayDateString : cont1LoadDetails[0];4010 String cont1LoadFromTime = cont1LoadDetails[1];4011 String cont1LoadToDate = cont1LoadDetails[2].equals("today") ? todayDateString : cont1LoadDetails[2];4012 String cont1LoadToTime = cont1LoadDetails[3];4013 String cont1LoadRef = cont1LoadDetails[4];4014 String[] cont2LoadDetails = testData[21].split("/");4015 String cont2LoadFromDate = cont2LoadDetails[0].equals("today") ? todayDateString : cont2LoadDetails[0];4016 String cont2LoadFromTime = cont2LoadDetails[1];4017 String cont2LoadToDate = cont2LoadDetails[2].equals("today") ? todayDateString : cont2LoadDetails[2];4018 String cont2LoadToTime = cont2LoadDetails[3];4019 String cont2LoadRef = cont2LoadDetails[4];4020 String CargoDetails = testData[22];4021 String reeferTemp = testData[23];4022 String additionalRefType = testData[24];4023 String additionalRefValue = testData[25];4024 log_testActions.info("After getting input values");4025 /*4026 * navigateToUrl("", "https://myt.apmoller.net/booking/new", "Booking_Page",4027 * "navigated to new booking page"); navigateMenu(4028 * "Maersk_SSP_Menu_BOOK;Maersk_SSP_subMenu_NewBookShipment","BOOK~New BookShipment"4029 * ,"Booking_Page","Nvaigate to new Booking page");4030 * log_testActions.info("After Booking page");4031 */4032 if (testRunner.testName.contains("_MML_")) {4033 IGNnavigateMenu("Maersk_SSP_IGN_btn_Book;Maersk_SSP_IGN_lnk_BookNewShipment", "BOOK~New BookShipment",4034 "Booking_Page", "Nvaigate to new Booking page");4035 } else {4036 navigateMenu("Maersk_SSP_Menu_BOOK;Maersk_SSP_subMenu_NewBookShipment", "BOOK~New BookShipment",4037 "Booking_Page", "Nvaigate to new Booking page");4038 }4039 waitForVisible("txt_BookingPage1");4040 compareValue("txt_BookingPage1", "Booked By", "Booking_Page", "Verify Booking Page");4041 selectDPDNValue("dpdn_From_BP", "txtbx_From_BP", fromValue1, fromValue2, "Booking_Page", "From");4042 selectDPDNValue("dpdn_To_BP", "txtbx_To_BP", toValue1, toValue2, "Booking_Page", "To");4043 clickElement("radio_Export_SD", "", "Booking_Page1", "Select Export SD mode");4044 clickElement("chk_cargoTepControl", "", "Booking_Page", "Select Cargo Requires Temperature control");4045 clickElement("chk_cargoDangerous", "", "Booking_Page", "Select Dangerous control");4046 selectDPDNValue("dpdn_Commodity_BP", "txtbx_Commodity_BP", commValue, "", "Booking_Page", "Commodity");4047 selectDPDNValue("dpdn_Container_BP", "txtbx_Container_BP", conTypeValue, "", "Booking_Page",4048 "ContainerType");4049 input("txtbx_Weight_BP", weight, "Booking_Page", "Enter weight");4050 clickElement("Maersk_SSP_chk_iamPriceOwner", "", "Booking_Page", "Click on iam price owner check box");4051 javaClick("lnk_AddConTypeComm", "", "Booking_Page", "click Add another Container/Commodity");4052 selectDPDNValue("dpdn_Commodity2_BP", "txtbx_Commodity2_BP", commValue2, "", "Booking_Page", "Commodity");4053 selectDPDNValue("dpdn_Container2_BP", "txtbx_Container2_BP", conTypeValue2, "", "Booking_Page",4054 "ContainerType");4055 input("txtbx_Weight2_BP", weight2, "Booking_Page", "Enter weight2");4056 // clickElement("chkbx_tariff", "", "Booking_Page", "Select Tariff");4057 selectOptionUsingPartialText("Maersk_SSP_lst_PriceOwner", "Gcss Booked By, Copenhagen", pageName, StepName);4058 clickElement("btn_Continue_Book", "", "Booking_Page", "Click Continue");4059 waitForVisible("txt_BookingPage2");4060 compareValue("txt_BookingPage2", "Configure your booking details below", "Booking_Page2",4061 "Verify Booking Page2");4062 input("txtbx_BookedbyReference", reference, "Booking_Page2", "Enter Booked by Reference");4063 /*4064 * clickElement("radio_Export_SD", "", "Booking_Page1",4065 * "Select Export SD mode");4066 */4067 input("txtbx_HaulageInstructions", haulage_Instructions, "Booking_Page2", "Enter Booked by Reference");4068 selectOptionUsingPartialText("select_LoadAddress", "Gcss Booked By, Copenhagen", "Booking_Page2",4069 "Select Load Address");4070 input("txtbx_Cont1LoadFromDate", cont1LoadFromDate, "Booking_Page2", "Enter Container1 Load From Date");4071 input("txtbx_Cont1LoadFromTime", cont1LoadFromTime, "Booking_Page2", "Enter Container1 Load From Time");4072 input("txtbx_Cont1LoadToDate", cont1LoadToDate, "Booking_Page2", "Enter Container1 Load To Date");4073 input("txtbx_Cont1LoadToTime", cont1LoadToTime, "Booking_Page2", "Enter Container1 Load To Time");4074 input("txtbx_Cont1LoadRef", cont1LoadRef, "Booking_Page2", "Enter Container1 Load To Time");4075 clearTextBox("txtbx_Cont2LoadFromDate", "", "Booking_Page2", "Clear Container2 Load From Date");4076 clearTextBox("txtbx_Cont2LoadFromTime", "", "Booking_Page2", "Clear Container2 Load From Time");4077 clearTextBox("txtbx_Cont2LoadToDate", "", "Booking_Page2", "Clear Container2 Load To Date");4078 clearTextBox("txtbx_Cont2LoadToTime", "", "Booking_Page2", "Clear Container2 Load To Date");4079 input("txtbx_Cont2LoadFromDate", cont2LoadFromDate, "Booking_Page2", "Enter Container2 Load From Date");4080 input("txtbx_Cont2LoadFromTime", cont2LoadFromTime, "Booking_Page2", "Enter Container2 Load From Time");4081 input("txtbx_Cont2LoadToDate", cont2LoadToDate, "Booking_Page2", "Enter Container2 Load To Date");4082 input("txtbx_Cont2LoadToTime", cont2LoadToTime, "Booking_Page2", "Enter Container2 Load To Time");4083 input("txtbx_Cont2LoadRef", cont2LoadRef, "Booking_Page2", "Enter Container2 Load To Time");4084 input("txtbx_DangerousCargoDetails", CargoDetails, "Booking_Page2", "Enter Temperature");4085 input("txtbx_Temerature", reeferTemp, "Booking_Page2", "Enter Temperature");4086 selectOption("select_AdditionalReference", additionalRefType, "Booking_Page2",4087 "Select Additional Reference");4088 input("txtbx_OOG-BBQuoteRefNum", additionalRefValue, "Booking_Page2", "Enter Yes");4089 clickElement("btn_BookShipment", "", "Booking_Page2", "Click Book Shipment");4090 javaClick("btn_PlaceBooking", "", "Booking_Page2", "Click Place Booking");4091 compareValue("txt_BookingSuccessMessage", "Your booking has number", "Booking_Page",4092 "Verify Booking Page2");4093 if (testRunner.testStepResult == true) {4094 log_testActions.info("DGReeferStandardMultiCargoBooking Booking Success ");4095 String bookinNumber = driver.findElement(By.xpath("//*[contains(text(),'Your booking has number')]"))4096 .getText();4097 constants.Booking_Number = bookinNumber.replaceAll("\\D", "");4098 System.out.println(constants.Booking_Number);4099 log_testActions.info(" Shipment Booking Number = " + constants.Booking_Number);4100 } else {4101 log_testActions.info("DGReeferStandardMultiCargoBooking Booking failed ");4102 }4103 } catch (Exception ex) {4104 log_testActions.info("DG Reefer Standard MultiCargo Booking Failure. Exception = " + ex.getMessage());4105 testRunner.testStepResult = false;4106 }4107 }4108 /*4109 * *****************************************************************************4110 * ***************** Method: essentialTerms Author: Ashok Description: Essential4111 * terms page4112 * *****************************************************************************4113 * ****************4114 */4115 public static void essentialTerms(String object, String data, String pageName, String StepName) throws Exception {4116 try {4117 String[] testData = data.split(";");4118 int length = testData.length;4119 log_testActions.info("Essential terms ");4120 String TextMessage = testData[0];4121 String ContractNumber = testData[1];4122 /*4123 * goToUrl("", "https://myt.apmoller.net/essential/contractLookup",4124 * "SearchByContractNumber_Page", "Click EssentialTearms Link");4125 */4126 // clickElement("btn_Search_EssentialTerms1", "",4127 // "SearchByContractNumber_Page", "Click Search Button");4128 navigateMenu("Maersk_SSP_Menu_LOOKUP;Maersk_SSP_subMenu_EssentialTerms", "LOOKUP~Essential Terms",4129 "Home_Page", "Navigate To Essential Terms Page");4130 waitForVisible("txt_BookingPage1");4131 compareValue("txt_ContractPageSuccess", "Service Contract Essential Terms", "SearchByContractNumber_Page",4132 "Verify SearchByContractNumber_Page");4133 input("txtbx_contractNumber", ContractNumber, "SearchByContractNumber_Page", "Enter Contarct number");4134 clickElement("btn_Search_EssentialTerms1", "", "SearchByContractNumber_Page", "Click Search Button");4135 testRunner.testStepResult = true;4136 } catch (Exception ex) {4137 log_testActions.info(" napBooking Failure. Exception = " + ex.getMessage());4138 testRunner.testStepResult = false;4139 }4140 }4141 /*4142 * *****************************************************************************4143 * ***************** Method: searchbyOriginDestination Author: Ashok4144 * Description: SearchbyOriginDestination origin page4145 * *****************************************************************************4146 * ****************4147 */4148 public static void searchbyOriginDestination(String object, String data, String pageName, String StepName)4149 throws Exception {4150 try {4151 String[] testData = data.split(";");4152 int length = testData.length;4153 log_testActions.info("Essential terms ");4154 String fromValue1 = testData[0];4155 // String fromValue2=testData[1];4156 String toValue1 = testData[1];4157 // String toValue2 = testData[3];4158 String commValue = testData[2];4159 clickElement("lnk_EssentialTearms", "", "SearchByContractNumber_Page", "Click lnk_EssentialTearms");4160 compareValue("txt_ContractPageSuccess", "Service Contract Essential Terms", "SearchByContractNumber_Page",4161 "Verify SearchByContractNumber_Page");4162 clickElement("link_Essentials_Search_OriginDestination", "", "SearchByOriginDestination_Page",4163 "Click link_Essentials_Search_OriginDestination");4164 selectDPDNValue("select_Origin", "txtbx_Origin", fromValue1, "", "SearchByOriginDestination_Page",4165 "Eneter Origin");4166 log_testActions.info(" From Address Selected as = " + fromValue1);4167 selectDPDNValue("select_Destination", "txtbx_Destination", toValue1, "", "SearchByOriginDestination_Page",4168 "Enter Destination");4169 log_testActions.info(" To Address Selected as = " + toValue1);4170 selectDPDNValue("select_Commodity", "txtbx_Commodity", commValue, "", "SearchByOriginDestination_Page",4171 "Enter Commodity");4172 clickElement("btn_Search_EssentialTerms2", "", "SearchByContractNumber_Page", "Click lnk_EssentialTearms");4173 compareValue("txt_ContractPageSuccess", "Service Contract Essential Terms", "SearchByContractNumber_Page",4174 "Verify SearchByContractNumber_Page");4175 Thread.sleep(30000);4176 testRunner.testStepResult = true;4177 } catch (Exception ex) {4178 log_testActions.info(" napBooking Failure. Exception = " + ex.getMessage());4179 testRunner.testStepResult = false;4180 }4181 }4182 /*4183 * *****************************************************************************4184 * ***************** Method: javaClick Author: Ashok Description: Java Script4185 * click4186 * *****************************************************************************4187 * ****************4188 */4189 public static void javaClick(String object, String data, String pageName, String StepName) throws Exception {4190 log_testActions.info("Clicking on " + object + " in " + pageName);4191 System.out.println("Clicking on " + object + " in " + pageName);4192 WebElement element = null;4193 waitForVisible(object);4194 try {4195 System.out.println("Element Present");4196 4197 if (object.contains("lnk_ShipmentBinder_AckPage") || object.contains("lnk_CancelBooking")4198 || object.contains("btn_AmendBooking_Binder")) {4199 waitForVisible(object);4200 }4201 element = getObject(getObjectLocator(object));4202 JavascriptExecutor executor = (JavascriptExecutor) driver;4203 executor.executeScript("arguments[0].click();", element);4204 /*if (object.contains("btn_BookShipment") || object.contains("btn_RequestAmendment")) {4205 4206 Thread.sleep(2000);4207 driver.findElement(By.xpath("//*[@id='confirm-button']")).click();4208 }*/4209 log_testActions.info("Clicked on " + object + " in " + pageName + " Success");4210 System.out.println("Clicked on " + object + " in " + pageName + " Success");4211 testRunner.testStepResult = true;4212 } catch (Exception e) {4213 4214 //testRunner.stepException = e.getMessage();4215 Log.error("Not able to click --- " + e.getMessage());4216 System.out.println("Exception");4217 testRunner.testStepResult = false;4218 }4219 }4220 /*4221 * *****************************************************************************4222 * ***************** ----- Method Name: verifyFirstLetter ---- Author Name:4223 * Ashok ---- Description: verifyFirstLetter method is used to verify the first4224 * letter in the word4225 * *****************************************************************************4226 * *****************4227 */4228 public static void verifyFirstLetter(String object, String data, String pageName, String StepName) {4229 log_testActions.info("Before Verifying " + object + " in " + pageName);4230 boolean status = true;4231 ArrayList<WebElement> listItems;4232 // WebElement ele=null;4233 try {4234 listItems = (ArrayList<WebElement>) getObjects(getObjectLocator(object));4235 for (int i = 0; i < listItems.size(); i++) {4236 String Optiontext = listItems.get(0).getText().trim();4237 if (Optiontext.startsWith(data)) {4238 log_testActions.info("The first letter contains " + data + " in " + pageName + "Success");4239 System.out.println("The first letter contains " + data + " in " + pageName + "Success");4240 testRunner.testStepResult = true;4241 }4242 }4243 } catch (Exception e) {4244 Log.error("the first letter not contains --- " + e.getMessage());4245 System.out.println("The first letter not contains " + data + " in " + pageName + "Success");4246 testRunner.testStepResult = false;4247 }4248 }4249 /*----- Method Name: verifyLetter4250 * ---- Author Name: Ashok4251 * ---- Description: verifyLetter method is used to verify the word contains letter in the word4252 */4253 public static void verifyLetter(String object, String data, String pageName, String StepName) {4254 log_testActions.info("Before Verifying " + object + " in " + pageName);4255 boolean status = true;4256 ArrayList<WebElement> listItems;4257 try {4258 listItems = (ArrayList<WebElement>) getObjects(getObjectLocator(object));4259 for (int i = 0; i < listItems.size(); i++) {4260 String Optiontext = listItems.get(0).getText().trim();4261 if (Optiontext.contains(data)) {4262 log_testActions.info("The first letter contains " + data + " in " + pageName + "Success");4263 System.out.println("The first letter contains " + data + " in " + pageName + "Success");4264 testRunner.testStepResult = true;4265 }4266 }4267 } catch (Exception e) {4268 Log.error("the first letter not contains --- " + e.getMessage());4269 System.out.println("The first letter not contains " + data + " in " + pageName + "Success");4270 testRunner.testStepResult = false;4271 }4272 }4273 /*----- Method Name: selectListOption4274 * ---- Author Name: Ashok4275 * ---- Description: selectListOption is used to select list item4276 */4277 public static void selectListOption(String object, String data, String pageName, String StepName) {4278 WebElement listIdentifier = null;4279 try {4280 listIdentifier = getObject(getObjectLocator(object));4281 Select dropdown = new Select(listIdentifier);4282 dropdown.selectByVisibleText(data);4283 testRunner.testStepResult = true;4284 } catch (Exception e) {4285 testRunner.stepException = e.getMessage();4286 Log.error("the List not contains --- " + e.getMessage());4287 System.out.println("The List not contains " + data + " in " + pageName + "Success");4288 testRunner.testStepResult = false;4289 }4290 }4291 /*----- Method Name: keyPressTab4292 * ---- Author Name: Ashok4293 * ---- Description: keyPressTab is used to press Tab keyboard button4294 */4295 public static void keyPressTab(String object, String data, String pageName, String StepName) {4296 WebElement ele = null;4297 waitForVisible(object);4298 try {4299 Log.info("Clicking on Web Element " + object);4300 ele = getObject(getObjectLocator(object));4301 if (data.equalsIgnoreCase("down")) {4302 ele.sendKeys(Keys.DOWN);4303 // String press = Keys.chord(Keys.SHIFT, Keys.TAB);4304 Thread.sleep(5000);4305 testRunner.testStepResult = true;4306 } else if (data.equalsIgnoreCase("enter")) {4307 ele.sendKeys(Keys.ENTER);4308 // String press = Keys.chord(Keys.SHIFT, Keys.TAB);4309 testRunner.testStepResult = true;4310 }4311 else if (data.equalsIgnoreCase("F5")) {4312 ele.sendKeys(Keys.F5);4313 testRunner.testStepResult = true;4314 }4315 else {4316 ele.sendKeys(Keys.TAB);4317 // String press = Keys.chord(Keys.SHIFT, Keys.TAB);4318 Thread.sleep(5000);4319 testRunner.testStepResult = true;4320 }4321 } catch (Exception e) {4322 testRunner.stepException = e.getMessage();4323 // testRunner.imagePath = ExtentManager.captureScreen(driver,4324 // System.getProperty("user.dir")+"\\Screenshots\\Failed\\");4325 Log.error("Not able to press Tab key --- " + e.getMessage());4326 testRunner.testStepResult = false;4327 }4328 }4329 /*----- Method Name: verifyWord4330 * ---- Author Name: Ashok4331 * ---- Description: verifyWord is used to verify word4332 */4333 public static void verifyWord(String object, String data, String pageName, String StepName) {4334 log_testActions.info("Before Verifying " + object + " in " + pageName);4335 boolean status = true;4336 ArrayList<WebElement> listItems;4337 try {4338 listItems = (ArrayList<WebElement>) getObjects(getObjectLocator(object));4339 for (int i = 0; i < listItems.size(); i++) {4340 String Optiontext = listItems.get(0).getText().trim();4341 if (Optiontext.contains(data)) {4342 log_testActions.info("The first letter contains " + data + " in " + pageName + "Success");4343 System.out.println("The first letter contains " + data + " in " + pageName + "Success");4344 testRunner.testStepResult = true;4345 }4346 }4347 } catch (Exception e) {4348 Log.error("the first letter not contains --- " + e.getMessage());4349 System.out.println("The first letter not contains " + data + " in " + pageName + "Success");4350 testRunner.testStepResult = false;4351 }4352 }4353 /*----- Method Name: isEnabled4354 * ---- Author Name: Ashok4355 * ---- Description: isEnabled is used to verify the web element is Enabled or not4356 */4357 public static void isEnabled(String object, String data, String pageName, String StepName) {4358 WebElement ele = null;4359 waitForVisible(object);4360 try {4361 if (getObject(getObjectLocator(object)).isEnabled())4362 {4363 testRunner.testStepResult = true;4364 return;4365 } else {4366 testRunner.testStepResult = false;4367 return;4368 }4369 } catch (Exception e) {4370 testRunner.stepException = e.getMessage();4371 Log.error("Not able to verify the presence of the element");4372 testRunner.testStepResult = false;4373 }4374 }4375 /*----- Method Name: isSelected4376 * ---- Author Name: Ashok4377 * ---- Description: isSelected is used to verify the web element is Selected or not4378 */4379 public static void isSelected(String object, String data, String pageName, String StepName) {4380 WebElement ele = null;4381 waitForVisible(object);4382 try {4383 ele = getObject(getObjectLocator(object));4384 if (ele.isSelected())4385 {4386 testRunner.testStepResult = true;4387 return;4388 } else {4389 testRunner.testStepResult = false;4390 return;4391 }4392 } catch (Exception e) {4393 testRunner.stepException = e.getMessage();4394 // testRunner.imagePath = ExtentManager.captureScreen(driver,4395 // System.getProperty("user.dir")+"\\Screenshots\\Failed\\");4396 Log.error("Not able to verify the presence of the element");4397 testRunner.testStepResult = false;4398 }4399 }4400 /*----- Method Name: isDisabled4401 * ---- Author Name: Ashok4402 * ---- Description: isDisabled is used to verify the web element is Disabled or not4403 */4404 public static void isDisabled(String object, String data, String pageName, String StepName) {4405 WebElement ele = null;4406 try {4407 ele = getObject(getObjectLocator(object));4408 if (!ele.isEnabled())4409 {4410 testRunner.testStepResult = true;4411 return;4412 } else {4413 testRunner.testStepResult = false;4414 return;4415 }4416 } catch (Exception e) {4417 testRunner.stepException = e.getMessage();4418 Log.error("Not able to verify the presence of the element");4419 testRunner.testStepResult = false;4420 }4421 }4422 /*----- Method Name: isNotSelected4423 * ---- Author Name: Ashok4424 * ---- Description: isNotSelected is used to verify the web element is Not Selected4425 */4426 public static void isNotSelected(String object, String data, String pageName, String StepName) {4427 WebElement ele = null;4428 try {4429 if (!(getObject(getObjectLocator(object)).isSelected()))4430 // if(driver.findElement(By.xpath(OR.getProperty(object))).isEnabled())4431 {4432 testRunner.testStepResult = true;4433 return;4434 } else {4435 testRunner.testStepResult = false;4436 return;4437 }4438 } catch (Exception e) {4439 testRunner.stepException = e.getMessage();4440 Log.error("Not able to verify the presence of the element");4441 testRunner.testStepResult = false;4442 }4443 }4444 /*----- Method Name: UnCheck4445 * ---- Author Name: Ashok4446 * ---- Description: UnCheck is used to un check the check box4447 */4448 public static void unCheck(String object, String data, String pageName, String StepName) {4449 WebElement element = null;4450 waitForVisible(object);4451 try {4452 element = getObject(getObjectLocator(object));4453 if (element.isSelected())4454 // if(driver.findElement(By.xpath(OR.getProperty(object))).isEnabled())4455 {4456 /* element.click(); */4457 JavascriptExecutor executor = (JavascriptExecutor) driver;4458 executor.executeScript("arguments[0].click();", element);4459 testRunner.testStepResult = true;4460 return;4461 } else {4462 testRunner.testStepResult = false;4463 return;4464 }4465 } catch (Exception e) {4466 testRunner.stepException = e.getMessage();4467 Log.error("Not able to verify the presence of the element");4468 testRunner.testStepResult = false;4469 }4470 }4471 /*4472 * *****************************************************************************4473 * ***************** Method: bookingSecondage Author: Ashok Description: Enter4474 * All values for Booking Second page4475 * *****************************************************************************4476 * ****************4477 */4478 public static void bookingSecondage(String object, String data, String pageName, String StepName) throws Exception {4479 try {4480 String[] testData = data.split(";");4481 int length = testData.length;4482 log_testActions.info("Before napBooking ");4483 String fromValue1 = testData[0];4484 String fromValue2 = testData[1];4485 String toValue1 = testData[2];4486 String toValue2 = testData[3];4487 String conType = testData[4];4488 String commValue = testData[5];4489 String contCount = testData[6];4490 String conTypeValue = testData[7];4491 String weight = testData[8];4492 String contractTariff = testData[9];4493 // String contactPerson = testData[10];4494 String reference = testData[10];4495 String exportType = testData[11];4496 String importType = testData[12];4497 driver.get("https://myt.apmoller.net/booking/new");4498 waitForVisible("txt_BookingPage1");4499 compareValue("txt_BookingPage1", "Book New Shipments", "Booking_Page", "Verify Booking Page");4500 selectDPDNValue("dpdn_From_BP", "txtbx_From_BP", fromValue1, fromValue2, "Booking_Page", "From");4501 log_testActions.info(" From Address Selected as = " + fromValue1);4502 selectDPDNValue("dpdn_To_BP", "txtbx_To_BP", toValue1, toValue2, "Booking_Page", "To");4503 log_testActions.info(" To Address Selected as = " + toValue1);4504 selectDPDNValue("dpdn_Commodity_BP", "txtbx_Commodity_BP", commValue, "", "Booking_Page", "Commodity");4505 selectDPDNValue("dpdn_Container_BP", "txtbx_Container_BP", conTypeValue, "", "Booking_Page",4506 "ContainerType");4507 input("txtbx_Weight_BP", weight, "Booking_Page", "Enter weight");4508 clickElement("Maersk_SSP_chk_iamPriceOwner", "", "Booking_Page", "Click on iam price owner check box");4509 input("txtbx_contract_BP", contractTariff, "Booking_Page", "Enter Contract number");4510 clickElement("btn_Continue_Book", "", "Booking_Page", "Click Continue");4511 testRunner.testStepResult = true;4512 } catch (Exception ex) {4513 testRunner.stepException = ex.getMessage();4514 log_testActions.info(" napBooking Failure. Exception = " + ex.getMessage());4515 testRunner.testStepResult = false;4516 }4517 }4518 /*4519 * *****************************************************************************4520 * ***************** Method: verifyToolTip Author: Ashok Description: Verify too4521 * tip4522 * *****************************************************************************4523 * ****************4524 */4525 public static boolean verifyToolTip(String object, String data, String pageName, String StepName) {4526 WebElement ele = null;4527 try {4528 Actions ToolTip1 = new Actions(driver);4529 ele = getObject(getObjectLocator(object));4530 Thread.sleep(2000);4531 ToolTip1.moveToElement(ele).perform();4532 Thread.sleep(2000);4533 String ToolTipText = ele.getAttribute("title");4534 // Assert.assertEquals(ToolTipText, data);4535 if (ToolTipText.contains(data)) {4536 System.out.println("Tooltip value is: " + ToolTipText);4537 testRunner.testStepResult = true;4538 }4539 } catch (Exception e) {4540 testRunner.stepException = e.getMessage();4541 // testRunner.imagePath = ExtentManager.captureScreen(driver,4542 // System.getProperty("user.dir")+"\\Screenshots\\Failed\\");4543 Log.error("Not able to verify the presence of the element");4544 testRunner.testStepResult = false;4545 }4546 return testRunner.testStepResult;4547 }4548 /*4549 * *****************************************************************************4550 * ***************** Method: verifyGreaterThan4Rows Author: Ashok Description:4551 * verifyGreaterThan4Rows4552 * *****************************************************************************4553 * ****************4554 */4555 public static void verifyGreaterThan4Rows(String object, String data, String pageName, String StepName) {4556 ArrayList<WebElement> listItems;4557 // Create an interface WebElement of the div under div with **class as4558 // facetContainerDiv**4559 try {4560 List<WebElement> tableExist = driver.findElements(By.xpath("//div[@id='schedule-plan-1']"));4561 // Get the count of check boxes4562 List<WebElement> AllRadiobuttons = driver.findElements(4563 By.xpath(".//input[@id='b-earliestDepartureDate' and @name='b.earliestDepartureDate']"));4564 int RowCount = driver4565 .findElements(4566 By.xpath(".//input[@id='b-earliestDepartureDate' and @name='b.earliestDepartureDate']"))4567 .size();4568 if (RowCount > 4) {4569 testRunner.testStepResult = true;4570 return;4571 }4572 } catch (Exception e) {4573 testRunner.stepException = e.getMessage();4574 // testRunner.imagePath = ExtentManager.captureScreen(driver,4575 // System.getProperty("user.dir")+"\\Screenshots\\Failed\\");4576 Log.error("Not able to verify the presence of the element");4577 testRunner.testStepResult = false;4578 }4579 }4580 /*4581 * *****************************************************************************4582 * ***************** Method: verifyEqualTo4Rows Author: Ashok Description:4583 * verifyEqualTo4Rows4584 * *****************************************************************************4585 * ****************4586 */4587 public static void verifyEqualTo4Rows(String object, String data, String pageName, String StepName) {4588 ArrayList<WebElement> listItems;4589 try {4590 List<WebElement> tableExist = driver.findElements(By.xpath("//div[@id='schedule-plan-1']"));4591 // Get the count of check boxes4592 List<WebElement> AllRadiobuttons = driver.findElements(4593 By.xpath(".//input[@id='b-earliestDepartureDate' and @name='b.earliestDepartureDate']"));4594 int RowCount = driver4595 .findElements(4596 By.xpath(".//input[@id='b-earliestDepartureDate' and @name='b.earliestDepartureDate']"))4597 .size();4598 if (RowCount == 4) {4599 testRunner.testStepResult = true;4600 return;4601 }4602 } catch (Exception e) {4603 testRunner.stepException = e.getMessage();4604 // testRunner.imagePath = ExtentManager.captureScreen(driver,4605 // System.getProperty("user.dir")+"\\Screenshots\\Failed\\");4606 Log.error("Not able to verify the presence of the element");4607 testRunner.testStepResult = false;4608 }4609 }4610 /*4611 * *****************************************************************************4612 * ***************** Method: verifyNotSelected Author: Ashok Description:4613 * verifyNotSelected4614 * *****************************************************************************4615 * ****************4616 */4617 public static void verifyNotSelected(String dpdn, String data, String pageName, String stepName) {4618 try {4619 log_testActions.info(stepName);4620 WebElement dpdnEle = getObject(getObjectLocator(dpdn));4621 Select selectDPDN = new Select(dpdnEle);4622 String selectedOptiion = selectDPDN.getFirstSelectedOption().getText();4623 if (!selectedOptiion.contains(data)) {4624 testRunner.testStepResult = true;4625 }4626 else {4627 testRunner.testStepResult = false;4628 }4629 } catch (Exception e) {4630 testRunner.stepException = e.getMessage();4631 log_testActions.error("Not able to select --- " + testRunner.stepException);4632 testRunner.testStepResult = false;4633 }4634 }4635 /*4636 * *****************************************************************************4637 * ***************** Method: verifyNotExists Author: Ashok Description:4638 * verifyNotExists4639 * *****************************************************************************4640 * ****************4641 */4642 public static void verifyNotExists(String object, String data, String pageName, String StepName) {4643 log_testActions.info("checking Not Exists " + object + " in " + pageName);4644 WebElement ele = null;4645 String actual = null;4646 try {4647 ele = getObject(getObjectLocator(object));4648 if (!ele.isDisplayed()) {4649 testRunner.testStepResult = true;4650 } else {4651 testRunner.testStepResult = false;4652 }4653 }4654 // make pass if element not found4655 catch (NoSuchElementException e) {4656 testRunner.stepException = e.getMessage();4657 // testRunner.imagePath = ExtentManager.CaptureScreen(driver,4658 // System.getProperty("user.dir")+"\\Screenshots\\Failed\\");4659 log_testActions.error(object + " Not able to find. Exception = " + testRunner.stepException);4660 testRunner.testStepResult = true;4661 } catch (Exception e) {4662 testRunner.stepException = e.getMessage();4663 // testRunner.imagePath = ExtentManager.CaptureScreen(driver,4664 // System.getProperty("user.dir")+"\\Screenshots\\Failed\\");4665 log_testActions.error(object + " Not able to Check. Exception = " + testRunner.stepException);4666 testRunner.testStepResult = false;4667 }4668 }4669 /*4670 * *****************************************************************************4671 * ***************** Method: verifySelected Author: Ashok Description:4672 * verifySelected4673 * *****************************************************************************4674 * ****************4675 */4676 public static void verifySelected(String object, String data, String pageName, String StepName) {4677 String eleValue = "";4678 WebElement ele;4679 String searchText = data;4680 try {4681 log_testActions.info("Getting the value of " + object + " in " + pageName);4682 log_testActions.info("Element Found. Getting value of " + object);4683 ele = getObject(getObjectLocator(object));4684 String selectedOption = new Select(getObject(getObjectLocator(object))).getFirstSelectedOption().getText();4685 log_testActions.info("Element value = " + selectedOption);4686 if (selectedOption.contains(data)) {4687 testRunner.testStepResult = true;4688 }4689 } catch (Exception e) {4690 testRunner.stepException = e.getMessage();4691 // testRunner.imagePath = ExtentManager.CaptureScreen(driver,4692 // System.getProperty("user.dir")+"\\Screenshots\\Failed\\");4693 log_testActions.error("Not able to get the value in " + pageName + "--- " + e.getMessage());4694 testRunner.testStepResult = false;4695 }4696 }4697 /*4698 * *****************************************************************************4699 * ***************** Method: verifyListContains Author: Ashok Description:4700 * verifyListContains4701 * *****************************************************************************4702 * ****************4703 */4704 public static void verifyListContains(String object, String data, String pageName, String StepName) {4705 log_testActions.info("Before Verifying " + object + " in " + pageName);4706 ArrayList<String> inList;4707 ArrayList<String> outList;4708 ArrayList<WebElement> eleList;4709 String[] inArray;4710 try {4711 if (isTestElementPresent(object)) {4712 inArray = data.split(",");4713 inList = new ArrayList<String>(Arrays.asList(inArray));4714 eleList = (ArrayList<WebElement>) getObjects(getObjectLocator(object));4715 List<WebElement> Options = new Select(getObject(getObjectLocator(object))).getOptions();4716 outList = new ArrayList<String>(Options.size());4717 boolean success = true;4718 for (WebElement ele : Options) {4719 outList.add(ele.getText());4720 }4721 int inListSize = inList.size();4722 int outListSize = outList.size();4723 if (inListSize <= outListSize) {4724 for (int i = 0; i < inListSize; i++) {4725 if (outList.contains(inArray[i])) {4726 log_testActions.info("The inList item = " + inList.get(i) + " Equal to The outList item="4727 + outList.get(i));4728 success = true;4729 i++;4730 } else {4731 log_testActions.info("The inList item = " + inList.get(i)4732 + " Not Equal to The outList item=" + outList.get(i));4733 success = false;4734 break;4735 }4736 }4737 } else {4738 log_testActions.info("The size of inList=" + inListSize + " The size of outList=" + outListSize);4739 success = false;4740 }4741 if (success) {4742 testRunner.testStepResult = true;4743 log_testActions.info("Verifying List of" + object + " in " + pageName + " Success");4744 } else {4745 log_testActions.info("Verifying List of" + object + " in " + pageName + " Fail");4746 testRunner.testStepResult = false;4747 }4748 } else {4749 testRunner.testStepResult = false;4750 log_testActions.info("Verifying " + object + " in " + pageName + " Not found");4751 }4752 } catch (Exception e) {4753 testRunner.stepException = e.getMessage();4754 // testRunner.imagePath = ExtentManager.CaptureScreen(driver,4755 // System.getProperty("user.dir")+"\\Screenshots\\Failed\\");4756 log_testActions.error("Not able to verify the presence of the element");4757 testRunner.testStepResult = false;4758 }4759 }4760 /*4761 * *****************************************************************************4762 * ***************** Method: verifyListNotContains Author: Ashok Description:4763 * verifyListNotContains4764 * *****************************************************************************4765 * ****************4766 */4767 public static void verifyListNotContains(String object, String data, String pageName, String StepName) {4768 log_testActions.info("Before Verifying " + object + " in " + pageName);4769 ArrayList<String> inList;4770 ArrayList<String> outList;4771 ArrayList<WebElement> eleList;4772 String[] inArray;4773 try {4774 if (isTestElementPresent(object)) {4775 inArray = data.split(",");4776 inList = new ArrayList<String>(Arrays.asList(inArray));4777 eleList = (ArrayList<WebElement>) getObjects(getObjectLocator(object));4778 List<WebElement> Options = new Select(getObject(getObjectLocator(object))).getOptions();4779 outList = new ArrayList<String>(Options.size());4780 boolean success = true;4781 for (WebElement ele : Options) {4782 outList.add(ele.getText());4783 }4784 int inListSize = inList.size();4785 int outListSize = outList.size();4786 if (inListSize <= outListSize) {4787 for (int i = 0; i < inListSize; i++) {4788 if (!outList.contains(inArray[i])) {4789 log_testActions.info("The inList item = " + inList.get(i) + " Equal to The outList item="4790 + outList.get(i));4791 success = true;4792 i++;4793 } else {4794 log_testActions.info("The inList item = " + inList.get(i)4795 + " Not Equal to The outList item=" + outList.get(i));4796 success = false;4797 break;4798 }4799 }4800 } else {4801 log_testActions.info("The size of inList=" + inListSize + " The size of outList=" + outListSize);4802 success = false;4803 }4804 if (success) {4805 testRunner.testStepResult = true;4806 log_testActions.info("Verifying List of" + object + " in " + pageName + " Success");4807 } else {4808 log_testActions.info("Verifying List of" + object + " in " + pageName + " Fail");4809 testRunner.testStepResult = false;4810 }4811 } else {4812 testRunner.testStepResult = false;4813 log_testActions.info("Verifying " + object + " in " + pageName + " Not found");4814 }4815 } catch (Exception e) {4816 testRunner.stepException = e.getMessage();4817 // testRunner.imagePath = ExtentManager.CaptureScreen(driver,4818 // System.getProperty("user.dir")+"\\Screenshots\\Failed\\");4819 log_testActions.error("Not able to verify the presence of the element");4820 testRunner.testStepResult = false;4821 }4822 }4823 /*4824 * *****************************************************************************4825 * ***************** Method: getCurrentDate Author: Ashok Description:4826 * getCurrentDate4827 * *****************************************************************************4828 * ****************4829 */4830 public static void getCurrentDate(String object, String data, String pageName, String StepName) {4831 log_testActions.info("Setting Current date " + object + " in " + pageName);4832 WebElement ele = null;4833 try {4834 ele = getObject(getObjectLocator(object));4835 if (data.equals("currdate")) {4836 SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");4837 Date todayDate = Calendar.getInstance().getTime();4838 String todayDateString = formatter.format(todayDate);4839 ele.sendKeys(todayDateString);4840 Thread.sleep(1000);4841 testRunner.testStepResult = true;4842 } else {4843 testRunner.testStepResult = false;4844 }4845 }4846 // make pass if element not found4847 catch (NoSuchElementException e) {4848 testRunner.stepException = e.getMessage();4849 // testRunner.imagePath = ExtentManager.CaptureScreen(driver,4850 // System.getProperty("user.dir")+"\\Screenshots\\Failed\\");4851 log_testActions.error(object + " Not able to find. Exception = " + testRunner.stepException);4852 testRunner.testStepResult = true;4853 } catch (Exception e) {4854 testRunner.stepException = e.getMessage();4855 // testRunner.imagePath = ExtentManager.CaptureScreen(driver,4856 // System.getProperty("user.dir")+"\\Screenshots\\Failed\\");4857 log_testActions.error(object + " Not able to Check. Exception = " + testRunner.stepException);4858 testRunner.testStepResult = false;4859 }4860 }4861 private static String getOrdinal(int n) throws Exception {4862 try {4863 if (n >= 11 && n <= 13) {4864 return n + "th";4865 }4866 switch (n % 10) {4867 case 1:4868 return n + "st";4869 case 2:4870 return n + "nd";4871 case 3:4872 return n + "rd";4873 default:4874 return n + "th";4875 }4876 } catch (Exception e) {4877 System.out.println(e.getMessage());4878 return "Fail";4879 }4880 }4881 /*4882 * *****************************************************************************4883 * ***************** Method: selectlinkTypeDropdown Author: Ashok Description:4884 * selectlinkTypeDropdown4885 * *****************************************************************************4886 * ****************4887 */4888 public void selectlinkTypeDropdown(String object, String data, String pageName, String StepName) {4889 try {4890 List<WebElement> options = (List<WebElement>) getObject(getObjectLocator(object));4891 // Loop through the options and select the one that matches4892 for (WebElement opt : options) {4893 if (opt.getText().contains(data)) {4894 opt.click();4895 return;4896 }4897 }4898 } catch (Exception e) {4899 testRunner.stepException = e.getMessage();4900 // testRunner.imagePath = ExtentManager.CaptureScreen(driver,4901 // System.getProperty("user.dir")+"\\Screenshots\\Failed\\");4902 log_testActions.error("Not able to enter the text in " + pageName + "--- " + e.getMessage());4903 testRunner.testStepResult = false;4904 }4905 throw new NoSuchElementException("Can't find " + data + " in dropdown");4906 }4907 public static String getCurrentTimeStamp() {4908 SimpleDateFormat formDate = new SimpleDateFormat("dd/MM/yyyy");4909 String strDate = formDate.format(new Date()); // option 24910 constants.Current_Date = strDate;4911 return constants.Current_Date;4912 }4913 /*4914 * *****************************************************************************4915 * ***************** Method: verifyPageUrl Author: Ashok Description:4916 * verifyPageUrl4917 * *****************************************************************************4918 * ****************4919 */4920 public static void verifyPageUrl(String object, String data, String pageName, String StepName) {4921 String expPageUrl = data;4922 try {4923 String pageTitle = driver.getTitle();4924 if (pageTitle.contains("Certificate") || pageTitle.contains("Certificate")) {4925 javaClick("lnk_CertificateErrorIE", "", "", "Click on continue certificate error");4926 Thread.sleep(5000);4927 }4928 if (pageTitle.contains("Acceptable Usage Policy")) {4929 javaClick("btn_IAcceptError", "", "", "Click on I Accept Button");4930 Thread.sleep(5000);4931 }4932 String actualpageUrl = driver.getCurrentUrl();4933 if (actualpageUrl.contains(expPageUrl)) {4934 Thread.sleep(2000);4935 System.out.println("Current page Url is: " + actualpageUrl);4936 testRunner.testStepResult = true;4937 return;4938 } else {4939 testRunner.testStepResult = false;4940 return;4941 }4942 } catch (Exception e) {4943 //testRunner.stepException = e.getMessage();4944 Log.error("Not able to verify the presence of the element");4945 testRunner.testStepResult = false;4946 }4947 }4948 /*4949 * *****************************************************************************4950 * ***************** Method: verifyPageLink Author: Ashok Description:4951 * verifyPageLink4952 * *****************************************************************************4953 * ****************4954 */4955 public static boolean verifyPageLink(String object, String data, String pageName, String StepName) {4956 WebElement ele = null;4957 try {4958 String actual;4959 String expectedPageLinkXpath = "//a[contains(text(),'" + data + "')]";4960 boolean actualResult = driver.findElement(By.xpath(expectedPageLinkXpath)).isDisplayed();4961 if (actualResult == true) {4962 testRunner.testStepResult = true;4963 log_testActions.info("Expected =" + data + " link is displayed");4964 return true;4965 } else {4966 testRunner.testStepResult = false;4967 log_testActions.info("Expected =" + data + " link is Not displayed");4968 return false;4969 }4970 } catch (Exception e) {4971 testRunner.stepException = e.getMessage();4972 // testRunner.imagePath = ExtentManager.CaptureScreen(driver,4973 // System.getProperty("user.dir")+"\\Screenshots\\Failed\\");4974 log_testActions.error("Not able to compareValue");4975 testRunner.testStepResult = false;4976 return false;4977 }4978 }4979 /*4980 * *****************************************************************************4981 * ***************** Method: selectRateLookUpRateCaluculationDate Author: Ashok4982 * Description: selectRateLookUpRateCaluculationDate4983 * *****************************************************************************4984 * ****************4985 */4986 public static void selectRateLookUpRateCaluculationDate(String object, String data, String pageName,4987 String StepName) throws ParseException {4988 WebElement ele = null;4989 String newDateString = null;4990 int NumberToBeincrease;4991 String[] objectdata = object.split(";");4992 String dateWidget = objectdata[0];4993 String monthField = objectdata[1];4994 String yearField = objectdata[2];4995 String testData[] = data.split(";");4996 String effectedMode = testData[0];4997 if (!effectedMode.equalsIgnoreCase("specificdate")) {4998 NumberToBeincrease = Integer.parseInt(testData[1]);4999 } else {5000 NumberToBeincrease = 0;5001 }5002 String dateTobeEntered = testData[2];5003 SimpleDateFormat formatter = new SimpleDateFormat("dd/MMM/yyyy");5004 Date todayDate = Calendar.getInstance().getTime();5005 String todayDateString = formatter.format(todayDate);5006 System.out.println(todayDateString);5007 Calendar c = Calendar.getInstance();5008 c.setTime(formatter.parse(todayDateString));5009 if (effectedMode.contains("days")) {5010 c.add(Calendar.DATE, NumberToBeincrease); // number of days to add5011 newDateString = formatter.format(c.getTime());5012 }5013 if (effectedMode.contains("month"))// number of months to add5014 {5015 c.add(Calendar.MONTH, NumberToBeincrease); // number of years to add5016 newDateString = formatter.format(c.getTime());5017 }5018 if (effectedMode.contains("year")) {5019 c.add(Calendar.YEAR, NumberToBeincrease); // number of years to add5020 newDateString = formatter.format(c.getTime());5021 }5022 if (effectedMode.contains("currDate")) {5023 newDateString = todayDateString;5024 }5025 if (effectedMode.contains("specificdate")) {5026 newDateString = dateTobeEntered;5027 }5028 System.out.println(newDateString);5029 String dateformat[] = newDateString.split("/");5030 int dateValue = Integer.parseInt(dateformat[0]);5031 String monthValue = dateformat[1];5032 String yearValue = dateformat[2];5033 String newdatelinkXpath = "//a[text()='" + dateValue + "']";5034 try {5035 ((JavascriptExecutor) driver).executeScript("window.scrollTo(document.body.scrollHeight, 0)");5036 WebElement dropdown = getObject(getObjectLocator(dateWidget));5037 dropdown.click();5038 selectListOption(yearField, yearValue, pageName, StepName);5039 selectListOption(monthField, monthValue, pageName, StepName);5040 ele = driver.findElement(By.xpath(newdatelinkXpath));5041 ele.click();5042 log_testActions.error("We are able select cuurent date plus two weeks date in rate lookup page");5043 }5044 catch (Exception e) {5045 testRunner.stepException = e.getMessage();5046 log_testActions.error("We are not able select cuurent date plus two weeks date in rate lookup page"5047 + pageName + "--- " + e.getMessage());5048 testRunner.testStepResult = false;5049 }5050 }5051 /*5052 * *****************************************************************************5053 * ***************** Method: VerifyCurrentDateTimeInPage Author: Ashok5054 * Description: VerifyCurrentDateTimeInPage5055 * *****************************************************************************5056 * ****************5057 */5058 public static void verifyCurrentDateTimeInPage(String object, String data, String pageName, String StepName) {5059 WebElement ele = null;5060 int style = DateFormat.MEDIUM;5061 String DateLanguageFormate = data;5062 DateFormat formatter;5063 String todayDate = null;5064 String Language = data;5065 Date now = new Date();5066 driver.navigate().refresh();5067 if (Language.contains("Japanese")) {5068 // case "Japanese":5069 formatter = new SimpleDateFormat("dd MMM yyyy", Locale.ENGLISH);5070 todayDate = formatter.format(Calendar.getInstance().getTime());5071 // break;5072 }5073 if (Language.contains("Chinese traditional")) {5074 // case "Chinese traditional":5075 formatter = new SimpleDateFormat("dd MMM yyyy", Locale.ENGLISH);5076 todayDate = formatter.format(Calendar.getInstance().getTime());5077 // break;5078 }5079 if (Language.contains("Chinese Simplified")) {5080 // case "Chinese Simplified":5081 formatter = new SimpleDateFormat("dd MMM yyyy", Locale.ENGLISH);5082 todayDate = formatter.format(Calendar.getInstance().getTime());5083 // break;5084 }5085 if (Language.contains("Korean")) {5086 // case "Korean":5087 formatter = new SimpleDateFormat("dd MMM yyyy", Locale.KOREAN);5088 todayDate = formatter.format(Calendar.getInstance().getTime());5089 // break;5090 }5091 if (Language.contains("Fran")) {5092 formatter = new SimpleDateFormat("dd MMM yyyy", Locale.FRENCH);5093 todayDate = formatter.format(Calendar.getInstance().getTime());5094 // break;5095 }5096 if (Language.contains("Italiano")) {5097 // case "Italiano":5098 formatter = new SimpleDateFormat("dd MMM yyyy", Locale.ITALIAN);5099 todayDate = formatter.format(Calendar.getInstance().getTime());5100 // break;5101 }5102 if (Language.contains("Espa")) {5103 formatter = new SimpleDateFormat("dd MMM yyyy", Locale.FRENCH);5104 todayDate = formatter.format(Calendar.getInstance().getTime());5105 // break;5106 }5107 if (Language.contains("English")) {5108 // case "English":5109 formatter = new SimpleDateFormat("dd MMM yyyy", Locale.ENGLISH);5110 todayDate = formatter.format(Calendar.getInstance().getTime());5111 // break;5112 }5113 String dateFieldXpath = "//*[contains(text(),'" + todayDate + "')]";5114 ele = driver.findElement(By.xpath(dateFieldXpath));5115 String ActualDateDisplayed = ele.getText();5116 if (ActualDateDisplayed.contains(todayDate)) {5117 testRunner.testStepResult = true;5118 testRunner.reportLogger.log(LogStatus.PASS, "Current Date " + ActualDateDisplayed, constants.KEYWORD_PASS);5119 log_testActions.info(5120 "Expected =" + todayDate + " and Actual date is =" + ActualDateDisplayed + "should not changed");5121 testRunner.testStepResult = true;5122 } else {5123 testRunner.testStepResult = false;5124 log_testActions5125 .error("Expected =" + todayDate + " and Actual =" + ActualDateDisplayed + " values Not equal");5126 }5127 return;5128 }5129 /*5130 * *****************************************************************************5131 * ***************** Method: clickPageLinkContains Author: Ashok Description:5132 * clickPageLinkContains5133 * *****************************************************************************5134 * ****************5135 */5136 public static void clickPageLinkContains(String object, String data, String pageName, String StepName)5137 throws Exception {5138 String linkText = data;5139 log_testActions.info("Clicking on Page link " + data + " in " + pageName);5140 System.out.println("Clicking on Page link" + data + " in " + pageName);5141 WebElement element = null;5142 String pageLinkXpath = "//a[contains(text(),'" + linkText + "')]";5143 try {5144 element = driver.findElement(By.xpath(pageLinkXpath));5145 JavascriptExecutor executor = (JavascriptExecutor) driver;5146 executor.executeScript("arguments[0].click();", element);5147 Thread.sleep(3000);5148 log_testActions.info("Clicked on " + object + " in " + pageName + "Success");5149 System.out.println("Clicked on " + object + " in " + pageName + "Success");5150 testRunner.testStepResult = true;5151 }5152 catch (Exception e) {5153 // testRunner.imagePath = ExtentManager.captureScreen(driver,5154 // System.getProperty("user.dir")+"\\Screenshots\\Failed\\");5155 Log.error("Not able to click --- " + e.getMessage());5156 testRunner.testStepResult = false;5157 }5158 }5159 /*5160 * *****************************************************************************5161 * ***************** Method: clickPageLink Author: Ashok Description:5162 * clickPageLink5163 * *****************************************************************************5164 * ****************5165 */5166 public static void clickPageLink(String object, String data, String pageName, String StepName) throws Exception {5167 String linkText = data;5168 log_testActions.info("Clicking on Page link " + data + " in " + pageName);5169 System.out.println("Clicking on Page link" + data + " in " + pageName);5170 WebElement element = null;5171 try {5172 element = driver.findElement(By.xpath("//a[contains(text(),'" + linkText + "')]"));5173 JavascriptExecutor executor = (JavascriptExecutor) driver;5174 executor.executeScript("arguments[0].click();", element);5175 Thread.sleep(3000);5176 log_testActions.info("Clicked on " + object + " in " + pageName + "Success");5177 System.out.println("Clicked on " + object + " in " + pageName + "Success");5178 testRunner.testStepResult = true;5179 }5180 catch (Exception e) {5181 // testRunner.imagePath = ExtentManager.captureScreen(driver,5182 // System.getProperty("user.dir")+"\\Screenshots\\Failed\\");5183 Log.error("Not able to click --- " + e.getMessage());5184 testRunner.testStepResult = false;5185 }5186 }5187 /*5188 * *****************************************************************************5189 * ***************** Method: doubleClick Author: Ashok Description: doubleClick5190 * *****************************************************************************5191 * ****************5192 */5193 public static void doubleClick(String object, String data, String pageName, String StepName) throws Exception {5194 log_testActions.info("Clicking on " + object + " in " + pageName);5195 System.out.println("Clicking on " + object + " in " + pageName);5196 WebElement element = null;5197 element = getObject(getObjectLocator(object));5198 try {5199 Actions action = new Actions(driver).doubleClick(element);5200 action.build().perform();5201 testRunner.testStepResult = true;5202 System.out.println("Double clicked the element");5203 } catch (StaleElementReferenceException e) {5204 System.out.println("Element is not attached to the page document " + e.getStackTrace());5205 testRunner.testStepResult = false;5206 } catch (NoSuchElementException e) {5207 System.out.println("Element " + object + " was not found in DOM " + e.getStackTrace());5208 testRunner.testStepResult = false;5209 } catch (Exception e) {5210 System.out.println("Element " + object + " was not clickable " + e.getStackTrace());5211 testRunner.testStepResult = false;5212 }5213 }5214 /*5215 * *****************************************************************************5216 * ***************** Method: getRowsOrColCount Author: Ashok Description:5217 * getRowsOrColCount5218 * *****************************************************************************5219 * ****************5220 */5221 public static String getRowsOrColCount(String object, String data, String pageName, String StepName)5222 throws Exception {5223 String eleValue = "";5224 List<WebElement> rows = null;5225 List<WebElement> cols = null;5226 String[] testdata = data.split("~");5227 String countType = testdata[0];5228 String expectedCount = testdata[1];5229 int expectedCount1 = Integer.parseInt(expectedCount);5230 int RowCount;5231 int ColCount;5232 WebElement htmltable = getObject(getObjectLocator(object));5233 try {5234 log_testActions.info("Getting the value of " + object + " in " + pageName);5235 if (countType.contains("RowCount")) {5236 rows = htmltable.findElements(By.tagName("tr"));5237 RowCount = rows.size();5238 if (RowCount <= expectedCount1)5239 testRunner.testStepResult = true;5240 }5241 if (countType.contains("ColCount")) {5242 rows = htmltable.findElements(By.tagName("td"));5243 ColCount = cols.size();5244 if (ColCount <= expectedCount1)5245 testRunner.testStepResult = true;5246 }5247 } catch (Exception e) {5248 testRunner.stepException = e.getMessage();5249 // testRunner.imagePath = ExtentManager.CaptureScreen(driver,5250 // System.getProperty("user.dir")+"\\Screenshots\\Failed\\");5251 log_testActions.error("Not able to get the value in " + pageName + "--- " + e.getMessage());5252 testRunner.testStepResult = false;5253 }5254 return eleValue;5255 }5256 /*5257 * *****************************************************************************5258 * ***************** Method: changeToLanguage Author: Ashok Description:5259 * changeToLanguage5260 * *****************************************************************************5261 * ****************5262 */5263 public static void changeToLanguage(String object, String data, String pageName, String StepName) {5264 WebElement ele = null;5265 try {5266 Actions ToolTip1 = new Actions(driver);5267 ele = getObject(getObjectLocator(object));5268 Thread.sleep(2000);5269 /* ToolTip1.moveToElement(ele).perform(); */5270 javaClick("Maersk_SSP_lnk_languages", "", "HomePage", "Click on nav Language");5271 javaClick("Maersk_SSP_lnk_English", "", "HomePage", "Click on nav Language");5272 /*5273 * String languageLinkXpath="//a[contains(text(),'" + data +"')]";5274 * 5275 * WebElement LanguageElement = driver.findElement(By.xpath(languageLinkXpath));5276 * 5277 * LanguageElement.click();5278 */5279 Thread.sleep(2000);5280 System.out.println("Language is changed to " + data);5281 testRunner.testStepResult = true;5282 testRunner.reportLogger.log(LogStatus.PASS, "Apllication language is changed to " + data,5283 constants.KEYWORD_PASS);5284 return;5285 } catch (Exception e) {5286 // testRunner.imagePath = ExtentManager.captureScreen(driver,5287 // System.getProperty("user.dir")+"\\Screenshots\\Failed\\");5288 Log.error("Not able to verify the presence of the element");5289 testRunner.testStepResult = false;5290 }5291 }5292 /*5293 * *****************************************************************************5294 * ***************** Method: selectListValue Author: Ashok Description:5295 * selectListValue5296 * *****************************************************************************5297 * ***************5298 */5299 public static void selectListValue(String object, String data, String pageName, String stepName) throws Exception {5300 String[] testData = data.split(";");5301 String[] objectData = object.split(";");5302 String dpdnElement = objectData[0];5303 String dpdnTextBox = objectData[1];5304 String invalue1 = testData[0];5305 String inValue2 = testData[1];5306 String dpdnName = testData[2]; // String dpdnElement,String5307 // dpdnTextBox,String invalue1,String5308 // inValue2,String pageName,String5309 // dpdnName5310 String dpdnListValue;5311 String input = invalue1;5312 /*5313 * if(inValue2.length()==0) {5314 * 5315 */5316 try {5317 ScrollByPixel("", "down", "", "");5318 if (dpdnName.equals("Commodity") || dpdnName.equalsIgnoreCase("Other")5319 || dpdnName.equalsIgnoreCase("country")) {5320 dpdnListValue = "Xpath;//*[text()='" + input + "']/parent::div";5321 }5322 else if (dpdnName.equalsIgnoreCase("ContractPerson")) {5323 dpdnListValue = "Xpath;//*[@class='select2-match' and contains(text(),'" + input + "')]";5324 } else if (dpdnName.equals("ContainerType")) {5325 String conCategory = input.split("-")[0];5326 String conSizeType = input.split("-")[1];5327 String conSize = conSizeType.substring(0, 2);5328 String conType = conSizeType.substring(4);5329 input = conSizeType;5330 if (conCategory.contains("Shipper")) {5331 if (conType.contains("Reefer"))5332 dpdnListValue = "Xpath;//optgroup[contains(@class,'shippersownReefer')]/option[contains(text(),'"5333 + conSize + "') and contains(text(),'" + conType + "')]";5334 else5335 dpdnListValue = "Xpath;//optgroup[contains(@class,'shippersown')]/option[contains(text(),'"5336 + conSize + "') and contains(text(),'" + conType + "')]";5337 } else {5338 dpdnListValue = "Xpath;//div[contains(text(),'" + conCategory + "')]/parent::li";5339 }5340 } else if (dpdnName.equalsIgnoreCase("country") || dpdnName.equalsIgnoreCase("featurelist")) {5341 dpdnListValue = "Xpath;//*[text()='" + input + "']/parent::div";5342 }5343 else {5344 dpdnListValue = "Xpath;//*[text()='" + input + "']/parent::div[text()='" + inValue2 + "']";5345 }5346 // clickElement(dpdnElement, "", pageName, "Click on " + dpdnName + "5347 // dropdown");5348 // input(dpdnTextBox, input, pageName, "Enter value in " + dpdnName + "5349 // textbox");5350 // clickElement(dpdnListValue, "", pageName, "Select value " + dpdnName + "5351 // dropdown");5352 // WebElement dropdown = getObject(getObjectLocator(dpdnElement));5353 WebElement dropdown = getObject(getObjectLocator(dpdnElement));5354 dropdown.click();5355 Thread.sleep(2000);5356 input(dpdnTextBox, input, pageName, "Enter value in " + dpdnName + " textbox");5357 Thread.sleep(2000);5358 WebElement lsitvalue = getObject(getObjectLocator(dpdnListValue));5359 lsitvalue.click();5360 // if (dpdnName.equals("From"))5361 // {5362 ScrollByPixel("", "down", "", "");5363 // }5364 } catch (Exception e) {5365 testRunner.stepException = e.getMessage();5366 log_testActions.error("Not able to verify the presence of the element");5367 testRunner.testStepResult = false;5368 }5369 }5370 /*5371 * *****************************************************************************5372 * ***************** Method: isDisplayed Author: Ashok Description: used to5373 * verify the WebElement is Dispalyed5374 * *****************************************************************************5375 * ****************5376 */5377 public static boolean isDisplayed(String object, String data, String pageName, String StepName) {5378 log_testActions.info("Before Verifying " + object + " in " + pageName);5379 WebElement element = null;5380 String locator=null;5381 String value=null;5382 boolean result;5383 //waitForVisible(object);5384 try {5385 String sspPropertyObject = ObjectReader.OR.getProperty(object); 5386 String[] getPropertyObject = sspPropertyObject.split(";");5387 String path = getPropertyObject[0];5388 String locatorValue = getPropertyObject[1];5389 //element = getObject(getObjectLocator(object));5390 5391 if(path.equalsIgnoreCase("Id"))5392 {5393 result = driver.findElement(By.id(locatorValue)).isDisplayed();5394 }5395 else5396 {5397 result = driver.findElement(By.xpath(locatorValue)).isDisplayed();5398 }5399 5400 5401 5402 5403 //result = element.isDisplayed();5404 5405 5406 if (result == true) {5407 5408 System.out.println("Element is displayed");5409 log_testActions.info("Verifying " + object + " in " + pageName + " is displayed");5410 System.out.println("Verifying " + object + " in " + pageName + " is displayed");5411 testRunner.testStepResult = true;5412 return true;5413 } else {5414 System.out.println("Element is Not displayed");5415 log_testActions.info("Verifying " + object + " in " + pageName + " Not displayed");5416 System.out.println("Verifying " + object + " in " + pageName + " Not displayed");5417 testRunner.testStepResult = false;5418 return false;5419 }5420 } catch (Exception e) {5421 testRunner.stepException = e.getMessage();5422 log_testActions.error("Not able to verify the presence of the element");5423 testRunner.testStepResult = false;5424 return false;5425 }5426 }5427 /*5428 * *****************************************************************************5429 * ***************** Method: isNotDisplayed Author: Ashok Description: used to5430 * verify the WebElement is Not Dispalyed5431 * *****************************************************************************5432 * ****************5433 */5434 public static void isNotDisplayed(String object, String data, String pageName, String StepName) {5435 log_testActions.info("Before Verifying " + object + " in " + pageName);5436 List<WebElement> ListElement;5437 boolean ElementLocation;5438 int noOfElementsFound = 0;5439 try {5440 // element=getObject(getObjectLocator(object));5441 if (!isTestElementPresent(object)) {5442 // ElementLocation=driver.findElement(getObjectLocator(object));5443 // noOfElementsFound=ListElement.size();5444 // ElementLocation=driver.findElement(getObjectLocator(object)).isDisplayed();5445 testRunner.testStepResult = true;5446 log_testActions.info("Verifying " + object + " in " + pageName + " is Not displayed");5447 System.out.println("Verifying " + object + " in " + pageName + " is Not displayed");5448 }5449 if (!data.isEmpty())5450 {5451 ListElement = driver.findElements(By.xpath("//*[contains(text(),'" + data + "')]"));5452 noOfElementsFound = ListElement.size();5453 if (noOfElementsFound == 0) {5454 testRunner.testStepResult = true;5455 log_testActions.info("Verifying " + object + " in " + pageName + " is Not displayed");5456 System.out.println("Verifying " + object + " in " + pageName + " is Not displayed");5457 // return true;5458 } else {5459 testRunner.testStepResult = false;5460 log_testActions.info("Verifying " + object + " in " + pageName + " is displayed");5461 System.out.println("Verifying " + object + " in " + pageName + " is displayed");5462 // return false;5463 }5464 }5465 } catch (Exception e) {5466 testRunner.stepException = e.getMessage();5467 log_testActions.error("Not able to verify the presence of the element");5468 testRunner.testStepResult = false;5469 // return false;5470 }5471 }5472 /*5473 * *****************************************************************************5474 * ***************** Method: bookingFirstPageMCC Author: Ashok Description:5475 * bookingFirstPageMCC5476 * *****************************************************************************5477 * ****************5478 */5479 public static void bookingFirstPageMCC(String object, String data, String pageName, String StepName)5480 throws Exception {5481 try {5482 String[] testData = data.split(";");5483 String[] objectData = object.split(";");5484 int length = testData.length;5485 log_testActions.info("Before napBooking ");5486 String fromValue1 = testData[0];5487 String fromValue2 = testData[1];5488 String toValue1 = testData[2];5489 String toValue2 = testData[3];5490 String conType = testData[4];5491 String commValue = testData[5];5492 String contCount = testData[6];5493 String conTypeValue = testData[7];5494 String weight = testData[8];5495 String contractTariff = testData[9];5496 // String contactPerson = testData[10];5497 String reference = testData[10];5498 String exportType = testData[11];5499 String importType = testData[12];5500 /*5501 * String menuBook=objectData[0]; String subBook=objectData[1]; String5502 * cityFrom=objectData[0]; String cityTo=objectData[0]; String5503 * menuBook=objectData[0]; String menuBook=objectData[0]; String5504 * menuBook=objectData[0]; String menuBook=objectData[0]; String5505 * menuBook=objectData[0]; String menuBook=objectData[0];5506 */5507 // navigateMenu("Maersk_SSP_Menu_BOOK;Maersk_SSP_subMenu_NewBookShipment","BOOK~New5508 // BookShipment","Booking_Page","Nvaigate to new Booking page");5509 if (testRunner.testName.contains("_MML_")) {5510 // IGNnavigateMenu("Maersk_SSP_IGN_btn_Book;Maersk_SSP_IGN_lnk_BookNewShipment","BOOK~New5511 // BookShipment","Booking_Page","Nvaigate to new Booking page");5512 } else {5513 /*5514 * navigateToUrl("", "https://myt.apmoller.net/shipmentbinder/", "Booking_Page",5515 * "navigated to new booking page");5516 */5517 // navigateMenu("Maersk_SSP_Menu_BOOK;Maersk_SSP_subMenu_NewBookShipment","BOOK~New5518 // BookShipment","Booking_Page","Nvaigate to new Booking page");5519 }5520 waitForVisible("txt_BookingPage1");5521 compareValue("txt_BookingPage1", "Book New Shipments", "Booking_Page", "Verify Booking Page");5522 selectDPDNValue("dpdn_From_BP", "txtbx_From_BP", fromValue1, fromValue2, "Booking_Page", "From");5523 log_testActions.info(" From Address Selected as = " + fromValue1);5524 selectDPDNValue("dpdn_To_BP", "txtbx_To_BP", toValue1, toValue2, "Booking_Page", "To");5525 log_testActions.info(" To Address Selected as = " + toValue1);5526 selectRateLookUpRateCaluculationDate(5527 "Maersk_SSP_txtbx_DepartureDate;Maersk_SSP_lst_DepartureMonth;Maersk_SSP_lst_DepartureYear",5528 "days;1;No", "Booking_Page", "");5529 selectDPDNValue("dpdn_Commodity_BP", "txtbx_Commodity_BP", commValue, "", "Booking_Page", "Commodity");5530 selectDPDNValue("dpdn_Container_BP", "txtbx_Container_BP", conTypeValue, "", "Booking_Page",5531 "ContainerType");5532 input("txtbx_Weight_BP", weight, "Booking_Page", "Enter weight");5533 clickElement("Maersk_SSP_chk_iamPriceOwner", "", "Booking_Page", "Click on iam price owner check box");5534 // input("txtbx_contract_BP", contractTariff, pageName, StepName);5535 selectOptionUsingPartialText("Maersk_SSP_lst_PriceOwner", "Gcss Booked By, Copenhagen", pageName, StepName);5536 // javaClick("btn_Continue_Book", "", pageName, StepName);5537 testRunner.testStepResult = true;5538 } catch (Exception ex) {5539 log_testActions.info(" napBooking Failure. Exception = " + ex.getMessage());5540 testRunner.testStepResult = false;5541 }5542 }5543 /*5544 * *****************************************************************************5545 * ***************** Method: verifyWebElementAttributeValue Author: Ashok5546 * Description: verifyWebElementAttributeValue5547 * *****************************************************************************5548 * ****************5549 */5550 public static void verifyWebElementAttributeValue(String object, String data, String pageName, String StepName) {5551 WebElement ele = null;5552 String expectedAttributrValue = data;5553 String ActualAttributeValue = null;5554 log_testActions.info("Before compareValue " + object + " in " + pageName);5555 try {5556 ele = getObject(getObjectLocator(object));5557 ActualAttributeValue = ele.getAttribute("value");5558 /*5559 * if(data.equals("Empty")){ ActualAttributeValue.isEmpty();5560 * testRunner.testStepResult=true; }else if(!data.contains("Empty")){5561 * if(data.contains("currDate")){ expectedAttributrValue=constants.Current_Date;5562 * }5563 */5564 if (ActualAttributeValue.contains(expectedAttributrValue)) {5565 testRunner.testStepResult = true;5566 }5567 } catch (Exception e) {5568 testRunner.stepException = e.getMessage();5569 log_testActions.error("Not able to compareValue");5570 testRunner.testStepResult = false;5571 }5572 }5573 /*5574 ***********************************************************************************************5575 * Method: SwitchToWindow Author: Ashok Description: SwitchToWindow5576 **********************************************************************************************5577 */5578 public static void switchToWindow(String object, String data, String pageName, String StepName) {5579 String expectedWindPageTitle = data;5580 String SecondPageTitle = null;5581 String SecondWindowPageUrl = null;5582 String mainwindow = driver.getWindowHandle(); // get parent(current) window name5583 Set<String> AllHandles = driver.getWindowHandles();5584 ; // switch back to main window & continue further execution5585 try {5586 for (String winHandle : AllHandles) // iterating on child windows5587 {5588 /* if (!winHandle.equals(mainwindow)) */5589 if (driver.switchTo().window(winHandle).getTitle().contains(data)5590 || driver.switchTo().window(winHandle).getTitle().contains("Acceptable Usage Policy")) {5591 // if (driver.switchTo().window(winHandle).getTitle().contains("Acceptable Usage5592 // Policy")) {5593 // javaClick("btn_IAcceptError", "", "", "Click on I Accept Button");5594 //5595 // }5596 String current_url = driver.getCurrentUrl();5597 if (current_url.contains("https://login.zscaler.net")) {5598 Thread.sleep(5000);5599 javaClick("btn_IAcceptError", "", "", "Click on I Accept Button");5600 Thread.sleep(5000);5601 }5602 // System.out.println("Popup values: "+winHandle);5603 // SecondPageTitle=driver.getTitle();5604 //5605 // if(SecondPageTitle.contains(expectedWindPageTitle)) {5606 // System.out.println("Second Window title"+SecondPageTitle);5607 //5608 // testRunner.testStepResult=true;5609 //5610 // }5611 // SecondWindowPageUrl=driver.getCurrentUrl();5612 // System.out.println("Second window url"+SecondWindowPageUrl);5613 driver.close();5614 Thread.sleep(2000);5615 driver.switchTo().window(mainwindow);5616 String mainWindowPageTitle = driver.getTitle();5617 System.out.println("main window url" + mainWindowPageTitle);5618 testRunner.testStepResult = true;5619 }5620 // Perform any operations on child window5621 }5622 } catch (Exception e) {5623 testRunner.stepException = e.getMessage();5624 log_testActions.error("Not able to compareValue");5625 testRunner.testStepResult = false;5626 }5627 }5628 /*5629 ***********************************************************************************************5630 * Method: SwitchToSecondWindow Author: Ashok Description: SwitchToSecondWindow5631 **********************************************************************************************5632 */5633 public static void switchToSecondWindow(String object, String data, String pageName, String StepName) {5634 String expectedWindPageTitle = data;5635 String SecondPageTitle = null;5636 String SecondWindowPageUrl = null;5637 String mainwindow = driver.getWindowHandle(); // get parent(current) window name5638 Set<String> AllHandles = driver.getWindowHandles();5639 ; // switch back to main window & continue further execution5640 try {5641 for (String winHandle : AllHandles) // iterating on child windows5642 {5643 /* if (!winHandle.equals(mainwindow)) */5644 if (driver.switchTo().window(winHandle).getTitle().contains(data)) {5645 /* driver.switchTo().window(winHandle); */5646 System.out.println("Popup values: " + winHandle);5647 SecondPageTitle = driver.getTitle();5648 System.out.println("Second Window title" + SecondPageTitle);5649 SecondWindowPageUrl = driver.getCurrentUrl();5650 System.out.println("Second window url" + SecondWindowPageUrl);5651 testRunner.testStepResult = true;5652 }5653 // Perform any operations on child window5654 }5655 } catch (Exception e) {5656 testRunner.stepException = e.getMessage();5657 log_testActions.error("Not able to compareValue");5658 testRunner.testStepResult = false;5659 }5660 }5661 /*5662 ***********************************************************************************************5663 * Method: closeWindow Author: Ashok Description: closeWindow5664 **********************************************************************************************5665 */5666 public static void closeWindow(String object, String data, String pageName, String StepName) {5667 String expectedWindPageTitle = data;5668 String SecondPageTitle = null;5669 String SecondWindowPageUrl = null;5670 String mainwindow = driver.getWindowHandle(); // get parent(current) window name5671 Set<String> AllHandles = driver.getWindowHandles();5672 ; // switch back to main window & continue further execution5673 try {5674 for (String winHandle : AllHandles) // iterating on child windows5675 {5676 /* if (!winHandle.equals(mainwindow)) */5677 if (driver.switchTo().window(winHandle).getTitle().contains(data)) {5678 driver.close();5679 driver.switchTo().window(mainwindow);5680 /*5681 * String mainWindowPageTitle=driver.getTitle();5682 * System.out.println("main window url"+mainWindowPageTitle);5683 */5684 testRunner.testStepResult = true;5685 }5686 // Perform any operations on child window5687 }5688 } catch (Exception e) {5689 testRunner.stepException = e.getMessage();5690 log_testActions.error("Not able to compareValue");5691 testRunner.testStepResult = false;5692 }5693 }5694 /*5695 ***********************************************************************************************5696 * Method: SelectTxtboxListValue Author: Ashok Description:5697 * SelectTxtboxListValue5698 **********************************************************************************************5699 */5700 public static void selectTxtboxListValue(String object, String data, String pageName, String stepName)5701 throws Exception {5702 String testData = data;5703 try {5704 WebElement ListTextBoxLocation = getObject(getObjectLocator(object));5705 javaClick(object, testData, pageName, "enter text on " + object + " text box");5706 input(object, testData, pageName, "enter text on " + object + " text box");5707 Thread.sleep(5000);5708 keyPressTab(object, "tab", pageName, "Enter value in " + object + " textbox");5709 Thread.sleep(2000);5710 } catch (Exception e) {5711 testRunner.stepException = e.getMessage();5712 log_testActions.error("Not able to verify the presence of the element");5713 testRunner.testStepResult = false;5714 }5715 }5716 /*5717 ***********************************************************************************************5718 * Method: addIMOdetails Author: Ashok Description: Enter Add IMO Details Page5719 * Values5720 **********************************************************************************************5721 */5722 public static void addIMOdetails(String object, String data, String pageName, String StepName) throws Exception {5723 try {5724 String[] testData = data.split(";");5725 String[] testObject = object.split(";");5726 int lengthData = testData.length;5727 int objectLength = testObject.length;5728 log_testActions.info("Before napBooking ");5729 String imoclasificationObject = testObject[0];5730 String UNorNAnumberObject = testObject[1];5731 String UNnumberObject = testObject[2];5732 String NAnumberObject = testObject[3];5733 String quantityObject = testObject[4];5734 String packingTypeObject = testObject[5];5735 String packingGroupObject = testObject[6];5736 String packQuantityTypeObject = testObject[7];5737 String grossWeightObject = testObject[8];5738 String netWeightObject = testObject[9];5739 // String contactPerson = testObject[10];5740 String properShippingNameObject = testObject[10];5741 String emergencyContactNameObject = testObject[11];5742 String EmergencyContactNum1Object = testObject[12];5743 String EmergencyContactNum2Object = testObject[13];5744 String imoclasification = testData[0];5745 String UNorNAnumber = testData[1];5746 String UNnumber = testData[2];5747 String NAnumber = testData[3];5748 String quantity = testData[4];5749 String packingType = testData[5];5750 String packingGroup = testData[6];5751 String packQuantityType = testData[7];5752 String grossWeight = testData[8];5753 String netWeight = testData[9];5754 // String contactPerson = testData[10];5755 String properShippingName = testData[10];5756 String emergencyContactName = testData[11];5757 String EmergencyContactNum1 = testData[12];5758 String EmergencyContactNum2 = testData[13];5759 selectOptionUsingPartialText(imoclasificationObject, imoclasification, "AddIMO_Page",5760 "Select Imo clasification Type");5761 selectOptionUsingPartialText(UNorNAnumberObject, UNorNAnumber, "AddIMO_Page",5762 "Select Imo clasification Type");5763 if (UNnumberObject.equalsIgnoreCase("yes")) {5764 javaClick(UNnumberObject, "", "AddIMOPage", "Select UN number");5765 } else {5766 javaClick(NAnumberObject, "", "AddIMOPage", "Select UN number");5767 }5768 input(quantityObject, quantity, "AddIMOPage", "Enter Quantity");5769 selectOptionUsingPartialText(packingTypeObject, packingType, "AddIMO_Page", "Select Imo packingType ");5770 selectOption(packingGroupObject, packingGroup, "AddIMO_Page", "Select Imo packingGroup ");5771 selectOption(packQuantityTypeObject, packQuantityType, "AddIMO_Page", "Select Imo packingGroup ");5772 input(grossWeightObject, grossWeight, "AddIMOPage", "Enter Gross Weight");5773 input(netWeightObject, netWeight, "AddIMOPage", "Enter Net Weight");5774 input(properShippingNameObject, properShippingName, "AddIMOPage", "Enter properShippingName");5775 input(emergencyContactNameObject, emergencyContactName, "AddIMOPage", "Enter emergencyContactName");5776 input(EmergencyContactNum1Object, EmergencyContactNum1, "AddIMOPage", "Enter EmergencyContactNum1");5777 input(EmergencyContactNum2Object, EmergencyContactNum2, "AddIMOPage", "Enter EmergencyContactNum2");5778 testRunner.testStepResult = true;5779 } catch (Exception ex) {5780 log_testActions.info(" napBooking Failure. Exception = " + ex.getMessage());5781 testRunner.testStepResult = false;5782 }5783 }5784 /*5785 * *****************************************************************************5786 * ***************** Method: isFileDownloaded Author: Abhimanyu Ramanandan5787 * Description: Method is used to check the file is downloaded5788 * *****************************************************************************...

Full Screen

Full Screen

Source:Loan_AgeStore_ProcessDeposit_Nacha_DepositShouldPost.java Github

copy

Full Screen

1package Tests.PDL;2import org.testng.annotations.AfterClass;3import org.testng.annotations.AfterMethod;4import org.testng.annotations.Test;5import org.testng.annotations.BeforeClass;6import java.io.File;7import java.io.IOException;8//import java.sql.Time;9import java.text.DateFormat;10//import java.sql.Timestamp;11import java.text.SimpleDateFormat;12import java.util.Calendar;13import java.util.Date;14//import java.util.Iterator;15import java.util.List;16import java.util.Random;17//import java.util.Set;18//import java.util.NoSuchElementException;19import java.util.concurrent.TimeUnit;20//import Pages.HomePage;21//import Pages.BasePage;22import org.apache.commons.io.FileUtils;23import org.openqa.selenium.Alert;24//import org.apache.poi.hssf.usermodel.HSSFRow;25//import org.apache.poi.ss.usermodel.Cell;26//import org.apache.poi.ss.usermodel.CellType;27import org.openqa.selenium.By;28//import org.openqa.selenium.JavascriptException;29import org.openqa.selenium.NoAlertPresentException;30import org.openqa.selenium.OutputType;31import org.openqa.selenium.TakesScreenshot;32//import org.openqa.selenium.UnhandledAlertException;33import org.openqa.selenium.WebDriver;34import org.openqa.selenium.WebElement;35//import org.openqa.selenium.WebElement;36//import org.openqa.selenium.WebElement;37//import org.openqa.selenium.chrome.ChromeDriver;38import org.openqa.selenium.ie.InternetExplorerDriver;39import org.openqa.selenium.interactions.Actions;40import org.openqa.selenium.support.ui.ExpectedConditions;41//import org.openqa.selenium.support.ui.FluentWait;42//import org.openqa.selenium.support.ui.ExpectedConditions;43import org.openqa.selenium.support.ui.Select;44//import org.openqa.selenium.support.ui.FluentWait;45//import org.openqa.selenium.support.ui.Wait;46import org.openqa.selenium.support.ui.WebDriverWait;47//import org.testng.Assert;48//import org.testng.Assert;49import org.testng.annotations.AfterClass;50import org.testng.annotations.AfterTest;51import org.testng.annotations.BeforeClass;52import org.testng.annotations.BeforeTest;53import org.testng.annotations.Test;54import com.relevantcodes.extentreports.ExtentReports;55import com.relevantcodes.extentreports.ExtentTest;56import com.relevantcodes.extentreports.LogStatus;57import Pages.BorrowerRegistrationpage;58import Pages.CSRLoginpage;59import Utilities.ExtentReports.Excel;60 61public class Loan_AgeStore_ProcessDeposit_Nacha_DepositShouldPost {62 63 public WebDriverWait wait; 64 WebDriver driver;65 String appUrl;66 static ExtentReports reports;67 ExtentTest test;68 @BeforeClass69 public synchronized void initialize() {70 // Create an instance of ExtentsReports class and pass report storage71 // path as a parameter72 //Timestamp timestamp = new Timestamp(System.currentTimeMillis());73 String timestamp = new SimpleDateFormat("MM.dd.yyyy.HH.mm.ss").format(new Date());74 //Date D = new Date();75 76 String filename="Loan_AgeStore_ProcessDeposit_Nacha_DepositShouldPost_Txn"+timestamp+".html";77 //System.out.print(filename);78 reports = new ExtentReports(System.getProperty("user.dir") + "/ExecutionReports/Loan_AgeStore_ProcessDeposit_Nacha_DepositShouldPost_Txn/"+filename, true);79 //reports = new ExtentReports(System.getProperty("user.dir") + "/ExecutionReports/PDL/ShortListedScenarios.html", true);80 }81 @BeforeTest82 public void setup() throws IOException {83 System.setProperty("webdriver.ie.driver",System.getProperty("user.dir")+"/IEDriverServer.exe");84 //System.setProperty("webdriver.ie.driver","E:/Ncp_Workspace/Selenium/IEDriverServer.exe");85 driver = new InternetExplorerDriver(); 86 //appUrl = "http://192.168.2.203/cc/demoIndex.do";87 }88 //@BeforeTest89 public void Login (String username,String password,String storenumber) {90 91 92 93 //Launch URL94 driver.get(appUrl);95 test.log(LogStatus.INFO, "CSR Application is launched:"+appUrl);96 driver.manage().window().maximize();97 String usenameId = "loginRequestBean.userId";98 String passwordId = "loginRequestBean.password";99 String StoreId = "loginRequestBean.locNbr";100 String Login = "login";101 102 // String username= "CSR353";103 // String password= "1234";104 // String storenumber= "353";105 106 //Enter Username(Email)107 //writeText(By.name(usenameId),username);108 driver.findElement(By.name(usenameId)).sendKeys(username);109 test.log(LogStatus.PASS, "Username is entered: "+username);110 //Enter Password111 //writeText(By.name(passwordId), password);112 driver.findElement(By.name(passwordId)).clear();113 driver.findElement(By.name(passwordId)).sendKeys(password);114 test.log(LogStatus.PASS, "Password is entered: "+password);115 116 //writeText(By.name(StoreId), storenumber);117 driver.findElement(By.name(StoreId)).sendKeys(storenumber);;118 test.log(LogStatus.PASS, "Storenumber is entered: "+storenumber);119 //Click Login Button120 driver.findElement(By.name(Login)).click();121 test.log(LogStatus.PASS, "Clicked on Submit button");122 }123 //if(driver.findElement()124 public void RegistrationPage(String SSN,String FileName) throws Exception{125 126 Excel TestData = new Excel(System.getProperty("user.dir")+"/TestData/PDL/"+FileName); 127 int lastrow=TestData.getLastRow("Borrower_Registration");128 129 String sheetName="Borrower_Registration"; 130 for(int row=2;row<=lastrow;row++)131 { 132 String RegSSN = TestData.getCellData(sheetName,"SSN",row);133 if(SSN.equals(RegSSN))134 { 135 136 String AppURL = TestData.getCellData(sheetName,"AppURL",row);137 //String UserName = TestData.getCellData(sheetName,"UserName",row);138 //String Password = TestData.getCellData(sheetName,"Password",row);139 // System.out.println(Password);140 // String StoreId = TestData.getCellData(sheetName,"StoreID",row);141 // String ProductID = TestData.getCellData(sheetName,"ProductID",row);142 // String StateID = TestData.getCellData(sheetName,"StateID",row);143 // String SSN = TestData.getCellData(sheetName,"SSN",row); 144 //String Header = StateID+ "_" + ProductID; 145 // test = reports.startTest("BorrowerRegistration_"+Header, "Register a Borrower"); 146 String LastName = TestData.getCellData(sheetName,"LastName",row);147 String FirstName = TestData.getCellData(sheetName,"FirstName",row);148 String AddressLine = TestData.getCellData(sheetName,"AddressLine",row);149 String City = TestData.getCellData(sheetName,"City",row);150 String State = TestData.getCellData(sheetName,"State",row); 151 String ZipCode = TestData.getCellData(sheetName,"ZipCode",row);152 String MonthsAtAddress = TestData.getCellData(sheetName,"MonthsAtAddress",row); 153 String Bank_ABARoutingNbr = TestData.getCellData(sheetName,"Bank_ABARoutingNbr",row);154 String Bank_ChkgAcctNbr = TestData.getCellData(sheetName,"Bank_ChkgAcctNbr",row); 155 String Ctc_PrimaryPhone = TestData.getCellData(sheetName,"Ctc_PrimaryPhone",row);156 String Ctc_PhoneType = TestData.getCellData(sheetName,"Ctc_PhoneType",row);157 String Misc_PhotoIDNbr = TestData.getCellData(sheetName,"Misc_PhotoIDNbr",row);158 String Misc_IDExpDate = TestData.getCellData(sheetName,"Misc_IDExpDate",row); 159 String Misc_PhotoIDType = TestData.getCellData(sheetName,"Misc_PhotoIDType",row);160 String BorrDOB = TestData.getCellData(sheetName,"Misc_DOB",row);161 String Income_IncomeType = TestData.getCellData(sheetName,"Income_IncomeType",row);162 String Income_Employer = TestData.getCellData(sheetName,"Income_Employer",row);163 String Income_WorkPhone = TestData.getCellData(sheetName,"Income_WorkPhone",row);164 String Income_NetIncomeAmt = TestData.getCellData(sheetName,"Income_NetIncomeAmt",row);165 String Income_GrossIncome = TestData.getCellData(sheetName,"Income_GrossIncome",row);166 String Income_PayFrequency = TestData.getCellData(sheetName,"Income_PayFrequency",row);167 String Income_HireDt = TestData.getCellData(sheetName,"Income_HireDt",row);168 String Income_DirectDeposit=TestData.getCellData(sheetName,"Income_DirectDeposit",row); 169 String ProductType=TestData.getCellData(sheetName,"ProductType",row);170 /* String PrimaryRef_LastName = TestData.getCellData(sheetName,"PrimaryRef_LastName",row);171 String PrimaryRef_FirstName = TestData.getCellData(sheetName,"PrimaryRef_FirstName",row);172 String PrimaryRef_Relationship = TestData.getCellData(sheetName,"PrimaryRef_Relationship",row);173 String PrimaryRef_PhoneNbr=TestData.getCellData(sheetName,"PrimaryRef_PhoneNbr",row);174 String Ref_LastName = TestData.getCellData(sheetName,"Ref_LastName",row);175 String Ref_FirstName = TestData.getCellData(sheetName,"Ref_FirstName",row);176 String Ref_Relationship = TestData.getCellData(sheetName,"Ref_Relationship",row);177 String Ref_PhoneNbr=TestData.getCellData(sheetName,"Ref_PhoneNbr",row);*/ 178 String Bankruptcy=TestData.getCellData(sheetName,"Bankruptcy",row); 179 test.log(LogStatus.INFO, "Borrower Registration-SSN: " +SSN);180 DateFormat df=new SimpleDateFormat("MM/dd/yyyy");181 String SSN1 = SSN.substring(0, 3);182 String SSN2 = SSN.substring(3,5);183 String SSN3 = SSN.substring(5,9);184 String PP1 = Ctc_PrimaryPhone.substring(0, 3);185 String PP2 = Ctc_PrimaryPhone.substring(3, 6);186 String PP3 = Ctc_PrimaryPhone.substring(6, 10);187 String IncomeP1 = Income_WorkPhone.substring(0, 3);188 String IncomeP2 = Income_WorkPhone.substring(3, 6);189 String IncomeP3 = Income_WorkPhone.substring(6, 10);190 /* String PrimaryRef_PhoneNbr1 = PrimaryRef_PhoneNbr.substring(0, 3);191 String PrimaryRef_PhoneNbr2 = PrimaryRef_PhoneNbr.substring(3, 6);192 String PrimaryRef_PhoneNbr3 = PrimaryRef_PhoneNbr.substring(6, 10);193 String Ref_PhoneNbr1 = Ref_PhoneNbr.substring(0, 3);194 String Ref_PhoneNbr2 = Ref_PhoneNbr.substring(3, 6);195 String Ref_PhoneNbr3 = Ref_PhoneNbr.substring(6, 10);*/ 196 System.out.println(Misc_IDExpDate);197 Date Misc_IDExpDt = df.parse(Misc_IDExpDate);198 String IDExpDate0 =df.format(Misc_IDExpDt); 199 System.out.println(IDExpDate0);200 String IDExpDate[] =IDExpDate0.split("/");201 String IDExpD1 = IDExpDate[0];202 String IDExpD2 = IDExpDate[1];203 String IDExpD3 = IDExpDate[2];204 String DOB[] =BorrDOB.split("/");205 String DOB1 = DOB[0];206 String DOB2 = DOB[1];207 String DOB3 = DOB[2]; 208 appUrl = AppURL;209 // this.Login(UserName, Password, StoreId);210 //driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);211 // Thread.sleep(5000);212 driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);213 WebDriverWait wait = new WebDriverWait(driver, 1000); 214 //wait.until(ExpectedConditions.visibilityOfElementLocated(By.name("topFrame")));215 216 //wait.until(ExpectedConditions.visibilityOfElementLocated(By.name("topFrame")));217 //WebElement ele = driver.findElement(By.name("topFrame"));218 //new Actions(driver).moveToElement(ele).perform();219 driver.switchTo().frame("topFrame");220 //*[@id="900000"]/a221 wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector("li[id='900000']")));222 driver.findElement(By.cssSelector("li[id='900000']")).click();223 /* wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector("li[id='900000']")));224 driver.findElement(By.cssSelector("li[id='900000']")).click(); */225 /* driver.findElement(By.xpath("//*[contains(text(),'Borrower')]")).click(); 226 test.log(LogStatus.PASS, "Clicked on Borrower");*/227 driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);228 driver.switchTo().defaultContent();229 driver.switchTo().frame("mainFrame"); 230 wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("li[id='901000']")));231 driver.findElement(By.cssSelector("li[id='901000']")).click(); 232 test.log(LogStatus.PASS, "Clicked on Registration"); 233 driver.switchTo().frame("main");234 driver.findElement(By.name("customerBean.custProdType")).sendKeys(ProductType);235 test.log(LogStatus.PASS, "ProductType is entered: "+ProductType);236 driver.findElement(By.name("ssn1")).sendKeys(SSN1);237 test.log(LogStatus.PASS, "SSN1 is entered: "+SSN1);238 driver.findElement(By.name("ssn2")).sendKeys(SSN2);239 test.log(LogStatus.PASS, "SSN2 is entered: "+SSN2);240 driver.findElement(By.name("ssn3")).sendKeys(SSN3);241 test.log(LogStatus.PASS, "SSN3 is entered: "+SSN3);242 driver.findElement(By.name("ssn4")).sendKeys(SSN1);243 test.log(LogStatus.PASS, "Confirm SSN1 is entered: "+SSN1);244 driver.findElement(By.name("ssn5")).sendKeys(SSN2);245 test.log(LogStatus.PASS, "Confirm SSN2 is entered: "+SSN2);246 driver.findElement(By.name("ssn6")).sendKeys(SSN3);247 test.log(LogStatus.PASS, "Confirm SSN3 is entered: "+SSN3); 248 driver.findElement(By.name("customerBean.lastNm")).sendKeys(LastName);249 test.log(LogStatus.PASS, "LastName is entered: "+LastName);250 driver.findElement(By.name("customerBean.firstNm")).sendKeys(FirstName);251 test.log(LogStatus.PASS, "FirstName is entered: "+FirstName);252 /*driver.findElement(By.name("customerBean.addressLn")).sendKeys(AddressLine);253 test.log(LogStatus.PASS, "AddressLine is entered: "+AddressLine);254 driver.findElement(By.name("customerBean.city")).sendKeys(City);255 test.log(LogStatus.PASS, "City is entered: "+City);256 driver.findElement(By.name("customerBean.stateCd")).sendKeys(State);257 test.log(LogStatus.PASS, "State is entered: "+State);258 driver.findElement(By.name("customerBean.postalCd")).sendKeys(ZipCode);259 test.log(LogStatus.PASS, "ZipCode is entered: "+ZipCode);260 driver.findElement(By.name("customerBean.sameMailAddress")).click();261 test.log(LogStatus.PASS, "Mailing address is selected as same as above");262 driver.findElement(By.name("customerBean.monthsAtAddress")).sendKeys(MonthsAtAddress);263 test.log(LogStatus.PASS, "MonthsAtAddress is entered: "+MonthsAtAddress); 264 driver.findElement(By.name("customerBean.rentOwnFlg")).sendKeys("Yes");265 test.log(LogStatus.PASS, "Own Residence?* is entered: Yes");*/266 267 268 driver.findElement(By.name("customerBean.mailingAddressLn1")).sendKeys(AddressLine);269 test.log(LogStatus.PASS, "AddressLine is entered: "+AddressLine);270 //Thread.sleep(5000);271 driver.findElement(By.name("customerBean.mailingCity")).sendKeys(City);272 test.log(LogStatus.PASS, "City is entered: "+City);273 driver.findElement(By.name("customerBean.mailingStateCd")).sendKeys(State);274 test.log(LogStatus.PASS, "State is entered: "+State);275 driver.findElement(By.name("customerBean.mailingPostalCd")).sendKeys(ZipCode);276 test.log(LogStatus.PASS, "ZipCode is entered: "+ZipCode);277 driver.findElement(By.name("customerBean.sameMailAddress")).click();278 test.log(LogStatus.PASS, "Mailing address is selected as same as above");279 driver.findElement(By.name("customerBean.monthsAtAddress")).sendKeys(MonthsAtAddress);280 test.log(LogStatus.PASS, "MonthsAtAddress is entered: "+MonthsAtAddress); 281 driver.findElement(By.name("customerBean.rentOwnFlg")).sendKeys("Yes");282 test.log(LogStatus.PASS, "Own Residence?* is entered: Yes");283 driver.findElement(By.name("phoneNbr1")).sendKeys(PP1);284 test.log(LogStatus.PASS, "PP1 is entered: "+PP1);285 driver.findElement(By.name("phoneNbr2")).sendKeys(PP2);286 test.log(LogStatus.PASS, "PP2 is entered: "+PP2);287 driver.findElement(By.name("phoneNbr3")).sendKeys(PP3);288 test.log(LogStatus.PASS, "PP3 is entered: "+PP3);289 //driver.findElement(By.name("phoneNbr3"))(PP3);290 //test.log(LogStatus.PASS, "PP3 is entered: "+PP3);291 Select PhoneType = new Select(driver.findElement(By.name("customerBean.phoneCd")));292 PhoneType.selectByVisibleText(Ctc_PhoneType);293 test.log(LogStatus.PASS, "Phone Type is selected as: "+Ctc_PhoneType);294 driver.findElement(By.name("sphoneNbr1")).sendKeys(PP1);295 test.log(LogStatus.PASS, "SPP1 is entered: "+PP1);296 driver.findElement(By.name("sphoneNbr2")).sendKeys(PP1);297 test.log(LogStatus.PASS, "SPP2 is entered: "+PP1);298 driver.findElement(By.name("sphoneNbr3")).sendKeys(PP3);299 test.log(LogStatus.PASS, "SPP3 is entered: "+PP3);300 //driver.findElement(By.name("phoneNbr3"))(PP3);301 //test.log(LogStatus.PASS, "PP3 is entered: "+PP3);302 Select SubPhoneType = new Select(driver.findElement(By.name("customerBean.cphoneCd")));303 SubPhoneType.selectByVisibleText(Ctc_PhoneType);304 test.log(LogStatus.PASS, "Secondary Phone Type is selected as: "+Ctc_PhoneType);305 driver.findElement(By.name("customerBean.isCustomerEmailQuest")).click();306 test.log(LogStatus.PASS, "Does not have e-mail selected");307 driver.findElement(By.name("customerBean.driversLicNbr")).sendKeys(Misc_PhotoIDNbr);308 test.log(LogStatus.PASS, "PhotoIDNbr is entered: "+Misc_PhotoIDNbr);309 driver.findElement(By.name("customerBean.driversLicSt")).sendKeys(State);310 test.log(LogStatus.PASS, "ID State is entered: "+State);311 driver.findElement(By.name("dlexpiry1")).sendKeys(IDExpD1);312 test.log(LogStatus.PASS, "ID Expiration Date1 is entered: "+IDExpD1);313 driver.findElement(By.name("dlexpiry2")).sendKeys(IDExpD2);314 test.log(LogStatus.PASS, "ID Expiration Date1 is entered: "+IDExpD2);315 driver.findElement(By.name("dlexpiry3")).sendKeys(IDExpD3);316 test.log(LogStatus.PASS, "ID Expiration Date1 is entered: "+IDExpD3);317 driver.findElement(By.name("customerBean.photoIdType")).sendKeys(Misc_PhotoIDType);318 test.log(LogStatus.PASS, "PhotoIDType is entered: "+Misc_PhotoIDType);319 driver.findElement(By.name("customerBean.drivingZipcode")).sendKeys(ZipCode);320 test.log(LogStatus.PASS, "ZipCode is entered: "+ZipCode);321 driver.findElement(By.name("dob1")).sendKeys(DOB1);322 test.log(LogStatus.PASS, "DOB1 Date1 is entered: "+DOB1);323 driver.findElement(By.name("dob2")).sendKeys(DOB2);324 test.log(LogStatus.PASS, "DOB3 is entered: "+DOB2);325 driver.findElement(By.name("dob3")).sendKeys(DOB3);326 test.log(LogStatus.PASS, "DOB3 is entered: "+DOB3);327 //driver.findElement(By.name("PhoneNbr2")).sendKeys(PP3);328 driver.findElement(By.name("customerBean.incomeCdDisp")).sendKeys(Income_IncomeType);329 test.log(LogStatus.PASS, "IncomeType is entered: "+Income_IncomeType);330 driver.findElement(By.name("customerBean.empNmDisp")).sendKeys(Income_Employer);331 test.log(LogStatus.PASS, "Employer is entered: "+Income_Employer);332 driver.findElement(By.name("workPhoneNbrDisp1")).sendKeys(IncomeP1);333 test.log(LogStatus.PASS, "PP1 is entered: "+IncomeP1);334 driver.findElement(By.name("workPhoneNbrDisp2")).sendKeys(IncomeP2);335 test.log(LogStatus.PASS, "PP2 is entered: "+IncomeP2);336 driver.findElement(By.name("workPhoneNbrDisp3")).sendKeys(IncomeP3);337 test.log(LogStatus.PASS, "PP3 is entered: "+IncomeP3);338 driver.findElement(By.name("customerBean.incomeAmtDisp")).sendKeys(Income_NetIncomeAmt);339 test.log(LogStatus.PASS, "Income_NetIncomeAmt is entered: "+Income_NetIncomeAmt);340 driver.findElement(By.name("customerBean.grossAmtDisp")).sendKeys(Income_GrossIncome);341 test.log(LogStatus.PASS, "Income_GrossIncome is entered: "+Income_GrossIncome);342 driver.findElement(By.name("customerBean.payFreqCdDisp")).sendKeys(Income_PayFrequency);343 test.log(LogStatus.PASS, "Income_PayFrequency is entered: "+Income_PayFrequency);344 if(Income_PayFrequency.equals("Semi-Monthly"))345 {346 driver.findElement(By.id("rad_semi1")).click();347 test.log(LogStatus.PASS, "The 1st and 16th day of each month is selected");348 }349 if(Income_PayFrequency.equals("Bi-Weekly"))350 {351 driver.findElement(By.id("rad_wk4")).click();352 test.log(LogStatus.PASS, "Wednesday is selected");353 driver.findElement(By.id("biwksndid")).click();354 test.log(LogStatus.PASS, "Which day is your next Pay date? is selected as last date radio button"); 355 }356 driver.switchTo().defaultContent();357 driver.switchTo().frame("bottom");358 String BusinessDt= driver.findElement(By.xpath("/html/body/blink/table/tbody/tr/td[4]")).getText();359 String Busdate[]=BusinessDt.split(":");360 String date = Busdate[1];361 362 Date d1 = df.parse(date);363 Calendar cal = Calendar.getInstance();364 cal.setTime(d1);365 cal.add(Calendar.DATE, -10);366 Date PayStubReviewedDate1= cal.getTime();367 368 String PayStubReviewedDate =df.format(PayStubReviewedDate1);369 //Date D=Add(date1,7);370 //System.out.println(date);371 372 //System.out.println(PayStubReviewedDate);373 374 String PayStubReviewedDate0[] =PayStubReviewedDate.split("/");375 String PayStubReviewedDate2 = PayStubReviewedDate0[0];376 String PayStubReviewedDate3 = PayStubReviewedDate0[1];377 String PayStubReviewedDate4 = PayStubReviewedDate0[2];378 driver.switchTo().defaultContent();379 driver.switchTo().frame("mainFrame");380 driver.switchTo().frame("main");381 driver.findElement(By.name("payStubReviewed1")).sendKeys(PayStubReviewedDate2);382 test.log(LogStatus.PASS, "PayStubReviewed1 is entered: "+PayStubReviewedDate2);383 driver.findElement(By.name("payStubReviewed2")).sendKeys(PayStubReviewedDate3);384 test.log(LogStatus.PASS, "PayStubReviewed2 is entered: "+PayStubReviewedDate3);385 driver.findElement(By.name("payStubReviewed3")).sendKeys(PayStubReviewedDate4);386 test.log(LogStatus.PASS, "PayStubReviewed3 is entered: "+PayStubReviewedDate4);387 388 cal.add(Calendar.DATE, -30);389 Date PayStubDate1= cal.getTime();390 391 String PayStubDate =df.format(PayStubDate1);392 //Date D=Add(date1,7);393 //System.out.println(date);394 395 //System.out.println(PayStubReviewedDate);396 397 String PayStubDate0[] =PayStubDate.split("/");398 String PayStubDate2 = PayStubDate0[0];399 String PayStubDate3 = PayStubDate0[1];400 String PayStubDate4 = PayStubDate0[2];401 driver.findElement(By.name("payStubDate1")).sendKeys(PayStubDate2);402 test.log(LogStatus.PASS, "payStubDate1 is entered: "+PayStubDate2);403 driver.findElement(By.name("payStubDate2")).sendKeys(PayStubDate3);404 test.log(LogStatus.PASS, "payStubDate2 is entered: "+PayStubDate3);405 driver.findElement(By.name("payStubDate3")).sendKeys(PayStubDate4);406 test.log(LogStatus.PASS, "payStubDate3 is entered: "+PayStubDate4);407 408 String Income_HireDt0[] =Income_HireDt.split("/");409 String Income_HireDt1 = Income_HireDt0[0];410 String Income_HireDt2 = Income_HireDt0[1];411 String Income_HireDt3 = Income_HireDt0[2];412 413 driver.findElement(By.name("hireDate1")).sendKeys(Income_HireDt1);414 test.log(LogStatus.PASS, "hireDate1 is entered: "+Income_HireDt1);415 driver.findElement(By.name("hireDate2")).sendKeys(Income_HireDt2);416 test.log(LogStatus.PASS, "hireDate2 is entered: "+Income_HireDt2);417 driver.findElement(By.name("hireDate3")).sendKeys(Income_HireDt3);418 test.log(LogStatus.PASS, "hireDate3 is entered: "+Income_HireDt3);419 420 driver.findElement(By.name("customerBean.directDeposit")).sendKeys(Income_DirectDeposit);421 test.log(LogStatus.PASS, "DirectDeposit is entered: "+Income_DirectDeposit);422 cal.add(Calendar.DATE, -60);423 Date Bank_AcctVerificationDt0= cal.getTime();424 425 String Bank_AcctVerificationDt =df.format(Bank_AcctVerificationDt0);426 String Bank_AcctVerificationDt1[] =Bank_AcctVerificationDt.split("/");427 String Bank_AcctVerificationDt2 = Bank_AcctVerificationDt1[0];428 String Bank_AcctVerificationDt3 = Bank_AcctVerificationDt1[1];429 String Bank_AcctVerificationDt4 = Bank_AcctVerificationDt1[2];430 driver.findElement(By.name("statementEndDtDisp1")).sendKeys(Bank_AcctVerificationDt2);431 test.log(LogStatus.PASS, "Bank_AcctVerificationDt1 is entered: "+Bank_AcctVerificationDt2);432 driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);433 driver.findElement(By.name("statementEndDtDisp2")).sendKeys(Bank_AcctVerificationDt3);434 test.log(LogStatus.PASS, "Bank_AcctVerificationDt2 is entered: "+Bank_AcctVerificationDt3);435 driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);436 driver.findElement(By.name("statementEndDtDisp3")).sendKeys(Bank_AcctVerificationDt4);437 test.log(LogStatus.PASS, "Bank_AcctVerificationDt3 is entered: "+Bank_AcctVerificationDt4);438 439 //driver.findElement(By.name("customerBean.abaNbrDisp")).sendKeys(Bank_ABARoutingNbr);440 //driver.findElement(By.name("phoneNbr3"))(PP3);441 //test.log(LogStatus.PASS, "PP3 is entered: "+PP3);442 driver.findElement(By.name("customerBean.abaNbrDisp")).sendKeys(Bank_ABARoutingNbr);443 test.log(LogStatus.PASS, "Bank_ABARoutingNbr is entered: "+Bank_ABARoutingNbr);444 driver.findElement(By.name("checkAbaNbrDisp")).sendKeys(Bank_ABARoutingNbr);445 test.log(LogStatus.PASS, "Confirm ABA/Routing Nbr is entered: "+Bank_ABARoutingNbr);446 driver.findElement(By.name("customerBean.accountNbrDisp")).sendKeys(Bank_ChkgAcctNbr);447 test.log(LogStatus.PASS, "Chkg Acct Nbr is entered: "+Bank_ChkgAcctNbr); 448 driver.findElement(By.name("checkAccountNbrDisp")).sendKeys(Bank_ChkgAcctNbr);449 test.log(LogStatus.PASS, "Confirm Chkg Acct Nbr is entered: "+Bank_ChkgAcctNbr); 450 //driver.findElement(By.name("customerBean.drivingZipcode")).sendKeys(Bank_ChkgAcctNbr);451 //test.log(LogStatus.PASS, "drivingZipcode is entered: "+MiscZipCode);452 453 /*//Primary Reference Details454 455 456 //driver.findElement(By.name("customerBean.contName")).sendKeys(PrimaryRef_LastName);457 //test.log(LogStatus.PASS, "PRLast Name is entered: "+PrimaryRef_LastName);458 // driver.findElement(By.name("customerBean.contactFirstName")).sendKeys(PrimaryRef_FirstName);459 // test.log(LogStatus.PASS, "PRFirst Name is entered: "+PrimaryRef_FirstName);460 461 //driver.findElement(By.name("customerBean.contName")).sendKeys(PrimaryRef_LastName);462 driver.findElement(By.name("customerBean.contactrelationDisp")).sendKeys(PrimaryRef_Relationship);463 test.log(LogStatus.PASS, "Contactrelation is entered: "+PrimaryRef_Relationship);464 driver.findElement(By.name("cphoneNbrDisp1")).sendKeys(PrimaryRef_PhoneNbr1);465 test.log(LogStatus.PASS, "PrimaryReference Phone Nbr1 is entered: "+PrimaryRef_PhoneNbr1);466 driver.findElement(By.name("cphoneNbrDisp2")).sendKeys(PrimaryRef_PhoneNbr2);467 test.log(LogStatus.PASS, "PrimaryReference Phone Nbr1 is entered: "+PrimaryRef_PhoneNbr2);468 driver.findElement(By.name("cphoneNbrDisp3")).sendKeys(PrimaryRef_PhoneNbr3);469 test.log(LogStatus.PASS, "PrimaryReference Phone Nbr1 is entered: "+PrimaryRef_PhoneNbr3);470 471 // Reference Details472 473 474 driver.findElement(By.name("customerBean.nameDispSummary")).sendKeys(Ref_LastName);475 test.log(LogStatus.PASS, "RLast Name is entered: "+Ref_LastName);476 driver.findElement(By.name("customerBean.referenceFirstNameSummary")).sendKeys(Ref_FirstName);477 test.log(LogStatus.PASS, "RFirst Name is entered: "+Ref_FirstName);478 479 //driver.findElement(By.name("customerBean.contName")).sendKeys(Ref_LastName);480 //test.log(LogStatus.PASS, "PRLast Name is entered: "+Ref_LastName);481 driver.findElement(By.name("customerBean.relationDispSummary")).sendKeys(Ref_Relationship);482 test.log(LogStatus.PASS, "reference relation is entered: "+Ref_Relationship);483 driver.findElement(By.name("refPhoneNbr1")).sendKeys(Ref_PhoneNbr1);484 test.log(LogStatus.PASS, "Reference Phone Nbr1 is entered: "+Ref_PhoneNbr1);485 driver.findElement(By.name("refPhoneNbr2")).sendKeys(Ref_PhoneNbr2);486 test.log(LogStatus.PASS, "Reference Phone Nbr1 is entered: "+Ref_PhoneNbr2);487 driver.findElement(By.name("refPhoneNbr3")).sendKeys(Ref_PhoneNbr3);488 test.log(LogStatus.PASS, "Reference Phone Nbr1 is entered: "+Ref_PhoneNbr3);489 driver.findElement(By.name("bt_Reference")).click(); 490 test.log(LogStatus.PASS, "Clicked on ADD Reference");491 */492 driver.findElement(By.name("customerBean.bankrupty")).sendKeys(Bankruptcy);493 test.log(LogStatus.PASS, "Bankrupty is selected as: "+Bankruptcy);494 driver.findElement(By.name("SLoan")).click(); 495 test.log(LogStatus.PASS, "Clicked on Save&Loan");496 Thread.sleep(5000);497 498 try { 499 Alert alert = driver.switchTo().alert();500 alert.accept();501 //if alert present, accept and move on. 502 503 }504 catch (NoAlertPresentException e) {505 //do what you normally would if you didn't have the alert.506 }507 508 for(String winHandle : driver.getWindowHandles()){509 driver.switchTo().window(winHandle);510 511 driver.switchTo().defaultContent();512 driver.switchTo().frame("mainFrame");513 driver.switchTo().frame("main");514 515 516 if(driver.findElement(By.id("ShareScreenBtn")).isEnabled())517 {518 test.log(LogStatus.PASS, "Borrower is Registered Successfully with SSN as " +SSN); 519 }520 else521 {522 test.log(LogStatus.FAIL, "Borrower is not Registered Successfully with SSN as " +SSN);523 }524 525 526 }527 //driver.switchTo().defaultContent();528 //driver.switchTo().frame("topFrame");529 //driver.findElement(By.xpath("//*[@id='icons']/li[7]/a")).click();530 //*[@id="icons"]/li[7]/a531 try { 532 Alert alert = driver.switchTo().alert();533 alert.accept();534 //if alert present, accept and move on. 535 536 }537 catch (NoAlertPresentException e) {538 //do what you normally would if you didn't have the alert.539 }540 }541 542 } 543 544 //driver.switchTo().alert().accept();545 546 /* WebDriver driver = new FirefoxDriver();547 JavascriptExecutor jse = (JavascriptExecutor) driver;548 jse.executeScript("document.getElementById('elementid').focus();");*/549 }550 551 552 553 554 555public void NewLoan(String SSN,String FileName) throws Exception{556 557 558 Excel TestData = new Excel(System.getProperty("user.dir")+"/TestData/PDL/"+FileName); 559 int lastrow=TestData.getLastRow("NewLoan");560 System.out.println("NewLoan "+lastrow);561 String sheetName="NewLoan"; 562 for(int row=2;row<=lastrow;row++)563 { 564 String RegSSN = TestData.getCellData(sheetName,"SSN",row);565 if(SSN.equals(RegSSN))566 { 567 String State = TestData.getCellData(sheetName,"StateID",row);568 String ProductID=TestData.getCellData(sheetName,"ProductID",row);569 System.out.println(ProductID);570 //String UserName = TestData.getCellData(sheetName,"UserName",row);571 //String Password = TestData.getCellData(sheetName,"Password",row);572 String ProductType = TestData.getCellData(sheetName,"ProductType",row);573 String ProductName = TestData.getCellData(sheetName,"ProductName",row);574 //String Term = TestData.getCellData(sheetName,"Term",row);575 String VehicleType= TestData.getCellData(sheetName,"VehicleType",row);576 String NewVIN= TestData.getCellData(sheetName,"NewVIN",row);577 //System.out.println(Term);578 //String StoreId = TestData.getCellData(sheetName,"StoreID",row);579 String StoreID = TestData.getCellData(sheetName,"StoreID",row);580 //String stateProduct=State+" "+ProductID;581 String stateProductType=State+" "+ProductType;582 String ESign_CollateralType = TestData.getCellData(sheetName,"ESign_CollateralType",row);583 System.out.println(ESign_CollateralType);584 String ESign_LoanAmt = TestData.getCellData(sheetName,"ESign_LoanAmt",row);585 String ChkgAcctNbr = TestData.getCellData(sheetName,"ChkgAcctNbr",row);586 String ESign_DisbType = TestData.getCellData(sheetName,"ESign_DisbType",row);587 String ESign_CourtesyCallConsent = TestData.getCellData(sheetName,"ESign_CourtesyCallConsent",row);588 String AllowPromotion = TestData.getCellData(sheetName,"Allow Promotion",row);589 String CouponNbr = TestData.getCellData(sheetName,"CouponNbr",row);590 String ESign_Preference = TestData.getCellData(sheetName,"ESign_Preference",row);591 String ESign_Checks = TestData.getCellData(sheetName,"ESign_Checks",row);592 String ESign_Password=TestData.getCellData(sheetName,"ESign_Password",row);593 String ESign_CheckNbr = TestData.getCellData(sheetName,"ESign_CheckNbr",row); 594 String last4cheknum= ChkgAcctNbr.substring(ChkgAcctNbr.length() - 4);595 System.out.println(last4cheknum);596 System.out.println(stateProductType);597 String Parent_Window = driver.getWindowHandle();598 /*this.Login(UserName,Password,StoreId);599 String SSN1 = SSN.substring(0, 3);600 String SSN2 = SSN.substring(3,5);601 String SSN3 = SSN.substring(5,9);602 driver.switchTo().frame("topFrame");603 driver.findElement(By.xpath("//*[contains(text(),'Loan Transactions')]")).click(); 604 test.log(LogStatus.PASS, "Clicked on Loan Transactions");605 driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);606 driver.switchTo().defaultContent();607 driver.switchTo().frame("mainFrame");608 driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);609 driver.findElement(By.cssSelector("li[id='911100']")).click(); 610 test.log(LogStatus.PASS, "Clicked on New Loan"); 611 driver.switchTo().frame("main"); 612 driver.findElement(By.name("ssn1")).sendKeys(SSN1);613 test.log(LogStatus.PASS, "SSN1 is entered: "+SSN1);614 driver.findElement(By.name("ssn2")).sendKeys(SSN2);615 test.log(LogStatus.PASS, "SSN2 is entered: "+SSN2);616 driver.findElement(By.name("ssn3")).sendKeys(SSN3);617 test.log(LogStatus.PASS, "SSN3 is entered: "+SSN3);618 driver.findElement(By.name("submit1")).click();619 test.log(LogStatus.PASS, "Click on submit Button"); 620 for(String winHandle : driver.getWindowHandles()){621 driver.switchTo().window(winHandle); 622 driver.switchTo().defaultContent();623 driver.switchTo().frame("mainFrame");624 driver.switchTo().frame("main");625 driver.findElement(By.name("button")).click();626 test.log(LogStatus.PASS, "Click on GO Button");*/627 for( String winHandle1 : driver.getWindowHandles())628 {629 driver.switchTo().window(winHandle1);630 } 631 driver.switchTo().defaultContent();632 driver.switchTo().frame("mainFrame");633 driver.switchTo().frame("main");634 // Selection of Product based on the Name provided in Test Data635 636 //if(driver.findElement(By.id("LoanButtonId")).isEnabled())637 if(driver.findElement(By.name("ShareScreenBtn")).isEnabled())638 {639 //driver.findElement(By.xpath("//input[contains(text(),"+stateProduct+")]")).click();640 //test.log(LogStatus.PASS, "Borrower is Registered Successfully with SSN as " +SSN); 641 if(ProductID.equals("TLP")) 642 { 643 System.out.println("IN TLP");644 driver.findElement(By.xpath("//*[@id='vehicleType_dd']")).sendKeys(VehicleType);645 driver.findElement(By.xpath("//*[@id='vinDD']")).sendKeys("New");646 driver.findElement(By.xpath("//*[@id='vinPop']/div/table[1]/tbody/tr[1]/td[2]/input")).sendKeys(NewVIN); 647 driver.findElement(By.xpath("//*[@id='vinPop']/div/table[1]/tbody/tr[2]/td[2]/input")).sendKeys(NewVIN);648 driver.findElement(By.xpath("//*[@id='vinPop']/div/table[3]/tbody/tr/td/input[2]")).click();649 driver.findElement(By.xpath("//*[@id='td.miles_tf']/input")).sendKeys("200");650 driver.findElement(By.xpath("//*[@id='bbHit_Button']")).click(); 651 } 652 if(ProductName.equals("TNPAYDAY"))653 {654 //// *[@id="riskViewBdy"]/table[3]/tbody/tr[1]/td/table/tbody/tr[3]/td/table/tbody/tr[2]/td[2]/input655 driver.findElement(By.xpath("//*[@id='riskViewBdy']/table[3]/tbody/tr[1]/td/table/tbody/tr[3]/td/table/tbody/tr[2]/td[2]/input")).click();656 test.log(LogStatus.PASS, "ProductName is selected as "+ProductName);657 }658 if(ProductName.equals("TNPDL all coll"))659 { ////*[@id="riskViewBdy"]/table[3]/tbody/tr[1]/td/table/tbody/tr[3]/td/table/tbody/tr[2]/td[2]/input660 driver.findElement(By.name("prodSel")).click();661 //driver.findElement(By.xpath("//*[@id='riskViewBdy']/table[3]/tbody/tr[1]/td/table/tbody/tr[3]/td/table/tbody/tr[2]/td[2]/input")).click();662 //driver.findElement(By.xpath("//*[@id='riskViewBdy']/table[3]/tbody/tr[1]/td/table/tbody/tr[3]/td/table/tbody/tr[3]/td[2]/input")).click();663 test.log(LogStatus.PASS, "ProductName is selected as "+ProductName);664 }665 if(ProductName.equals("Tennessee"))666 {667 driver.findElement(By.xpath("//*[@id='termSel1']")).click();668 test.log(LogStatus.PASS, "ProductName is selected as "+ProductName);669 }670 if(ProductName.equals("Line of Credit"))671 {672 673 if(StoreID.equals("4330"))674 {675 driver.findElement(By.xpath("//*[@id='riskViewBdy']/table[3]/tbody/tr[1]/td/table/tbody/tr[3]/td/table/tbody/tr[2]/td[2]/input")).click();676 }677 if(StoreID.equals("4353"))678 {679 //*[@id="riskViewBdy"]/table[3]/tbody/tr[1]/td/table/tbody/tr[3]/td/table/tbody/tr[2]/td[2]/input680 681 driver.findElement(By.xpath("//*[@id='riskViewBdy']/table[3]/tbody/tr[1]/td/table/tbody/tr[3]/td/table/tbody/tr[2]/td[2]/input")).click();682 test.log(LogStatus.PASS, "ProductName is selected as "+ProductName);683 684 }685 if(StoreID.equals("1343"))686 {687 driver.findElement(By.xpath("//*[@id='riskViewBdy']/table[3]/tbody/tr[1]/td/table/tbody/tr[3]/td/table/tbody/tr[4]/td[2]/input")).click();688 test.log(LogStatus.PASS, "ProductName is selected as "+ProductName);689 }690 691 }692 //*[@id="riskViewBdy"]/table[3]/tbody/tr[1]/td/table/tbody/tr[3]/td/table/tbody/tr[3]/td[2]/input693 /* WebElement htmltable=driver.findElement(By.xpath("//*[@id='riskViewBdy']/table[3]/tbody/tr[1]/td/table/tbody/tr[3]/td/table"));694 //*[@id="riskViewBdy"]/table[3]/tbody/tr[1]/td/table/tbody/tr[3]/td/table695 696 List<WebElement> rows=htmltable.findElements(By.tagName("tr"));697 698 int count=0; 699 count=driver.findElements(By.xpath("//*[@id='riskViewBdy']/table[3]/tbody/tr[1]/td/table/tbody/tr[3]/td/table/tbody/tr")).size(); 700 //*[@id="riskViewBdy"]/table[3]/tbody/tr[1]/td/table/tbody/tr[3]/td/table/tbody/tr[1]701 System.out.println("current row num "+count); 702 System.out.println(" rows num "+ rows.size());703 for(int rnum=1;rnum<=count;rnum++)704 {705 System.out.println("current row num "+rnum); 706 List<WebElement> columns=rows.get(rnum).findElements(By.tagName("td")); 707 708 System.out.println("columns Count "+columns.size());709 710 for(int cnum=0;cnum<columns.size();cnum++)//columns.size()711 { 712 String product_name=columns.get(cnum).getText(); 713 System.out.println(product_name); 714 715 if(product_name.equals(stateProduct))716 {717 718 if(ProductID.equals("PDL"))719 { 720 rnum=rnum+1; 721 driver.findElement(By.xpath("//*[@id='riskViewBdy']/table[3]/tbody/tr[1]/td/table/tbody/tr[3]/td/table/tbody/tr["+rnum+"]/td[2]/input")).click(); 722 723 }724 }725 if(stateProduct.equals("MO PDL"))726 {727 728 if(ProductID.equals("PDL"))729 { 730 rnum=rnum+1; 731 driver.findElement(By.xpath("//*[@id='riskViewBdy']/table[3]/tbody/tr[1]/td/table/tbody/tr[3]/td/table/tbody/tr[5]/td[2]/input")).click(); 732 }733 }734 735 if(ProductID.equals("ILP")||ProductID.equals("TLP")) 736 { 737 738 System.out.println("IN ILP/TLP");739 String Pname=driver.findElement(By.xpath("//*[@id='riskViewBdy']/table[3]/tbody/tr[1]/td/table/tbody/tr[3]/td/table/tbody/tr["+rnum+"]/td[2]")).getText();740 System.out.println("current row of table"+Pname);741 if(Pname.equals(stateProductType))742 {743 if(Term.equals("Term1"))744 {745 driver.findElement(By.xpath("//*[@id='riskViewBdy']/table[3]/tbody/tr[1]/td/table/tbody/tr[3]/td/table/tbody/tr["+rnum+"]/td[5]/table/tbody/tr/td[2]/table[1]/tbody/tr[1]/td/b/input")).click(); 746 }747 if(Term.equals("Term2"))748 {749 driver.findElement(By.xpath("//*[@id='riskViewBdy']/table[3]/tbody/tr[1]/td/table/tbody/tr[3]/td/table/tbody/tr["+rnum+"]/td[5]/table/tbody/tr/td[2]/table[2]/tbody/tr[1]/td/b/input")).click(); 750 }751 } 752 753 } 754 } 755 }756 if(ProductID.equals("PDL"))757 {758 test.log(LogStatus.PASS, "Product selected as "+stateProduct);759 }760 if(ProductID.equals("ILP")||ProductID.equals("TLP"))761 {762 test.log(LogStatus.PASS, "Product selected as "+stateProductType+" Term Selected as "+Term);763 }*/764 driver.findElement(By.name("ShareScreenBtn")).click();765 test.log(LogStatus.PASS, "ShareScreen Button clicked");766 for( String winHandle1 : driver.getWindowHandles())767 768 {769 770 driver.switchTo().window(winHandle1);771 772 }773 Thread.sleep(1000);774 driver.findElement(By.name("confirmSummary")).click();775 test.log(LogStatus.PASS, "ConfirmShareScreen Button clicked");776 Thread.sleep(3000);777 driver.switchTo().window(Parent_Window);778 779 for( String winHandle1 : driver.getWindowHandles())780 781 {782 783 driver.switchTo().window(winHandle1);784 785 } 786 787 driver.switchTo().defaultContent();788 789 driver.switchTo().frame("mainFrame");790 791 driver.switchTo().frame("main");792 driver.findElement(By.id("LoanButtonId")).click();793 //driver.findElement(By.id("LoanButtonId")).click();794 795 test.log(LogStatus.PASS, "Clicked on New Loan button");796 //New Loan Screens797 if(ProductID.equals("PDL"))798 { 799 800 driver.findElement(By.xpath("/html/body/form[1]/table/tbody/tr[1]/td/table[2]/tbody/tr/td/table/tbody/tr[3]/td[3]/select")).sendKeys(ESign_CollateralType);801 test.log(LogStatus.PASS, "Collateral Type is enterted as "+ESign_CollateralType);802 if(!(ESign_LoanAmt.isEmpty()))803 {804 driver.findElement(By.xpath("/html/body/form[1]/table/tbody/tr[1]/td/table[2]/tbody/tr/td/table/tbody/tr[13]/td[3]/input")).sendKeys(ESign_LoanAmt);805 test.log(LogStatus.PASS, "Loan amount is enterted as "+ESign_LoanAmt);806 }807 driver.findElement(By.xpath("//*[@id='chkgAcctNbr']")).sendKeys(last4cheknum);808 test.log(LogStatus.PASS, " Chkg Acct Nbr(Last 4 Digits Only) is enterted as "+last4cheknum); 809 driver.findElement(By.xpath("//*[@id='advanceRequestBean.disbursementType']")).sendKeys(ESign_DisbType);810 test.log(LogStatus.PASS, "Disb Type is enterted as "+ESign_DisbType);811 Thread.sleep(5000);812 String Instamt=driver.findElement(By.name("advanceRequestBean.advanceAmt")).getAttribute("value");813 System.out.println(Instamt);814 driver.findElement(By.name("advanceRequestBean.disbAmtFirst")).sendKeys(Instamt); 815 test.log(LogStatus.PASS, "Disb Amt is enterted as "+Instamt);816 Thread.sleep(5000);817 ///driver.findElement(By.name("advanceRequestBean.courtesyCallFlag")).sendKeys(ESign_CourtesyCallConsent);818 //test.log(LogStatus.PASS, "Payment Reminder Consent is selected as "+ESign_CourtesyCallConsent);819 driver.findElement(By.name("advanceRequestBean.emailConsentFlag")).sendKeys(ESign_CourtesyCallConsent);820 test.log(LogStatus.PASS, "Electronic Communication Consent is selected as "+ESign_CourtesyCallConsent);821 if(ESign_CourtesyCallConsent.equals("Yes"))822 {823 if(ESign_Preference.equals("Call")) 824 {825 driver.findElement(By.xpath("//*[@id='preferenceCall']")).click();826 test.log(LogStatus.PASS, "Courtesy Call Consent is selected as "+ESign_Preference);827 }828 if(ESign_Preference.equals("Mail")) 829 {830 driver.findElement(By.xpath("//*[@id='preferenceMail']")).click();831 test.log(LogStatus.PASS, "Courtesy Call Consent is selected as "+ESign_Preference);832 }833 if(ESign_Preference.equals("SMS")) 834 {835 driver.findElement(By.xpath("//*[@id='preferenceSms']")).click();836 test.log(LogStatus.PASS, "Courtesy Call Consent is selected as "+ESign_Preference);837 838 try { 839 Alert alert = driver.switchTo().alert();840 alert.dismiss();841 //if alert present, accept and move on. 842 843 }844 catch (NoAlertPresentException e) {845 //do what you normally would if you didn't have the alert.846 }847 }848 849 }850 if(AllowPromotion.equals("Yes"))851 {852 driver.findElement(By.xpath("//*[@id='allowCoupons']/td[3]/input")).click();853 test.log(LogStatus.PASS, "AllowPromotion is selected ");854 driver.findElement(By.xpath("//*[@id='coupon']/td[3]/div[1]/input")).sendKeys(CouponNbr);855 test.log(LogStatus.PASS, "CouponNbr is selected as "+CouponNbr);856 }857 if(ESign_CollateralType.equals("CHECK")||ESign_CollateralType.equals("Check"))858 {859 driver.findElement(By.xpath("//*[@id='idNoChecks']/td[3]/select")).sendKeys(ESign_Checks);860 test.log(LogStatus.PASS, "ESign_Checks is selected as "+ESign_Checks);861 WebDriverWait wait = new WebDriverWait(driver, 1000); 862 wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id='chkNbr0']")));863 driver.findElement(By.xpath("//*[@id='chkNbr0']")).sendKeys(ESign_CheckNbr);864 test.log(LogStatus.PASS, "Check number is "+ESign_CheckNbr);865 }866 driver.findElement(By.name("advanceRequestBean.loggedUserPassword")).sendKeys(ESign_Password);867 //driver.findElement(By.xpath("/html/body/form[1]/table/tbody/tr[10]/td/input")).sendKeys(ESign_Password);868 test.log(LogStatus.PASS, "ESign_Password is selected as "+ESign_Password);869 driver.findElement(By.name("finishadvance")).click();870 //driver.findElement(By.xpath("/html/body/form[1]/table/tbody/tr[12]/td/table/tbody/tr[1]/td[5]/input")).click();871 test.log(LogStatus.PASS, "click on Finish Loan button ");872 try { 873 Alert alert = driver.switchTo().alert();874 alert.accept();875 //if alert present, accept and move on. 876 877 }878 catch (NoAlertPresentException e) {879 //do what you normally would if you didn't have the alert.880 }881 for( String winHandle1 : driver.getWindowHandles())882 {883 driver.switchTo().window(winHandle1);884 } 885 driver.switchTo().defaultContent();886 driver.switchTo().frame("mainFrame");887 driver.switchTo().frame("main");888 //wait.until(ExpectedConditions.visibilityOfElementLocated(By.name("OKBut")));889 // driver.findElement(By.name("OKBut")).click(); 890 driver.findElement(By.xpath("//*[@id='OKBut']")).click(); 891 test.log(LogStatus.PASS, "click on Yes button ");892 for( String winHandle1 : driver.getWindowHandles())893 {894 driver.switchTo().window(winHandle1);895 } 896 driver.switchTo().defaultContent();897 driver.switchTo().frame("mainFrame");898 driver.switchTo().frame("bdyLoad");899 if(driver.findElement(By.name("Ok")).isDisplayed())900 {901 driver.findElement(By.name("Ok")).click();902 test.log(LogStatus.PASS, "New Loan is Completed Successfully ");903 //driver.findElement(By.name("Ok")).click();904 }905 else906 {907 test.log(LogStatus.FAIL, "New Loan is not Completed Successfully ");908 }909 }910 if(ProductID.equals("ILP"))911 { 912 driver.findElement(By.name("collateralType")).sendKeys(ESign_CollateralType);913 //driver.findElement(By.xpath("/html/body/form[1]/table/tbody/tr[1]/td/table[2]/tbody/tr/td/table/tbody/tr[3]/td[3]/select")).sendKeys(ESign_CollateralType);914 test.log(LogStatus.PASS, "Collateral Type is enterted as "+ESign_CollateralType); 915 driver.findElement(By.name("requestBean.siilBean.disbType")).sendKeys(ESign_DisbType);916 test.log(LogStatus.PASS, "Disb Type is enterted as "+ESign_DisbType);917 String Instamt=driver.findElement(By.name("advanceRequestBean.advanceAmt")).getAttribute("value");918 System.out.println(Instamt);919 driver.findElement(By.name("advanceRequestBean.disbAmtFirst")).sendKeys(Instamt);920 test.log(LogStatus.PASS, "Disb Amt is enterted as "+Instamt);921 driver.findElement(By.name("requestBean.siilBean.courtesyCallFlag")).sendKeys(ESign_CourtesyCallConsent);922 test.log(LogStatus.PASS, "Courtesy Call Consent is selected as "+ESign_CourtesyCallConsent);923 if(ESign_CourtesyCallConsent.equals("Yes"))924 {925 if(ESign_Preference.equals("Call")) 926 {927 driver.findElement(By.xpath("//*[@id='preferenceCall']")).click();928 test.log(LogStatus.PASS, "Courtesy Call Consent is selected as "+ESign_Preference);929 }930 if(ESign_Preference.equals("Mail")) 931 {932 driver.findElement(By.xpath("//*[@id='preferenceMail']")).click();933 test.log(LogStatus.PASS, "Courtesy Call Consent is selected as "+ESign_Preference);934 }935 if(ESign_Preference.equals("SMS")) 936 {937 driver.findElement(By.xpath("//*[@id='preferenceSms']")).click();938 test.log(LogStatus.PASS, "Courtesy Call Consent is selected as "+ESign_Preference);939 940 try { 941 Alert alert = driver.switchTo().alert();942 alert.dismiss();943 //if alert present, accept and move on. 944 945 }946 catch (NoAlertPresentException e) {947 //do what you normally would if you didn't have the alert.948 }949 }950 951 }952 if(AllowPromotion.equals("Yes"))953 {954 driver.findElement(By.name("allowPromotion")).click();955 test.log(LogStatus.PASS, "AllowPromotion is selected ");956 //String mwh=driver.getWindowHandle();957 driver.findElement(By.name("requestBean.siilBean.couponNbr")).sendKeys(CouponNbr);958 test.log(LogStatus.PASS, "CouponNbr is selected as "+CouponNbr);959 //String winHandle = driver.getWindowHandle(); //Get current window handle. 960 }961 WebElement ele = driver.findElement(By.name("requestBean.siilBean.nbrOfInst"));962 String NumofInst=ele.getAttribute("value");963 //*[@id="errorMessage"]/form[1]/table/tbody/tr[4]/td/table[1]/tbody/tr[5]/td[2]/input964 System.out.println(NumofInst);965 int installments = Integer.parseInt(NumofInst);966 for(int i=0;i<installments;i++)967 {968 Random rand = new Random();969 int rand1 = rand.nextInt(100000); 970 String chknum = Integer.toString(rand1);971 driver.findElement(By.id("checkNbrs"+i)).sendKeys(chknum);972 973 } 974 driver.findElement(By.name("requestBean.password")).sendKeys(ESign_Password);975 //driver.findElement(By.xpath("/html/body/form[1]/table/tbody/tr[10]/td/input")).sendKeys(ESign_Password);976 test.log(LogStatus.PASS, "ESign_Checks is selected as "+ESign_Password);977 driver.findElement(By.name("finishLoan")).click();978 //driver.findElement(By.xpath("/html/body/form[1]/table/tbody/tr[12]/td/table/tbody/tr[1]/td[5]/input")).click();979 test.log(LogStatus.PASS, "click on Finish Loan button ");980 try { 981 Alert alert = driver.switchTo().alert();982 alert.accept();983 //if alert present, accept and move on. 984 985 }986 catch (NoAlertPresentException e) {987 //do what you normally would if you didn't have the alert.988 }989 //for( String winHandle1 : driver.getWindowHandles())990 //{991 // driver.switchTo().window(winHandle1);992 //} 993 driver.switchTo().defaultContent();994 driver.switchTo().frame("mainFrame");995 driver.switchTo().frame("main");996 wait.until(ExpectedConditions.visibilityOfElementLocated(By.name("OKBut")));997 driver.findElement(By.name("OKBut")).click();998 //driver.findElement(By.xpath("/html/body/form/table/tbody/tr/td/table/tbody/tr/td/table[2]/tbody/tr/td/input[1]")).click(); 999 test.log(LogStatus.PASS, "click on Yes button ");1000 for( String winHandle1 : driver.getWindowHandles())1001 {1002 driver.switchTo().window(winHandle1);1003 } 1004 driver.switchTo().defaultContent();1005 driver.switchTo().frame("mainFrame");1006 driver.switchTo().frame("main");1007 if(driver.findElement(By.name("ok")).isDisplayed())1008 {1009 test.log(LogStatus.PASS, "New Loan is Completed Successfully ");1010 //driver.findElement(By.name("ok")).click();1011 }1012 else1013 {1014 test.log(LogStatus.FAIL, "New Loan is not Completed Successfully ");1015 }1016 }1017 1018 if(ProductID.equals("TLP"))1019 { 1020 String TitleNumber= TestData.getCellData(sheetName,"TitleNumber",row);1021 String AppraisalValue= TestData.getCellData(sheetName,"Appraisal Value",row);1022 String ExteriorColor=TestData.getCellData(sheetName,"ExteriorColor",row);1023 String LicensePlateNumber=TestData.getCellData(sheetName,"License Plate Number",row);1024 //String VehicleGrade=TestData.getCellData(sheetName,"Vehicle Grade",row);1025 String LicensePlateExp=TestData.getCellData(sheetName,"License Plate Expiry",row);1026 String InsuranceCoverage=TestData.getCellData(sheetName,"Insurance Coverage",row);1027 String PhoneNbr=TestData.getCellData(sheetName,"Phone Nbr",row);1028 String PhoneNbr1 = PhoneNbr.substring(0, 3);1029 String PhoneNbr2 = PhoneNbr.substring(3, 6);1030 String PhoneNbr3 = PhoneNbr.substring(6, 10);1031 String InsuranceCompany =TestData.getCellData(sheetName,"Insurance Company",row);1032 String InsuranceExpiryDate=TestData.getCellData(sheetName,"Insurance Expiry Date",row);1033 String PolicyNumber=TestData.getCellData(sheetName,"Policy Number",row);1034 String InsuranceExpiryDate0[] =InsuranceExpiryDate.split("/");1035 String InsuranceExpiryDate1 = InsuranceExpiryDate0[0];1036 String InsuranceExpiryDate2 = InsuranceExpiryDate0[1];1037 String InsuranceExpiryDate3 = InsuranceExpiryDate0[2];1038 driver.findElement(By.name("requestBean.titleNumber")).sendKeys(TitleNumber);1039 driver.findElement(By.xpath("//*[@id='appraisal']")).sendKeys(AppraisalValue);1040 // driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);1041 driver.findElement(By.name("button1")).click();1042 test.log(LogStatus.PASS, "click on Update 1 button ");1043 //driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);1044 WebDriverWait wait = new WebDriverWait(driver, 10);1045 wait.until(ExpectedConditions.visibilityOfElementLocated(By.name("requestBean.extClr")));1046 // for( String winHandle1 : driver.getWindowHandles())1047 // {1048 // driver.switchTo().window(winHandle1);1049 // } 1050 // driver.switchTo().defaultContent();1051 // driver.switchTo().frame("mainFrame");1052 // driver.switchTo().frame("main");1053 driver.findElement(By.name("requestBean.extClr")).sendKeys(ExteriorColor);1054 driver.findElement(By.name("requestBean.licensePltNbr")).sendKeys(LicensePlateNumber);1055 driver.findElement(By.name("requestBean.licensePltExpire")).sendKeys(LicensePlateExp);1056 driver.findElement(By.name("requestBean.paintCondition")).sendKeys("Clean");1057 driver.findElement(By.name("requestBean.bodyCondition")).sendKeys("Clean");1058 driver.findElement(By.name("requestBean.glassCondition")).sendKeys("Clean");1059 driver.findElement(By.name("requestBean.tiresCondition")).sendKeys("Clean");1060 driver.findElement(By.name("requestBean.coverageType")).sendKeys(InsuranceCoverage);1061 driver.findElement(By.name("iPhoneNbr1")).sendKeys(PhoneNbr1);1062 driver.findElement(By.name("iPhoneNbr2")).sendKeys(PhoneNbr2);1063 driver.findElement(By.name("iPhoneNbr3")).sendKeys(PhoneNbr3);1064 driver.findElement(By.name("requestBean.companyName")).sendKeys(InsuranceCompany);1065 driver.findElement(By.name("iexpiry1")).sendKeys(InsuranceExpiryDate1);1066 driver.findElement(By.name("iexpiry2")).sendKeys(InsuranceExpiryDate2);1067 driver.findElement(By.name("iexpiry3")).sendKeys(InsuranceExpiryDate3);1068 driver.findElement(By.name("requestBean.polocyNbr")).sendKeys(PolicyNumber);1069 wait.until(ExpectedConditions.visibilityOfElementLocated(By.name("button2")));1070 driver.findElement(By.name("button2")).click(); 1071 driver.findElement(By.name("button2")).click(); 1072 //driver.findElement(By.name("button2")).click(); 1073 //driver.findElement(By.name("button2")).click(); 1074 test.log(LogStatus.PASS, "click on Update 2 button ");1075 Thread.sleep(8000);1076 //driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);1077 /*for( String winHandle1 : driver.getWindowHandles())1078 {1079 driver.switchTo().window(winHandle1);1080 } 1081 driver.switchTo().defaultContent();1082 driver.switchTo().frame("mainFrame");1083 driver.switchTo().frame("main");*/1084 wait.until(ExpectedConditions.visibilityOfElementLocated(By.name("process")));1085 driver.findElement(By.name("process")).click();1086 //driver.findElement(By.name("process")).click();1087 //driver.findElement(By.xpath("/html/body/form[1]/table/tbody/tr[12]/td/table/tbody/tr[1]/td[5]/input")).click();1088 test.log(LogStatus.PASS, "click on process Loan button ");1089 try { 1090 Alert alert = driver.switchTo().alert();1091 alert.accept();1092 //if alert present, accept and move on. 1093 1094 }1095 catch (NoAlertPresentException e) {1096 //do what you normally would if you didn't have the alert.1097 }1098 Thread.sleep(5000);1099 wait.until(ExpectedConditions.visibilityOfElementLocated(By.name("collateralType")));1100 driver.findElement(By.name("collateralType")).sendKeys(ESign_CollateralType);1101 //driver.findElement(By.xpath("/html/body/form[1]/table/tbody/tr[1]/td/table[2]/tbody/tr/td/table/tbody/tr[3]/td[3]/select")).sendKeys(ESign_CollateralType);1102 test.log(LogStatus.PASS, "Collateral Type is enterted as "+ESign_CollateralType); 1103 driver.findElement(By.name("requestBean.siilBean.disbType")).sendKeys(ESign_DisbType);1104 test.log(LogStatus.PASS, "Disb Type is enterted as "+ESign_DisbType);1105 String Instamt=driver.findElement(By.name("cashToCust")).getAttribute("value");1106 System.out.println(Instamt);1107 driver.findElement(By.name("requestBean.siilBean.disbAmtFirst")).sendKeys(Instamt);1108 test.log(LogStatus.PASS, "Disb Amt is enterted as "+Instamt);1109 driver.findElement(By.name("vehicleKey")).sendKeys("Yes"); 1110 driver.findElement(By.name("requestBean.siilBean.courtesyCallFlag")).sendKeys(ESign_CourtesyCallConsent);1111 test.log(LogStatus.PASS, "Payment Reminder Consent is selected as "+ESign_CourtesyCallConsent);1112 driver.findElement(By.name("requestBean.siilBean.emailConsentFlag")).sendKeys(ESign_CourtesyCallConsent);1113 test.log(LogStatus.PASS, "Payment Reminder Consent is selected as "+ESign_CourtesyCallConsent);1114 if(ESign_CourtesyCallConsent.equals("Yes"))1115 {1116 if(ESign_Preference.equals("Call")) 1117 {1118 driver.findElement(By.xpath("//*[@id='preferenceCall']")).click();1119 test.log(LogStatus.PASS, "Courtesy Call Consent is selected as "+ESign_Preference);1120 }1121 if(ESign_Preference.equals("Mail")) 1122 {1123 driver.findElement(By.xpath("//*[@id='preferenceMail']")).click();1124 test.log(LogStatus.PASS, "Courtesy Call Consent is selected as "+ESign_Preference);1125 }1126 if(ESign_Preference.equals("SMS")) 1127 {1128 driver.findElement(By.xpath("//*[@id='preferenceSms']")).click();1129 test.log(LogStatus.PASS, "Courtesy Call Consent is selected as "+ESign_Preference);1130 1131 try { 1132 Alert alert = driver.switchTo().alert();1133 alert.dismiss();1134 //if alert present, accept and move on. 1135 1136 }1137 catch (NoAlertPresentException e) {1138 //do what you normally would if you didn't have the alert.1139 }1140 }1141 1142 }1143 if(AllowPromotion.equals("Yes"))1144 {1145 driver.findElement(By.name("allowPromotion")).click();1146 test.log(LogStatus.PASS, "AllowPromotion is selected ");1147 //String mwh=driver.getWindowHandle();1148 driver.findElement(By.name("requestBean.siilBean.couponNbr")).sendKeys(CouponNbr);1149 test.log(LogStatus.PASS, "CouponNbr is selected as "+CouponNbr);1150 //String winHandle = driver.getWindowHandle(); //Get current window handle. 1151 }1152 driver.findElement(By.name("requestBean.password")).sendKeys(ESign_Password);1153 driver.findElement(By.name("finishLoan")).click();1154 test.log(LogStatus.PASS, "Click on Finish Loan Button");1155 for( String winHandle1 : driver.getWindowHandles())1156 {1157 driver.switchTo().window(winHandle1);1158 } 1159 driver.switchTo().defaultContent();1160 driver.switchTo().frame("mainFrame");1161 driver.switchTo().frame("main");1162 driver.findElement(By.xpath("//*[@id='OKBut']")).click(); 1163 //driver.findElement(By.name("OKBut")).click();1164 //driver.findElement(By.xpath("/html/body/form/table/tbody/tr/td/table/tbody/tr/td/table[2]/tbody/tr/td/input[1]")).click(); 1165 test.log(LogStatus.PASS, "click on Yes button ");1166 for( String winHandle1 : driver.getWindowHandles())1167 {1168 driver.switchTo().window(winHandle1);1169 } 1170 driver.switchTo().defaultContent();1171 driver.switchTo().frame("mainFrame");1172 driver.switchTo().frame("main");1173 if(driver.findElement(By.name("ok")).isDisplayed())1174 {1175 test.log(LogStatus.PASS, "New Loan is Completed Successfully ");1176 driver.findElement(By.name("ok")).click();1177 }1178 else1179 {1180 test.log(LogStatus.FAIL, "New Loan is not Completed Successfully ");1181 }1182 }1183 if(ProductID.equals("LOC"))1184 {1185 1186 driver.findElement(By.name("advanceRequestBean.paymentCollateralType")).sendKeys(ESign_CollateralType);1187 test.log(LogStatus.PASS, "CollateralType is selected as "+ESign_CollateralType);1188 Thread.sleep(5000);1189 driver.findElement(By.name("advanceRequestBean.courtesyCallFlag")).sendKeys(ESign_CourtesyCallConsent);1190 test.log(LogStatus.PASS, "Payment Reminder Consent is selected as "+ESign_CourtesyCallConsent);1191 driver.findElement(By.name("advanceRequestBean.emailConsentFlag")).sendKeys(ESign_CourtesyCallConsent);1192 test.log(LogStatus.PASS, "Payment Reminder Consent is selected as "+ESign_CourtesyCallConsent);1193 driver.findElement(By.name("requestBean.password")).sendKeys(ESign_Password);1194 driver.findElement(By.name("finishadvance")).click();1195 test.log(LogStatus.PASS, "Click on Finish LOC Button");1196 for( String winHandle1 : driver.getWindowHandles())1197 {1198 driver.switchTo().window(winHandle1);1199 } 1200 driver.switchTo().defaultContent();1201 driver.switchTo().frame("mainFrame");1202 driver.switchTo().frame("main");1203 driver.findElement(By.xpath("//*[@id='OKBut']")).click(); 1204 //driver.findElement(By.name("OKBut")).click();1205 //driver.findElement(By.xpath("/html/body/form/table/tbody/tr/td/table/tbody/tr/td/table[2]/tbody/tr/td/input[1]")).click(); 1206 test.log(LogStatus.PASS, "click on Yes button ");1207 for( String winHandle1 : driver.getWindowHandles())1208 {1209 driver.switchTo().window(winHandle1);1210 } 1211 driver.switchTo().defaultContent();1212 driver.switchTo().frame("mainFrame");1213 driver.switchTo().frame("main");1214 1215 if(driver.findElement(By.xpath("/html/body/form/table/tbody/tr/td/table/tbody/tr[2]/td/table[2]/tbody/tr/td[2]/input")).isDisplayed())1216 {1217 test.log(LogStatus.PASS, "New Loan is Completed Successfully ");1218 driver.findElement(By.xpath("/html/body/form/table/tbody/tr/td/table/tbody/tr[2]/td/table[2]/tbody/tr/td[2]/input")).click();1219 }1220 else1221 {1222 test.log(LogStatus.FAIL, "New Loan is not Completed Successfully ");1223 }1224 }1225 1226 //html/body/form/table/tbody/tr/td/table/tbody/tr/td/table[2]/tbody/tr[3]/td/input1227 }1228 1229 }1230 }1231 1232 }1233 1234 1235 1236 1237 1238 1239 public void AgeStore(String SSN,String FileName,int days) throws Exception1240 {1241 Excel TestData = new Excel("E:/QC_Workspace/AA_Automation/TestData/PDL/"+FileName); 1242 int lastrow=TestData.getLastRow("NewLoan");1243 System.out.println("NewLoan "+lastrow);1244 String sheetName="NewLoan"; 1245 for(int row=2;row<=lastrow;row++)1246 { 1247 String RegSSN = TestData.getCellData(sheetName,"SSN",row);1248 if(SSN.equals(RegSSN))1249 {1250 String TxnType=TestData.getCellData(sheetName,"TxnType",row);1251 String TenderType = TestData.getCellData(sheetName,"TenderType",row);1252 String ProductID=TestData.getCellData(sheetName,"ProductID",row);1253 String UserName = TestData.getCellData(sheetName,"UserName",row);1254 String Password = TestData.getCellData(sheetName,"Password",row);1255 String StoreID = TestData.getCellData(sheetName,"StoreID",row);1256 String AdminURL=TestData.getCellData(sheetName,"AdminURL",row);1257 System.out.println(AdminURL);1258 test.log(LogStatus.INFO, "Scheduler-Store Aging");1259 System.out.println(ProductID);1260 String AppURL = TestData.getCellData(sheetName,"AppURL",row);1261 appUrl = AppURL;1262 1263 this.Login(UserName,Password,StoreID);1264 1265 String SSN1 = SSN.substring(0, 3);1266 String SSN2 = SSN.substring(3,5);1267 String SSN3 = SSN.substring(5,9);1268 Thread.sleep(5000);1269 Thread.sleep(1000);1270 driver.switchTo().frame("topFrame");1271 driver.findElement(By.xpath("//*[contains(text(),'Loan Transactions')]")).click();1272 test.log(LogStatus.PASS, "Clicked on Loan Transactions");1273 driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);1274 driver.switchTo().defaultContent();1275 driver.switchTo().frame("mainFrame");1276 driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);1277 driver.findElement(By.cssSelector("li[id='911101']")).click();1278 test.log(LogStatus.PASS, "Clicked on Transactions");1279 driver.switchTo().frame("main");1280 driver.findElement(By.name("ssn1")).sendKeys(SSN1);1281 test.log(LogStatus.PASS, "SSN1 is entered: "+SSN1);1282 driver.findElement(By.name("ssn2")).sendKeys(SSN2);1283 test.log(LogStatus.PASS, "SSN2 is entered: "+SSN2);1284 driver.findElement(By.name("ssn3")).sendKeys(SSN3);1285 test.log(LogStatus.PASS, "SSN3 is entered: "+SSN3);1286 driver.findElement(By.name("submit1")).click();1287 test.log(LogStatus.PASS, "Click on submit Button");1288 for(String winHandle : driver.getWindowHandles()){1289 driver.switchTo().window(winHandle);1290 }1291 driver.switchTo().defaultContent();1292 driver.switchTo().frame("mainFrame");1293 driver.switchTo().frame("main");1294 driver.findElement(By.name("button")).click();1295 test.log(LogStatus.PASS, "Click on GO Button");1296 for(String winHandle : driver.getWindowHandles()){1297 driver.switchTo().window(winHandle);1298 }1299 driver.switchTo().defaultContent();1300 driver.switchTo().frame("mainFrame");1301 driver.switchTo().frame("main");1302 1303 if(ProductID.equals("PDL"))1304 {1305 ///html/body/form[1]/table/tbody/tr/td/table/tbody/tr/td/table[2]/tbody/tr[7]/td[2]/table/tbody/tr/td/table/tbody/tr[4]/td[11]/input[1]1306 driver.findElement(By.xpath("/html/body/form[1]/table/tbody/tr/td/table/tbody/tr/td/table[2]/tbody/tr[7]/td[2]/table/tbody/tr/td/table/tbody/tr[4]/td[11]/input[1]")).click();1307 }1308 // driver.findElement(By.name("button")).click();1309 test.log(LogStatus.PASS, "Click on GO Button");1310 for( String winHandle1 : driver.getWindowHandles())1311 {1312 driver.switchTo().window(winHandle1);1313 }1314 driver.switchTo().defaultContent();1315 driver.switchTo().frame("mainFrame");1316 driver.switchTo().frame("main");1317 driver.findElement(By.name("transactionList")).sendKeys("History");1318 1319 test.log(LogStatus.INFO, "transactionList as Selected : History " );1320 if(ProductID.equals("PDL"))1321 {1322 driver.findElement(By.id("go_Button")).click();1323 1324 test.log(LogStatus.PASS, "Click on GO Button");1325 }1326 for( String winHandle1 : driver.getWindowHandles())1327 {1328 driver.switchTo().window(winHandle1);1329 }1330 driver.switchTo().defaultContent();1331 driver.switchTo().frame("mainFrame");1332 driver.switchTo().frame("main");1333 String DueDate=null;1334 //String LoanAmount = null;1335 1336 //*[@id="transactionHistoryTable"]/tbody/tr/td[3]/table/tbody/tr[4]/td/span[2]1337 DueDate = driver.findElement(By.xpath("//*[@id='transactionHistoryTable']/tbody/tr/td[3]/table/tbody/tr[4]/td/span[2]")).getText();1338 //LoanAmount = driver.findElement(By.xpath("//*[@id='transactionHistoryTable']/tbody/tr/td[4]/table/tbody/tr[5]/td/span[2]")).getText();1339 test.log(LogStatus.PASS, "Capture DueDate"+DueDate);1340 //DueDate=driver.findElement(By.xpath("//*[@id='revolvingCreditHistTable']/tbody/tr[4]/td[3]/span[2]")).getText();1341 System.out.print(DueDate);1342 driver.close();1343 driver = new InternetExplorerDriver();1344 driver.get(AdminURL);1345 test.log(LogStatus.INFO, "AdminUrl:"+AdminURL);1346 // storeupdate(UserName,Password,StoreID,DueDate,AdminURL);1347 1348 DateFormat df=new SimpleDateFormat("MM/dd/yyyy");1349 driver.findElement(By.name("loginRequestBean.userId")).sendKeys("admin");1350 test.log(LogStatus.PASS, "Username is entered: admin");1351 driver.findElement(By.name("loginRequestBean.password")).sendKeys(Password);1352 test.log(LogStatus.PASS, "Password is entered: "+Password);1353 //Click Login Button1354 driver.findElement(By.name("login")).click();1355 test.log(LogStatus.PASS, "Clicked on Submit button");1356 Thread.sleep(8000);1357 driver.switchTo().defaultContent();1358 driver.switchTo().frame("topFrame");1359 driver.findElement(By.xpath("//*[contains(text(),'Transactions')]")).click();1360 test.log(LogStatus.PASS, "Clicked on Transactions");1361 driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);1362 driver.switchTo().defaultContent();1363 driver.switchTo().frame("mainFrame");1364 driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);1365 driver.findElement(By.linkText("Borrower")).click();1366 test.log(LogStatus.PASS, "Clicked on Borrower");1367 Thread.sleep(5000);1368 1369 driver.findElement(By.linkText("Process Date Change")).click();1370 test.log(LogStatus.PASS, "Clicked on Process Date Change");1371 driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);1372 1373 driver.switchTo().defaultContent();1374 driver.switchTo().frame("mainFrame");1375 WebElement elements1 = driver.findElement(By.linkText("Daily Jobs"));1376 test.log(LogStatus.PASS, "Click on Daily Jobs");1377 Actions actions1 = new Actions(driver); 1378 actions1.moveToElement(elements1).build().perform();1379 driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);1380 String DDueDate[] =DueDate.split("/");1381 //String date = DDueDate[1];1382 Date DDueDateminus1 = df.parse(DueDate);1383 Calendar cal = Calendar.getInstance();1384 cal.setTime(DDueDateminus1);1385 cal.add(Calendar.DATE, days);1386 Date DDueDate1= cal.getTime();1387 DueDate =df.format(DDueDate1);1388 String DueDate0[] =DueDate.split("/");1389 String DueDate1 = DueDate0[0];1390 String DueDate2 = DueDate0[1];1391 String DueDate3 = DueDate0[2];1392 driver.switchTo().defaultContent();1393 driver.switchTo().frame("mainFrame");1394 driver.switchTo().frame("main");1395 driver.findElement(By.name("storeCode")).click();1396 test.log(LogStatus.PASS, "Click on Store Edit Box");1397 1398 //driver.findElement(By.xpath("/html/body/form/table/tbody/tr/td/table/tbody/tr/td")).click();1399 driver.findElement(By.name("storeCode")).sendKeys(StoreID);1400 test.log(LogStatus.PASS, "Store number is entered: "+StoreID);1401 Thread.sleep(5000);1402 driver.findElement(By.name("beginMonth")).clear();1403 driver.findElement(By.name("beginMonth")).sendKeys(DueDate1);1404 test.log(LogStatus.PASS, "beginMonth is entered: "+DueDate1);1405 driver.findElement(By.name("beginDay")).clear();1406 driver.findElement(By.name("beginDay")).sendKeys(DueDate2);1407 test.log(LogStatus.PASS, "beginDay is entered: "+DueDate2);1408 driver.findElement(By.name("beginYear")).clear();1409 driver.findElement(By.name("beginYear")).sendKeys(DueDate3);1410 test.log(LogStatus.PASS, "beginYear is entered: "+DueDate3);1411 Thread.sleep(2000);1412 driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);1413 Thread.sleep(1000);1414 Thread.sleep(5000);1415 driver.findElement(By.name("btnPreview")).click();1416 test.log(LogStatus.PASS, "Clicked on submit button");1417 Thread.sleep(5000);1418 driver.switchTo().defaultContent();1419 driver.switchTo().frame("mainFrame");1420 driver.switchTo().frame("main");1421 if( driver.findElement(By.xpath("/html/body/form/table[1]/tbody/tr/td/table/tbody/tr/td/table/tbody/tr[2]/td[2]/table/tbody/tr[2]/td/input")).isDisplayed())1422 {1423 test.log(LogStatus.PASS, "Process Date updated successfully");1424 1425 driver.findElement(By.xpath("/html/body/form/table[1]/tbody/tr/td/table/tbody/tr/td/table/tbody/tr[2]/td[2]/table/tbody/tr[2]/td/input")).click();1426 }1427 else1428 {1429 1430 test.log(LogStatus.PASS, "Process Date not updated successfully");1431 }1432 }1433 }1434 }1435 1436 1437 1438 1439 public void PaymentDueDate (String SSN,String FileName,int days) throws Exception1440 {1441 Excel TestData = new Excel("E:/QC_Workspace/AA_Automation/TestData/PDL/"+FileName); 1442 int lastrow=TestData.getLastRow("NewLoan");1443 System.out.println("NewLoan "+lastrow);1444 String sheetName="NewLoan"; 1445 for(int row=2;row<=lastrow;row++)1446 { 1447 String RegSSN = TestData.getCellData(sheetName,"SSN",row);1448 if(SSN.equals(RegSSN))1449 {1450 String TxnType=TestData.getCellData(sheetName,"TxnType",row);1451 String TenderType = TestData.getCellData(sheetName,"TenderType",row);1452 String ProductID=TestData.getCellData(sheetName,"ProductID",row);1453 String UserName = TestData.getCellData(sheetName,"UserName",row);1454 String Password = TestData.getCellData(sheetName,"Password",row);1455 String StoreID = TestData.getCellData(sheetName,"StoreID",row);1456 String AdminURL=TestData.getCellData(sheetName,"AdminURL",row);1457 System.out.println(AdminURL);1458 test.log(LogStatus.INFO, "Scheduler-Store Aging");1459 System.out.println(ProductID);1460 String AppURL = TestData.getCellData(sheetName,"AppURL",row);1461 appUrl = AppURL;1462 1463 this.Login(UserName,Password,StoreID);1464 1465 String SSN1 = SSN.substring(0, 3);1466 String SSN2 = SSN.substring(3,5);1467 String SSN3 = SSN.substring(5,9);1468 Thread.sleep(5000);1469 Thread.sleep(1000);1470 driver.switchTo().frame("topFrame");1471 driver.findElement(By.xpath("//*[contains(text(),'Loan Transactions')]")).click();1472 test.log(LogStatus.PASS, "Clicked on Loan Transactions");1473 driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);1474 driver.switchTo().defaultContent();1475 driver.switchTo().frame("mainFrame");1476 driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);1477 driver.findElement(By.cssSelector("li[id='911101']")).click();1478 test.log(LogStatus.PASS, "Clicked on Transactions");1479 driver.switchTo().frame("main");1480 driver.findElement(By.name("ssn1")).sendKeys(SSN1);1481 test.log(LogStatus.PASS, "SSN1 is entered: "+SSN1);1482 driver.findElement(By.name("ssn2")).sendKeys(SSN2);1483 test.log(LogStatus.PASS, "SSN2 is entered: "+SSN2);1484 driver.findElement(By.name("ssn3")).sendKeys(SSN3);1485 test.log(LogStatus.PASS, "SSN3 is entered: "+SSN3);1486 driver.findElement(By.name("submit1")).click();1487 test.log(LogStatus.PASS, "Click on submit Button");1488 for(String winHandle : driver.getWindowHandles()){1489 driver.switchTo().window(winHandle);1490 }1491 driver.switchTo().defaultContent();1492 driver.switchTo().frame("mainFrame");1493 driver.switchTo().frame("main");1494 driver.findElement(By.name("button")).click();1495 test.log(LogStatus.PASS, "Click on GO Button");1496 for(String winHandle : driver.getWindowHandles()){1497 driver.switchTo().window(winHandle);1498 }1499 driver.switchTo().defaultContent();1500 driver.switchTo().frame("mainFrame");1501 driver.switchTo().frame("main");1502 1503 if(ProductID.equals("PDL"))1504 {1505 ///html/body/form[1]/table/tbody/tr/td/table/tbody/tr/td/table[2]/tbody/tr[7]/td[2]/table/tbody/tr/td/table/tbody/tr[4]/td[11]/input[1]1506 driver.findElement(By.xpath("/html/body/form[1]/table/tbody/tr/td/table/tbody/tr/td/table[2]/tbody/tr[7]/td[2]/table/tbody/tr/td/table/tbody/tr[4]/td[11]/input[1]")).click();1507 }1508 // driver.findElement(By.name("button")).click();1509 test.log(LogStatus.PASS, "Click on GO Button");1510 for( String winHandle1 : driver.getWindowHandles())1511 {1512 driver.switchTo().window(winHandle1);1513 }1514 driver.switchTo().defaultContent();1515 driver.switchTo().frame("mainFrame");1516 driver.switchTo().frame("main");1517 driver.findElement(By.name("transactionList")).sendKeys("History");1518 1519 test.log(LogStatus.INFO, "transactionList as Selected : History " );1520 if(ProductID.equals("PDL"))1521 {1522 driver.findElement(By.id("go_Button")).click();1523 1524 test.log(LogStatus.PASS, "Click on GO Button");1525 }1526 for( String winHandle1 : driver.getWindowHandles())1527 {1528 driver.switchTo().window(winHandle1);1529 }1530 driver.switchTo().defaultContent();1531 driver.switchTo().frame("mainFrame");1532 driver.switchTo().frame("main");1533 String DueDate=null;1534 //String LoanAmount = null;1535 1536 //*[@id="transactionHistoryTable"]/tbody/tr/td[3]/table/tbody/tr[4]/td/span[2]1537 DueDate = driver.findElement(By.xpath("//*[@id='payPlanHistoryTable']/tbody/tr[3]/td[3]")).getText();1538 //LoanAmount = driver.findElement(By.xpath("//*[@id='transactionHistoryTable']/tbody/tr/td[4]/table/tbody/tr[5]/td/span[2]")).getText();1539 test.log(LogStatus.PASS, "Capture DueDate"+DueDate);1540 //DueDate=driver.findElement(By.xpath("//*[@id='revolvingCreditHistTable']/tbody/tr[4]/td[3]/span[2]")).getText();1541 System.out.print(DueDate);1542 driver.close();1543 driver = new InternetExplorerDriver();1544 driver.get(AdminURL);1545 test.log(LogStatus.INFO, "AdminUrl:"+AdminURL);1546 // storeupdate(UserName,Password,StoreID,DueDate,AdminURL);1547 1548 DateFormat df=new SimpleDateFormat("MM/dd/yyyy");1549 driver.findElement(By.name("loginRequestBean.userId")).sendKeys("admin");1550 test.log(LogStatus.PASS, "Username is entered: admin");1551 driver.findElement(By.name("loginRequestBean.password")).sendKeys(Password);1552 test.log(LogStatus.PASS, "Password is entered: "+Password);1553 //Click Login Button1554 driver.findElement(By.name("login")).click();1555 test.log(LogStatus.PASS, "Clicked on Submit button");1556 Thread.sleep(8000);1557 driver.switchTo().defaultContent();1558 driver.switchTo().frame("topFrame");1559 driver.findElement(By.xpath("//*[contains(text(),'Transactions')]")).click();1560 test.log(LogStatus.PASS, "Clicked on Transactions");1561 driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);1562 driver.switchTo().defaultContent();1563 driver.switchTo().frame("mainFrame");1564 driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);1565 driver.findElement(By.linkText("Borrower")).click();1566 test.log(LogStatus.PASS, "Clicked on Borrower");1567 Thread.sleep(5000);1568 1569 driver.findElement(By.linkText("Process Date Change")).click();1570 test.log(LogStatus.PASS, "Clicked on Process Date Change");1571 driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);1572 1573 driver.switchTo().defaultContent();1574 driver.switchTo().frame("mainFrame");1575 WebElement elements1 = driver.findElement(By.linkText("Daily Jobs"));1576 test.log(LogStatus.PASS, "Click on Daily Jobs");1577 Actions actions1 = new Actions(driver); 1578 actions1.moveToElement(elements1).build().perform();1579 driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);1580 String DDueDate[] =DueDate.split("/");1581 //String date = DDueDate[1];1582 Date DDueDateminus1 = df.parse(DueDate);1583 Calendar cal = Calendar.getInstance();1584 cal.setTime(DDueDateminus1);1585 cal.add(Calendar.DATE, days);1586 Date DDueDate1= cal.getTime();1587 DueDate =df.format(DDueDate1);1588 String DueDate0[] =DueDate.split("/");1589 String DueDate1 = DueDate0[0];1590 String DueDate2 = DueDate0[1];1591 String DueDate3 = DueDate0[2];1592 driver.switchTo().defaultContent();1593 driver.switchTo().frame("mainFrame");1594 driver.switchTo().frame("main");1595 driver.findElement(By.name("storeCode")).click();1596 test.log(LogStatus.PASS, "Click on Store Edit Box");1597 1598 //driver.findElement(By.xpath("/html/body/form/table/tbody/tr/td/table/tbody/tr/td")).click();1599 driver.findElement(By.name("storeCode")).sendKeys(StoreID);1600 test.log(LogStatus.PASS, "Store number is entered: "+StoreID);1601 Thread.sleep(5000);1602 driver.findElement(By.name("beginMonth")).clear();1603 driver.findElement(By.name("beginMonth")).sendKeys(DueDate1);1604 test.log(LogStatus.PASS, "beginMonth is entered: "+DueDate1);1605 driver.findElement(By.name("beginDay")).clear();1606 driver.findElement(By.name("beginDay")).sendKeys(DueDate2);1607 test.log(LogStatus.PASS, "beginDay is entered: "+DueDate2);1608 driver.findElement(By.name("beginYear")).clear();1609 driver.findElement(By.name("beginYear")).sendKeys(DueDate3);1610 test.log(LogStatus.PASS, "beginYear is entered: "+DueDate3);1611 Thread.sleep(2000);1612 driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);1613 Thread.sleep(1000);1614 Thread.sleep(5000);1615 driver.findElement(By.name("btnPreview")).click();1616 test.log(LogStatus.PASS, "Clicked on submit button");1617 Thread.sleep(5000);1618 driver.switchTo().defaultContent();1619 driver.switchTo().frame("mainFrame");1620 driver.switchTo().frame("main");1621 if( driver.findElement(By.xpath("/html/body/form/table[1]/tbody/tr/td/table/tbody/tr/td/table/tbody/tr[2]/td[2]/table/tbody/tr[2]/td/input")).isDisplayed())1622 {1623 test.log(LogStatus.PASS, "Process Date updated successfully");1624 1625 driver.findElement(By.xpath("/html/body/form/table[1]/tbody/tr/td/table/tbody/tr/td/table/tbody/tr[2]/td[2]/table/tbody/tr[2]/td/input")).click();1626 }1627 else1628 {1629 1630 test.log(LogStatus.PASS, "Process Date not updated successfully");1631 }1632 }1633 }1634 }1635 1636 1637 public void DrawerDeassign(String SSN,String FileName) throws Exception{1638 Excel TestData = new Excel("E:/QC_Workspace/AA_Automation/TestData/PDL/"+FileName); int lastrow=TestData.getLastRow("NewLoan");1639 System.out.println("NewLoan "+lastrow);1640 String sheetName="NewLoan"; 1641 for(int row=2;row<=lastrow;row++)1642 { 1643 String RegSSN = TestData.getCellData(sheetName,"SSN",row);1644 if(SSN.equals(RegSSN))1645 {1646 String TxnType=TestData.getCellData(sheetName,"TxnType",row);1647 String TenderType = TestData.getCellData(sheetName,"TenderType",row); 1648 String ProductID=TestData.getCellData(sheetName,"ProductID",row);1649 String AppURL = TestData.getCellData(sheetName,"AppURL",row);1650 String UserName = TestData.getCellData(sheetName,"UserName",row);1651 String Password = TestData.getCellData(sheetName,"Password",row);1652 String StoreId = TestData.getCellData(sheetName,"StoreID",row);1653 String SSN1 = SSN.substring(0, 3);1654 String SSN2 = SSN.substring(3,5);1655 String SSN3 = SSN.substring(5,9);1656 CSRLoginpage login = new CSRLoginpage();1657 login.Login(UserName, Password, StoreId, driver, AppURL, test);1658 Thread.sleep(5000);1659 driver.switchTo().defaultContent(); 1660 driver.switchTo().frame("topFrame");1661 driver.findElement(By.xpath("//*[contains(text(),'Cash Management')]")).click(); 1662 test.log(LogStatus.PASS, "Clicked on Cash Management");1663 Thread.sleep(1000);1664 driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);1665 driver.switchTo().defaultContent();1666 driver.switchTo().frame("mainFrame");1667 driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);1668 //driver.findElement(By.cssSelector("li[id='911101']")).click(); 1669 driver.findElement(By.linkText("Drawer")).click();1670 test.log(LogStatus.PASS, "Clicked on Drawer"); 1671 driver.findElement(By.linkText("Deassign")).click();1672 test.log(LogStatus.PASS, "Clicked on Deassign"); 1673 driver.switchTo().frame("main"); 1674 driver.findElement(By.name("drawerDeassignRequestBean.noOfDollars")).sendKeys("0");1675 test.log(LogStatus.PASS, "Current Cash Balance is provided as 0"); 1676 //driver.findElement(By.name("drawerDeassignRequestBean.currentCashBalance")).sendKeys("0");1677 driver.findElement(By.name("drawerDeassignRequestBean.password")).sendKeys(Password);1678 test.log(LogStatus.PASS, "Banker PIN# is enetered as"+Password); 1679 driver.findElement(By.name("drawerdeassign")).click();1680 test.log(LogStatus.PASS, "Click on Finish De-assign Button");1681 try{1682 driver.close();1683 }1684 catch (Exception e) {1685 //do what you normally would if you didn't have the alert.1686 }1687 Thread.sleep(2000);1688 driver.findElement(By.name("drawerDeassignRequestBean.noOfDollars")).clear();1689 driver.findElement(By.name("drawerDeassignRequestBean.noOfDollars")).sendKeys("0");1690 test.log(LogStatus.PASS, "Current Cash Balance is provided as 0"); 1691 Thread.sleep(2000);1692 driver.findElement(By.name("drawerDeassignRequestBean.password")).sendKeys(Password); 1693 driver.findElement(By.name("drawerdeassign")).click();1694 for(String winHandle : driver.getWindowHandles()){1695 driver.switchTo().window(winHandle);1696 }1697 driver.switchTo().defaultContent();1698 driver.switchTo().frame("mainFrame");1699 driver.switchTo().frame("main");1700 if(driver.findElement(By.xpath("/html/body/form/table/tbody/tr/td/table/tbody/tr/td/table[3]/tbody/tr[9]/td[2]/table")).isDisplayed())1701 {1702 WebElement htmltable=driver.findElement(By.xpath("/html/body/form/table/tbody/tr/td/table/tbody/tr/td/table[3]/tbody/tr[9]/td[2]/table")); 1703 1704 List<WebElement> rows=htmltable.findElements(By.tagName("tr"));1705 System.out.println("current row num "+rows.size());1706 int count=0; 1707 count=driver.findElements(By.xpath("/html/body/form/table/tbody/tr/td/table/tbody/tr/td/table[3]/tbody/tr[9]/td[2]/table/tbody/tr")).size(); 1708 for(int rnum=1;rnum<rows.size();rnum++)1709 { 1710 System.out.println("current row num "+rnum); 1711 //List<WebElement> columns=rows.get(rnum).findElements(By.tagName("td")); 1712 1713 driver.findElement(By.xpath("/html/body/form/table/tbody/tr/td/table/tbody/tr/td/table[3]/tbody/tr[9]/td[2]/table/tbody/tr[2]/td[5]/select")).sendKeys("Delete");1714 driver.findElement(By.xpath("/html/body/form/table/tbody/tr/td/table/tbody/tr/td/table[3]/tbody/tr[9]/td[2]/table/tbody/tr[2]/td[6]/input")).click(); 1715 try { 1716 Alert alert = driver.switchTo().alert();1717 alert.accept();1718 //if alert present, accept and move on. 1719 }1720 catch (NoAlertPresentException e) {1721 //do what you normally would if you didn't have the alert.1722 }1723 Thread.sleep(5000);1724 }1725 }1726 String DrawerOverShortAmount =driver.findElement(By.name("drawerRequestBean.drawerOverShort")).getAttribute("value");1727 driver.findElement(By.name("drawerRequestBean.amount")).sendKeys(DrawerOverShortAmount);1728 test.log(LogStatus.PASS, "Amount entered as "+DrawerOverShortAmount);1729 driver.findElement(By.name("drawerRequestBean.primary")).sendKeys("Cash Handling");1730 test.log(LogStatus.PASS, "Primary Reason is selected as Cash Handling");1731 driver.findElement(By.name("drawerRequestBean.notes")).sendKeys("Notes");1732 test.log(LogStatus.PASS, "Notes Entered "); 1733 driver.findElement(By.name("bt_AddDrawer")).click();1734 test.log(LogStatus.PASS, "Click on Add O/S Instance Button"); 1735 Thread.sleep(3000);1736 driver.findElement(By.name("transactionDataBean.password")).sendKeys(Password);1737 driver.findElement(By.xpath("/html/body/form/table/tbody/tr/td/table/tbody/tr/td/table[4]/tbody/tr[3]/td[1]/input")).click();1738 test.log(LogStatus.PASS, "Click on Finish Drawer O/S");1739 try { 1740 Alert alert = driver.switchTo().alert();1741 alert.accept();1742 //if alert present, accept and move on. 1743 }1744 catch (NoAlertPresentException e) {1745 //do what you normally would if you didn't have the alert.1746 }1747 for(String winHandle : driver.getWindowHandles()){1748 driver.switchTo().window(winHandle);1749 } 1750 driver.switchTo().defaultContent();1751 driver.switchTo().frame("mainFrame");1752 driver.switchTo().frame("main");1753 if(driver.findElement(By.xpath("/html/body/form/table/tbody/tr/td/table/tbody/tr/td/table[2]/tbody/tr/td/input")).isDisplayed())1754 {1755 test.log(LogStatus.PASS,"Drawer De-assigned successfully with over/short.");1756 driver.findElement(By.xpath("/html/body/form/table/tbody/tr/td/table/tbody/tr/td/table[2]/tbody/tr/td/input")).click();1757 }1758 else1759 {1760 test.log(LogStatus.PASS,"Drawer not De-assigned successfully with over/short.");1761 }1762 }1763 }1764 }1765 1766 1767 public void EODProcessing(String SSN,String FileName) throws Exception{1768 Excel TestData = new Excel("E:/QC_Workspace/AA_Automation/TestData/PDL/"+FileName); 1769 int lastrow=TestData.getLastRow("NewLoan");1770 System.out.println("NewLoan "+lastrow);1771 String sheetName="NewLoan"; 1772 for(int row=2;row<=lastrow;row++)1773 { 1774 String RegSSN = TestData.getCellData(sheetName,"SSN",row);1775 if(SSN.equals(RegSSN))1776 {1777 String TxnType=TestData.getCellData(sheetName,"TxnType",row);1778 String TenderType = TestData.getCellData(sheetName,"TenderType",row); 1779 String ProductID=TestData.getCellData(sheetName,"ProductID",row);1780 String AppURL = TestData.getCellData(sheetName,"AppURL",row);1781 String UserName = TestData.getCellData(sheetName,"UserName",row);1782 String Password = TestData.getCellData(sheetName,"Password",row);1783 String StoreId = TestData.getCellData(sheetName,"StoreID",row);1784 String SSN1 = SSN.substring(0, 3);1785 String SSN2 = SSN.substring(3,5);1786 String SSN3 = SSN.substring(5,9);1787 CSRLoginpage login = new CSRLoginpage();1788 login.Login(UserName, Password, StoreId, driver, AppURL, test);1789 Thread.sleep(5000); 1790 driver.switchTo().defaultContent(); 1791 driver.switchTo().frame("topFrame");1792 driver.findElement(By.xpath("//*[contains(text(),'Daily Processing')]")).click(); 1793 test.log(LogStatus.PASS, "Clicked on Daily Processing");1794 Thread.sleep(1000);1795 driver.switchTo().defaultContent();1796 driver.switchTo().frame("mainFrame");1797 driver.findElement(By.name("eod")).click();1798 for(String winHandle : driver.getWindowHandles()){1799 driver.switchTo().window(winHandle);1800 }1801 driver.switchTo().defaultContent();1802 driver.switchTo().frame("mainFrame");1803 //driver.switchTo().frame("main");1804 driver.findElement(By.name("requestBean.noOf100Dollars")).sendKeys("500");1805 test.log(LogStatus.PASS,"Count of Dollar Coins is entered as 500");1806 Thread.sleep(4000);1807 // driver.findElement(By.name("requestBean.comments")).click();1808 driver.findElement(By.name("requestBean.comments")).sendKeys("comment");1809 test.log(LogStatus.PASS,"Count of Dollar Coins is entered as comment");1810 // requestBean.comments1811 Thread.sleep(4000);1812 driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);1813 driver.findElement(By.name("Submit2")).click();1814 test.log(LogStatus.PASS,"Clicked on Balance Safe");1815 Thread.sleep(4000);1816 try { 1817 Alert alert = driver.switchTo().alert();1818 alert.accept();1819 //if alert present, accept and move on. 1820 }1821 catch (NoAlertPresentException e) {1822 //do what you normally would if you didn't have the alert.1823 }1824 driver.switchTo().defaultContent();1825 driver.switchTo().frame("mainFrame");1826 driver.findElement(By.name("Submit2")).click();1827 test.log(LogStatus.PASS,"Clicked on Balance Safe");1828 Thread.sleep(1000);1829 for(String winHandle : driver.getWindowHandles()){1830 driver.switchTo().window(winHandle);1831 } 1832 driver.switchTo().defaultContent();1833 driver.switchTo().frame("mainFrame");1834 String SafeOverShortAmount = driver.findElement(By.name("diffCashBal")).getAttribute("value");1835 //String SafeOverShortAmount = driver.findElement(By.name("requestBean.safeOverShort")).getAttribute("value");1836 driver.findElement(By.name("requestBean.amount")).sendKeys(SafeOverShortAmount);1837 /// /html/body/form[1]/table/tbody/tr/td/table/tbody/tr/td/table[2]/tbody/tr[3]/td/table/tbody/tr[7]/td[3]1838 // driver.findElement(By.name("requestBean.amount")).sendKeys("SafeOverShortAmount");1839 test.log(LogStatus.PASS,"Enter the Balance 50");1840 driver.findElement(By.name("requestBean.primary")).sendKeys("Deposit Issue");1841 test.log(LogStatus.PASS, "Primary Reason is selected as Deposit Issue");1842 driver.findElement(By.name("requestBean.notes")).sendKeys("Notes");1843 test.log(LogStatus.PASS, "Notes Entered "); 1844 driver.findElement(By.name("bt_AddDrawer")).click();1845 test.log(LogStatus.PASS, "Click on Add O/S Instance Button"); 1846 Thread.sleep(3000);1847 driver.findElement(By.xpath("/html/body/form[1]/table/tbody/tr/td/table/tbody/tr/td/table[3]/tbody/tr[11]/td[3]/input")).click();1848 // /html/body/form[1]/table/tbody/tr/td/table/tbody/tr/td/table[3]/tbody/tr[11]/td[3]/input1849 test.log(LogStatus.PASS, "Clicked on Next");1850 try { 1851 Alert alert = driver.switchTo().alert();1852 alert.accept();1853 //if alert present, accept and move on. 1854 }1855 catch (NoAlertPresentException e) {1856 //do what you normally would if you didn't have the alert.1857 }1858 Thread.sleep(1000);1859 for(String winHandle : driver.getWindowHandles()){1860 driver.switchTo().window(winHandle);1861 } 1862 driver.switchTo().defaultContent();1863 driver.switchTo().frame("mainFrame");1864 driver.findElement(By.name("Next"));1865 // Next1866 test.log(LogStatus.PASS, "Clicked on Next");1867 for(String winHandle : driver.getWindowHandles()){1868 driver.switchTo().window(winHandle);1869 } 1870 driver.switchTo().defaultContent();1871 driver.switchTo().frame("mainFrame");1872 driver.findElement(By.xpath("/html/body/form/table/tbody/tr[1]/td/table/tbody/tr/td/table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td[2]/input[3]")).click();1873 test.log(LogStatus.PASS, "Clicked on Next");1874 for(String winHandle : driver.getWindowHandles()){1875 driver.switchTo().window(winHandle);1876 } 1877 driver.switchTo().defaultContent();1878 driver.switchTo().frame("mainFrame");1879 driver.findElement(By.xpath("/html/body/form/table/tbody/tr/td/table/tbody/tr/td/table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td[2]/input[3]")).click();1880 test.log(LogStatus.PASS, "Clicked on Next");1881 driver.findElement(By.name("requestBean.bagNbr")).sendKeys("34");1882 test.log(LogStatus.PASS, "Bag number is provided as 34");1883 driver.findElement(By.name("finishdeposit")).click();1884 test.log(LogStatus.PASS, "Clicked on Finish Deposit");1885 test.log(LogStatus.PASS, "StatmentGeneration EOD Processing Completed");1886 1887 Thread.sleep(4000);1888 try { 1889 Alert alert = driver.switchTo().alert();1890 alert.accept();1891 //if alert present, accept and move on. 1892 }1893 catch (NoAlertPresentException e) {1894 //do what you normally would if you didn't have the alert.1895 }1896 }1897 }1898 }1899 public void StoreInfo(String SSN,String FileName) throws Exception1900 {1901 1902 Excel TestData = new Excel("E:/QC_Workspace/AA_Automation/TestData/PDL/"+FileName); 1903 int lastrow=TestData.getLastRow("NewLoan");1904 System.out.println("NewLoan "+lastrow);1905 String sheetName="NewLoan"; 1906 for(int row=2;row<=lastrow;row++)1907 { 1908 String RegSSN = TestData.getCellData(sheetName,"SSN",row);1909 if(SSN.equals(RegSSN))1910 {1911 String TxnType=TestData.getCellData(sheetName,"TxnType",row);1912 String TenderType = TestData.getCellData(sheetName,"TenderType",row); 1913 String ProductID=TestData.getCellData(sheetName,"ProductID",row);1914 String UserName = TestData.getCellData(sheetName,"UserName",row);1915 String Password = TestData.getCellData(sheetName,"Password",row);1916 String StoreID = TestData.getCellData(sheetName,"StoreID",row);1917 String AdminURL=TestData.getCellData(sheetName,"AdminURL",row);1918 System.out.println(AdminURL);1919 1920 driver.get(AdminURL);1921 Thread.sleep(1000);1922 1923 1924 1925 driver.findElement(By.name("loginRequestBean.userId")).sendKeys("admin");1926 test.log(LogStatus.PASS, "Username is entered: "+UserName); 1927 driver.findElement(By.name("loginRequestBean.password")).sendKeys(Password);1928 test.log(LogStatus.PASS, "Password is entered: "+Password); 1929 //Click Login Button1930 driver.findElement(By.name("login")).click();1931 test.log(LogStatus.PASS, "Clicked on Submit button");1932 Thread.sleep(10000);1933 driver.switchTo().frame("topFrame");1934 driver.findElement(By.xpath("//*[contains(text(),'Store Setup')]")).click(); 1935 test.log(LogStatus.PASS, "Clicked on Store Setup");1936 Thread.sleep(10000);1937 driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);1938 driver.switchTo().defaultContent();1939 driver.switchTo().frame("mainFrame");1940 Thread.sleep(10000);1941 driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS); 1942 driver.findElement(By.linkText("Store Config")).click();1943 //Store Config1944 /*WebElement element= driver.findElement(By.cssSelector("li[id='101000']")); 1945 Actions action = new Actions(driver);1946 action.moveToElement(element).perform();1947 WebElement subElement = driver.findElement(By.cssSelector("li[id='101020']")); 1948 action.moveToElement(subElement).perform(); 1949 action.click(); */1950 driver.findElement(By.linkText("Edit Store")).click();1951 // action.perform();1952 // driver.findElement(By.cssSelector("li[id='101020']")).click();1953 test.log(LogStatus.PASS, "Clicked on Store Config");1954 1955 test.log(LogStatus.PASS, "Clicked on Edit Store"); 1956 driver.switchTo().frame("main"); 1957 driver.findElement(By.name("locationBean.locNbr")).sendKeys(StoreID);1958 test.log(LogStatus.PASS, "Store number is entered: "+StoreID);1959 driver.findElement(By.name("Submit2")).click();1960 test.log(LogStatus.PASS, "Clicked on submit button");1961 for(String winHandle : driver.getWindowHandles()){1962 driver.switchTo().window(winHandle);1963 } 1964 1965 1966 driver.switchTo().defaultContent();1967 driver.switchTo().frame("mainFrame");1968 driver.switchTo().frame("main"); 1969 driver.findElement(By.name("locationBean.locStatusCd")).sendKeys("Crash Package");1970 // test.log(LogStatus.PASS, "Store Info Status is Chenged: "+Storestaus);1971 1972 //locationBean.locStatusCd1973 1974 1975 1976 driver.switchTo().defaultContent();1977 driver.switchTo().frame("mainFrame");1978 driver.switchTo().frame("main"); 1979 if(driver.findElement(By.name("submitButton")).isDisplayed())1980 {1981 test.log(LogStatus.PASS, "Store Aging is Successfully ");1982 driver.findElement(By.name("submitButton")).click();1983 }1984 else1985 {1986 test.log(LogStatus.FAIL, "Store Aging is not Successfully ");1987 }1988 //driver.close();1989 }1990 }1991 }1992 1993 public void Safeassign(String SSN,String FileName) throws Exception{1994 1995 Excel TestData = new Excel("E:/QC_Workspace/AA_Automation/TestData/PDL/"+FileName); int lastrow=TestData.getLastRow("NewLoan");1996 System.out.println("NewLoan "+lastrow);1997 String sheetName="NewLoan"; 1998 for(int row=2;row<=lastrow;row++)1999 { 2000 String RegSSN = TestData.getCellData(sheetName,"SSN",row);2001 if(SSN.equals(RegSSN))2002 {2003 String TxnType=TestData.getCellData(sheetName,"TxnType",row);2004 String TenderType = TestData.getCellData(sheetName,"TenderType",row); 2005 String ProductID=TestData.getCellData(sheetName,"ProductID",row);2006 String AppURL = TestData.getCellData(sheetName,"AppURL",row);2007 String UserName = TestData.getCellData(sheetName,"UserName",row);2008 String Password = TestData.getCellData(sheetName,"Password",row);2009 String StoreId = TestData.getCellData(sheetName,"StoreID",row);2010 CSRLoginpage login = new CSRLoginpage();2011 login.Login(UserName, Password, StoreId, driver, AppURL, test);2012 Thread.sleep(5000);2013 /*driver.switchTo().defaultContent(); 2014 driver.switchTo().frame("topFrame");2015 driver.findElement(By.xpath("//*[contains(text(),'Cash Management')]")).click(); 2016 test.log(LogStatus.PASS, "Clicked on Cash Management");2017 Thread.sleep(1000);2018 driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);2019 driver.switchTo().defaultContent();2020 driver.switchTo().frame("mainFrame");2021 //driver.switchTo().frame("main");2022 driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);2023 //driver.findElement(By.cssSelector("li[id='911101']")).click(); 2024 driver.findElement(By.linkText("Safe")).click();2025 test.log(LogStatus.PASS, "Clicked on safe"); 2026 //driver.findElement(By.xpath("//*[@id="931010"]/a']")).click();2027 //driver.findElement(By.linkText("Drawer")).click();2028 2029 driver.findElement(By.linkText("Assign")).click();2030 test.log(LogStatus.PASS, "Clicked on Assign");2031 2032 2033 driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);2034 2035 driver.switchTo().defaultContent();2036 driver.switchTo().frame("mainFrame");2037 driver.switchTo().frame("main");2038 2039 2040 //if(driver.findElement(By.name("previous")).isDisplayed())2041 2042 2043 2044 2045 driver.findElement(By.name("previous")).click();2046 2047 driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);2048 driver.switchTo().defaultContent();2049 driver.switchTo().frame("mainFrame");2050 driver.switchTo().frame("main");2051 2052 2053 driver.findElement(By.name("yes")).click(); */2054 2055 2056 2057 driver.switchTo().defaultContent(); 2058 driver.switchTo().frame("topFrame");2059 driver.findElement(By.xpath("//*[contains(text(),'Cash Management')]")).click(); 2060 test.log(LogStatus.PASS, "Clicked on Cash Management");2061 Thread.sleep(1000);2062 driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);2063 driver.switchTo().defaultContent();2064 driver.switchTo().frame("mainFrame");2065 driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);2066 //driver.findElement(By.cssSelector("li[id='911101']")).click(); 2067 driver.findElement(By.linkText("Safe")).click();2068 test.log(LogStatus.PASS, "Clicked on Assign"); 2069 //driver.findElement(By.xpath("//*[@id="931010"]/a']")).click();2070 //driver.findElement(By.linkText("Drawer")).click();2071 driver.findElement(By.linkText("Assign")).click();2072 test.log(LogStatus.PASS, "Clicked on Assign");2073 //login.Login(UserName, Password, StoreId, driver, AppURL, test);2074 Thread.sleep(5000);2075 driver.switchTo().defaultContent();2076 driver.switchTo().frame("mainFrame");2077 driver.switchTo().frame("main");2078 driver.findElement(By.name("safeAssignRequestBean.empPwd")).sendKeys(Password);2079 test.log(LogStatus.PASS, "Enter Password:"+Password);2080 driver.findElement(By.name("safeAssignRequestBean.noOf100Dollars")).sendKeys("500");2081 test.log(LogStatus.PASS, "Enter 500 Dollars "); 2082 driver.findElement(By.name("safeassign")).click();2083 test.log(LogStatus.PASS, "Clicked as safeassign Button "); 2084 try { 2085 Alert alert = driver.switchTo().alert();2086 alert.accept();2087 //if alert present, accept and move on. 2088 2089 }2090 catch (NoAlertPresentException e) {2091 //do what you normally would if you didn't have the alert.2092 2093 }2094 Thread.sleep(5000);2095 driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);2096 driver.switchTo().defaultContent();2097 driver.switchTo().frame("mainFrame");2098 driver.switchTo().frame("main");2099 2100 ///html/body/form/table/tbody/tr/td/table/tbody/tr/td/table[2]/tbody/tr/td/input2101 ///html/body/form/table/tbody/tr/td/table/tbody/tr/td/table/tbody/tr[2]/td[1]/input2102 // if(driver.findElement(By.xpath("/html/body/form/table/tbody/tr/td/table/tbody/tr/td/table/tbody/tr[2]/td[1]/input")).isDisplayed())2103 if(driver.findElement(By.xpath("//input[(@type='submit') and (@value='Ok')]")).isDisplayed())2104 {2105 test.log(LogStatus.PASS, "OK Button as Enabled "); 2106 driver.findElement(By.xpath("//input[(@type='submit') and (@value='Ok')]")).click();2107 test.log(LogStatus.PASS,"Click Ok Button.");2108 test.log(LogStatus.PASS,"Safe assigned successfully with over/short.");2109 2110 //driver.findElement(By.name("done")).click();2111 }2112 else2113 {2114 test.log(LogStatus.PASS,"Safe not assigned successfully with over/short.");2115 }2116 }2117 }2118 }2119 public WebElement Field(WebDriver driver) {2120 2121 try {2122 Thread.sleep(500);2123 WebElement element = (new WebDriverWait(driver, 9)).until(ExpectedConditions.visibilityOfElementLocated(By2124 .xpath("/html/body/table/tbody/tr/td/table/tbody/tr/td/table")));2125 return element;2126 } catch (Exception e) {2127 return null;2128 }2129 } 2130 2131 public void Drawerassign(String SSN,String FileName) throws Exception{2132 Excel TestData = new Excel("E:/QC_Workspace/AA_Automation/TestData/PDL/"+FileName); 2133 int lastrow=TestData.getLastRow("NewLoan");2134 System.out.println("NewLoan "+lastrow);2135 String sheetName="NewLoan";2136 for(int row=2;row<=lastrow;row++)2137 {2138 String RegSSN = TestData.getCellData(sheetName,"SSN",row);2139 if(SSN.equals(RegSSN))2140 {2141 String TxnType=TestData.getCellData(sheetName,"TxnType",row);2142 String TenderType = TestData.getCellData(sheetName,"TenderType",row);2143 String ProductID=TestData.getCellData(sheetName,"ProductID",row);2144 String AppURL = TestData.getCellData(sheetName,"AppURL",row);2145 String UserName = TestData.getCellData(sheetName,"UserName",row);2146 String Password = TestData.getCellData(sheetName,"Password",row);2147 String StoreId = TestData.getCellData(sheetName,"StoreID",row);2148 Thread.sleep(5000);2149 CSRLoginpage login = new CSRLoginpage();2150 login.Login(UserName, Password, StoreId, driver, AppURL, test);2151 Thread.sleep(5000);2152 driver.switchTo().defaultContent();2153 driver.switchTo().frame("topFrame");2154 driver.findElement(By.xpath("//*[contains(text(),'Cash Management')]")).click();2155 test.log(LogStatus.PASS, "Clicked on Cash Management");2156 Thread.sleep(1000);2157 driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);2158 driver.switchTo().defaultContent();2159 driver.switchTo().frame("mainFrame");2160 //driver.switchTo().frame("main");2161 driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);2162 //driver.findElement(By.cssSelector("li[id='911101']")).click();2163 driver.findElement(By.linkText("Drawer")).click();2164 test.log(LogStatus.PASS, "Clicked on Drawer");2165 //driver.findElement(By.xpath("//*[@id="931010"]/a']")).click();2166 //driver.findElement(By.linkText("Drawer")).click();2167 driver.switchTo().defaultContent();2168 driver.switchTo().frame("mainFrame");2169 //driver.switchTo().frame("main");2170 driver.findElement(By.linkText("Assign")).click();2171 test.log(LogStatus.PASS, "Clicked on Assign");2172 driver.switchTo().defaultContent();2173 driver.switchTo().frame("mainFrame");2174 driver.switchTo().frame("main");2175 driver.findElement(By.name("drawerAssignRequestBean.noOf100Dollars")).sendKeys("500");2176 test.log(LogStatus.PASS,"Count of Dollar Coins is entered as 500");2177 driver.findElement(By.name("drawerAssignRequestBean.password")).sendKeys(Password);2178 driver.findElement(By.name("drawerassign")).click();2179 try {2180 Alert alert = driver.switchTo().alert();2181 alert.accept();2182 //if alert present, accept and move on.2183 }2184 catch (NoAlertPresentException e) {2185 //do what you normally would if you didn't have the alert.2186 }2187 Thread.sleep(2000);2188 driver.switchTo().defaultContent();2189 driver.switchTo().frame("mainFrame");2190 driver.switchTo().frame("main");2191 //|| driver.findElement(By.xpath("/html/body/table/tbody/tr/td/table/tbody/tr/td/table/tbody/tr/td/h3/font")).getCssValue("color")=="red"2192 if(this.Field(driver) != null )2193 //if(driver.findElement(By.xpath("/html/body/table/tbody/tr/td/table/tbody/tr/td/table/tbody/tr/td")).isDisplayed())2194 { 2195 Thread.sleep(1000);2196 driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);2197 driver.switchTo().defaultContent();2198 driver.switchTo().frame("mainFrame");2199 driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);2200 //driver.findElement(By.cssSelector("li[id='911101']")).click();2201 driver.findElement(By.linkText("Safe")).click();2202 test.log(LogStatus.PASS, "Clicked on Safe");2203 //driver.findElement(By.xpath("//*[@id="931010"]/a']")).click();2204 //driver.findElement(By.linkText("Drawer")).click();2205 driver.findElement(By.linkText("Deassign")).click();2206 test.log(LogStatus.PASS, "Clicked on Deassign");2207 driver.switchTo().defaultContent();2208 driver.switchTo().frame("mainFrame"); 2209 driver.switchTo().frame("main");2210 driver.findElement(By.name("safeDeassignRequestBean.noOfDollars")).sendKeys("0");2211 test.log(LogStatus.PASS, "Enter the Value 0");2212 driver.findElement(By.name("safeDeassignRequestBean.password")).sendKeys(Password);2213 test.log(LogStatus.PASS, "Enter the Password");2214 driver.findElement(By.name("safedeassign")).click();2215 test.log(LogStatus.PASS, "Click on the Deassign");2216 try { 2217 Alert alert = driver.switchTo().alert();2218 alert.accept();2219 //if alert present, accept and move on. 2220 }2221 catch (NoAlertPresentException e) {2222 //do what you normally would if you didn't have the alert.2223 }2224 driver.switchTo().defaultContent();2225 driver.switchTo().frame("mainFrame");2226 driver.switchTo().frame("main");2227 if(driver.findElement(By.xpath("//input[(@type='submit') and (@value='Ok')]")).isDisplayed())2228 {2229 test.log(LogStatus.PASS,"Safe De-assigned successfully with over/short.");2230 driver.findElement(By.xpath("//input[(@type='submit') and (@value='Ok')]")).click();2231 //driver.findElement(By.xpath("/html/body/form/table/tbody/tr/td/table/tbody/tr/td/table[2]/tbody/tr/td/input")).click();2232 }2233 else2234 {2235 driver.findElement(By.name("safeDeassignRequestBean.password")).sendKeys(Password);2236 test.log(LogStatus.PASS, "Enter the Password");2237 driver.findElement(By.name("safedeassign")).click();2238 test.log(LogStatus.PASS, "Click on the Deassign");2239 for(String winHandle : driver.getWindowHandles()){2240 driver.switchTo().window(winHandle);2241 } 2242 driver.switchTo().defaultContent();2243 driver.switchTo().frame("mainFrame");2244 driver.switchTo().frame("main");2245 String DrawerOverShortAmount =driver.findElement(By.name("safeRequestBean.safeOverShort")).getAttribute("value");2246 driver.findElement(By.name("safeRequestBean.amount")).sendKeys(DrawerOverShortAmount);2247 test.log(LogStatus.PASS, "Amount entered as "+DrawerOverShortAmount);2248 driver.findElement(By.name("safeRequestBean.primary")).sendKeys("Counterfeit Bill");2249 test.log(LogStatus.PASS, "Primary Reason is selected as Counterfeit Bill");2250 driver.findElement(By.name("safeRequestBean.notes")).sendKeys("Notes");2251 test.log(LogStatus.PASS, "Notes Entered "); 2252 driver.findElement(By.name("bt_AddDrawer")).click();2253 test.log(LogStatus.PASS, "Click on Add O/S Instance Button"); 2254 Thread.sleep(3000);2255 driver.findElement(By.name("transactionDataBean.password")).sendKeys(Password);2256 driver.findElement(By.xpath("/html/body/form/table/tbody/tr/td/table/tbody/tr/td/table[4]/tbody/tr[3]/td[1]/input")).click();2257 test.log(LogStatus.PASS, "Click on Finish Safe O/S");2258 try { 2259 Alert alert = driver.switchTo().alert();2260 alert.accept();2261 //if alert present, accept and move on. 2262 }2263 catch (NoAlertPresentException e) {2264 //do what you normally would if you didn't have the alert.2265 }2266 Thread.sleep(2000);2267 for(String winHandle : driver.getWindowHandles()){2268 driver.switchTo().window(winHandle);2269 } 2270 driver.switchTo().defaultContent();2271 driver.switchTo().frame("mainFrame");2272 driver.switchTo().frame("main");2273 if(driver.findElement(By.xpath("//input[(@type='submit') and (@value='Ok')]")).isDisplayed())2274 {2275 test.log(LogStatus.PASS,"Safe De-assigned successfully with over/short.");2276 driver.findElement(By.xpath("//input[(@type='submit') and (@value='Ok')]")).click();2277 }2278 else2279 {2280 test.log(LogStatus.PASS,"Safe not De-assigned successfully with over/short.");2281 } 2282 }2283 Thread.sleep(1000);2284 driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);2285 driver.switchTo().defaultContent();2286 driver.switchTo().frame("mainFrame");2287 driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);2288 //driver.findElement(By.cssSelector("li[id='911101']")).click();2289 driver.findElement(By.linkText("Safe")).click();2290 test.log(LogStatus.PASS, "Clicked on Assign");2291 //driver.findElement(By.xpath("//*[@id="931010"]/a']")).click();2292 //driver.findElement(By.linkText("Drawer")).click();2293 driver.findElement(By.linkText("Assign")).click();2294 test.log(LogStatus.PASS, "Clicked on Assign");2295 //login.Login(UserName, Password, StoreId, driver, AppURL, test);2296 Thread.sleep(5000);2297 driver.switchTo().defaultContent();2298 driver.switchTo().frame("mainFrame");2299 driver.switchTo().frame("main");2300 driver.findElement(By.name("safeAssignRequestBean.empPwd")).sendKeys("1234");2301 //Password2302 driver.findElement(By.name("safeAssignRequestBean.noOf100Dollars")).sendKeys("500");2303 test.log(LogStatus.PASS,"Count of Dollar Coins is entered as 500");2304 driver.findElement(By.name("safeassign")).click();2305 test.log(LogStatus.PASS,"Click on Safe Assigen");2306 try {2307 Alert alert = driver.switchTo().alert();2308 alert.accept();2309 //if alert present, accept and move on.2310 }2311 catch (NoAlertPresentException e) {2312 //do what you normally would if you didn't have the alert.2313 }2314 Thread.sleep(5000);2315 driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);2316 driver.switchTo().defaultContent();2317 driver.switchTo().frame("mainFrame");2318 driver.switchTo().frame("main");2319 ///html/body/form/table/tbody/tr/td/table/tbody/tr/td/table[2]/tbody/tr/td/input2320 // if(driver.findElement(By.xpath("/html/body/form/table/tbody/tr/td/table/tbody/tr/td/table[2]/tbody/tr/td/input")).isDisplayed())2321 if(driver.findElement(By.xpath("//input[(@type='submit') and (@value='Ok')]")).isDisplayed())2322 {2323 test.log(LogStatus.PASS,"Safe assigned successfully.");2324 driver.findElement(By.xpath("//input[(@type='submit') and (@value='Ok')]")).click();2325 //driver.findElement(By.name("done")).click();2326 }2327 else2328 {2329 test.log(LogStatus.PASS,"Safe not assigned successfully.");2330 }2331 Thread.sleep(1000);2332 driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);2333 driver.switchTo().defaultContent();2334 driver.switchTo().frame("mainFrame");2335 //driver.switchTo().frame("main");2336 driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);2337 //driver.findElement(By.cssSelector("li[id='911101']")).click();2338 driver.findElement(By.linkText("Drawer")).click();2339 test.log(LogStatus.PASS, "Clicked on Drawer");2340 //driver.findElement(By.xpath("//*[@id="931010"]/a']")).click();2341 //driver.findElement(By.linkText("Drawer")).click();2342 driver.switchTo().defaultContent();2343 driver.switchTo().frame("mainFrame");2344 //driver.switchTo().frame("main");2345 driver.findElement(By.linkText("Assign")).click();2346 test.log(LogStatus.PASS, "Clicked on Assign");2347 driver.switchTo().defaultContent();2348 driver.switchTo().frame("mainFrame");2349 driver.switchTo().frame("main");2350 driver.findElement(By.name("drawerAssignRequestBean.noOf100Dollars")).sendKeys("500");2351 test.log(LogStatus.PASS,"Count of Dollar Coins is entered as 500");2352 driver.findElement(By.name("drawerAssignRequestBean.password")).sendKeys(Password);2353 driver.findElement(By.name("drawerassign")).click();2354 try {2355 Alert alert = driver.switchTo().alert();2356 alert.accept();2357 //if alert present, accept and move on.2358 }2359 catch (NoAlertPresentException e) {2360 //do what you normally would if you didn't have the alert.2361 }2362 Thread.sleep(2000);2363 driver.switchTo().defaultContent();2364 driver.switchTo().frame("mainFrame");2365 driver.switchTo().frame("main");2366 if(driver.findElement(By.xpath("/html/body/form/table/tbody/tr/td/table/tbody/tr/td/table[2]/tbody/tr/td/input")).isDisplayed())2367 {2368 test.log(LogStatus.PASS,"Drawer De-assigned successfully with over/short.");2369 driver.findElement(By.xpath("/html/body/form/table/tbody/tr/td/table/tbody/tr/td/table[2]/tbody/tr/td/input")).click();2370 }2371 else2372 {2373 test.log(LogStatus.PASS,"Drawer not De-assigned successfully with over/short.");2374 }2375 } 2376 else2377 { 2378 // if(driver.findElement(By.name("done")).isDisplayed())2379 if(driver.findElement(By.xpath("/html/body/form/table/tbody/tr/td/table/tbody/tr/td/table[2]/tbody/tr/td/input")).isDisplayed())2380 {2381 test.log(LogStatus.PASS,"Drawer Assigned successfully with over/short.");2382 //driver.findElement(By.name("done")).click();2383 driver.findElement(By.xpath("/html/body/form/table/tbody/tr/td/table/tbody/tr/td/table[2]/tbody/tr/td/input")).click();2384 }2385 else2386 {2387 test.log(LogStatus.PASS,"Drawer not Assigned successfully with over/short.");2388 }2389 }2390 }2391 }2392 }2393 2394 2395 2396 2397 public void NACHA(String SSN,String FileName,int Days) throws Exception2398 {2399 Excel TestData = new Excel("E:/QC_Workspace/AA_Automation/TestData/PDL/"+FileName); 2400 int lastrow=TestData.getLastRow("NewLoan");2401 System.out.println("NewLoan "+lastrow);2402 String sheetName="NewLoan"; 2403 for(int row=2;row<=lastrow;row++)2404 { 2405 String RegSSN = TestData.getCellData(sheetName,"SSN",row);2406 if(SSN.equals(RegSSN))2407 {2408 String TxnType=TestData.getCellData(sheetName,"TxnType",row);2409 String TenderType = TestData.getCellData(sheetName,"TenderType",row);2410 String ProductID=TestData.getCellData(sheetName,"ProductID",row);2411 String UserName = TestData.getCellData(sheetName,"UserName",row);2412 String Password = TestData.getCellData(sheetName,"Password",row);2413 String StoreID = TestData.getCellData(sheetName,"StoreID",row);2414 String AdminURL=TestData.getCellData(sheetName,"AdminURL",row);2415 System.out.println(AdminURL);2416 test.log(LogStatus.INFO, "Scheduler-Store Aging");2417 System.out.println(ProductID);2418 String AppURL = TestData.getCellData(sheetName,"AppURL",row);2419 appUrl = AppURL;2420 2421 this.Login(UserName,Password,StoreID);2422 2423 String SSN1 = SSN.substring(0, 3);2424 String SSN2 = SSN.substring(3,5);2425 String SSN3 = SSN.substring(5,9);2426 Thread.sleep(5000);2427 Thread.sleep(1000);2428 driver.switchTo().frame("topFrame");2429 driver.findElement(By.xpath("//*[contains(text(),'Loan Transactions')]")).click();2430 test.log(LogStatus.PASS, "Clicked on Loan Transactions");2431 driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);2432 driver.switchTo().defaultContent();2433 driver.switchTo().frame("mainFrame");2434 driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);2435 driver.findElement(By.cssSelector("li[id='911101']")).click();2436 test.log(LogStatus.PASS, "Clicked on Transactions");2437 driver.switchTo().frame("main");2438 driver.findElement(By.name("ssn1")).sendKeys(SSN1);2439 test.log(LogStatus.PASS, "SSN1 is entered: "+SSN1);2440 driver.findElement(By.name("ssn2")).sendKeys(SSN2);2441 test.log(LogStatus.PASS, "SSN2 is entered: "+SSN2);2442 driver.findElement(By.name("ssn3")).sendKeys(SSN3);2443 test.log(LogStatus.PASS, "SSN3 is entered: "+SSN3);2444 driver.findElement(By.name("submit1")).click();2445 test.log(LogStatus.PASS, "Click on submit Button");2446 for(String winHandle : driver.getWindowHandles()){2447 driver.switchTo().window(winHandle);2448 }2449 driver.switchTo().defaultContent();2450 driver.switchTo().frame("mainFrame");2451 driver.switchTo().frame("main");2452 driver.findElement(By.name("button")).click();2453 test.log(LogStatus.PASS, "Click on GO Button");2454 for(String winHandle : driver.getWindowHandles()){2455 driver.switchTo().window(winHandle);2456 }2457 driver.switchTo().defaultContent();2458 driver.switchTo().frame("mainFrame");2459 driver.switchTo().frame("main");2460 2461 if(ProductID.equals("PDL"))2462 {2463 ///html/body/form[1]/table/tbody/tr/td/table/tbody/tr/td/table[2]/tbody/tr[7]/td[2]/table/tbody/tr/td/table/tbody/tr[4]/td[11]/input[1]2464 driver.findElement(By.xpath("/html/body/form[1]/table/tbody/tr/td/table/tbody/tr/td/table[2]/tbody/tr[7]/td[2]/table/tbody/tr/td/table/tbody/tr[4]/td[11]/input[1]")).click();2465 }2466 // driver.findElement(By.name("button")).click();2467 test.log(LogStatus.PASS, "Click on GO Button");2468 for( String winHandle1 : driver.getWindowHandles())2469 {2470 driver.switchTo().window(winHandle1);2471 }2472 driver.switchTo().defaultContent();2473 driver.switchTo().frame("mainFrame");2474 driver.switchTo().frame("main");2475 driver.findElement(By.name("transactionList")).sendKeys("History");2476 2477 test.log(LogStatus.INFO, "transactionList as Selected : History " );2478 if(ProductID.equals("PDL"))2479 {2480 driver.findElement(By.id("go_Button")).click();2481 2482 test.log(LogStatus.PASS, "Click on GO Button");2483 }2484 for( String winHandle1 : driver.getWindowHandles())2485 {2486 driver.switchTo().window(winHandle1);2487 }2488 driver.switchTo().defaultContent();2489 driver.switchTo().frame("mainFrame");2490 driver.switchTo().frame("main");2491 String DueDate=null;2492 //String LoanAmount = null;2493 2494 //*[@id="transactionHistoryTable"]/tbody/tr/td[3]/table/tbody/tr[4]/td/span[2]2495 DueDate = driver.findElement(By.xpath("//*[@id='transactionHistoryTable']/tbody/tr/td[3]/table/tbody/tr[4]/td/span[2]")).getText();2496 //LoanAmount = driver.findElement(By.xpath("//*[@id='transactionHistoryTable']/tbody/tr/td[4]/table/tbody/tr[5]/td/span[2]")).getText();2497 test.log(LogStatus.PASS, "Capture DueDate"+DueDate);2498 //DueDate=driver.findElement(By.xpath("//*[@id='revolvingCreditHistTable']/tbody/tr[4]/td[3]/span[2]")).getText();2499 System.out.print(DueDate);2500 driver.close();2501 driver = new InternetExplorerDriver();2502 driver.get(AdminURL);2503 // storeupdate(UserName,Password,StoreID,DueDate,AdminURL);2504 DateFormat df=new SimpleDateFormat("MM/dd/yyyy"); 2505 driver.findElement(By.name("loginRequestBean.userId")).sendKeys("admin");2506 test.log(LogStatus.PASS, "Username is entered: admin"); 2507 driver.findElement(By.name("loginRequestBean.password")).sendKeys(Password);2508 test.log(LogStatus.PASS, "Password is entered: "+Password); 2509 //Click Login Button2510 driver.findElement(By.name("login")).click();2511 test.log(LogStatus.PASS, "Clicked on Submit button");2512 Thread.sleep(8000);2513 2514 driver.switchTo().defaultContent();2515 driver.switchTo().frame("topFrame");2516 driver.findElement(By.xpath("//*[contains(text(),'Transactions')]")).click(); 2517 test.log(LogStatus.PASS, "Clicked on Transactions");2518 driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);2519 driver.switchTo().defaultContent();2520 driver.switchTo().frame("mainFrame");2521 driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS); 2522 driver.findElement(By.linkText("ACH")).click();2523 test.log(LogStatus.PASS, "Clicked on ACH");2524 Thread.sleep(5000);2525 driver.findElement(By.linkText("Green Bank")).click();2526 test.log(LogStatus.PASS, "Clicked on Green Bank");2527 Thread.sleep(5000);2528 driver.findElement(By.linkText("Green Bank NACHA File")).click();2529 test.log(LogStatus.PASS, "Clicked on Green Bank NACHA File");2530 driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);2531 2532 driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);2533 driver.switchTo().defaultContent();2534 driver.switchTo().frame("mainFrame");2535 driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS); 2536 driver.findElement(By.linkText("Daily Jobs")).click();2537 test.log(LogStatus.PASS, "Clicked on Daily Jobs");2538 Thread.sleep(5000);2539 2540 String DDueDate[] =DueDate.split("/");2541 //String date = DDueDate[1];2542 Date DDueDateminus1 = df.parse(DueDate);2543 Calendar cal = Calendar.getInstance();2544 cal.setTime(DDueDateminus1);2545 cal.add(Calendar.DATE, Days);2546 Date DDueDate1= cal.getTime();2547 DueDate =df.format(DDueDate1);2548 String DueDate0[] =DueDate.split("/");2549 String DueDate1 = DueDate0[0];2550 String DueDate2 = DueDate0[1];2551 String DueDate3 = DueDate0[2];2552 2553 2554 driver.switchTo().defaultContent();2555 driver.switchTo().frame("mainFrame");2556 driver.switchTo().frame("main");2557 /* driver.findElement(By.name("storeCode")).click();2558 //driver.findElement(By.xpath("/html/body/form/table/tbody/tr/td/table/tbody/tr/td")).click();2559 driver.findElement(By.name("storeCode")).sendKeys(StoreID);2560 test.log(LogStatus.PASS, "Store number is entered: "+StoreID);2561 Thread.sleep(5000);*/2562 driver.findElement(By.name("beginMonth")).click();2563 driver.findElement(By.name("beginMonth")).clear();2564 driver.findElement(By.name("beginMonth")).sendKeys(DueDate1); 2565 test.log(LogStatus.PASS, "beginMonth is entered: "+DueDate1);2566 driver.findElement(By.name("beginDay")).clear();2567 driver.findElement(By.name("beginDay")).sendKeys(DueDate2);2568 test.log(LogStatus.PASS, "beginDay is entered: "+DueDate2);2569 driver.findElement(By.name("beginYear")).clear();2570 driver.findElement(By.name("beginYear")).sendKeys(DueDate3);2571 test.log(LogStatus.PASS, "beginYear is entered: "+DueDate3);2572 Thread.sleep(2000);2573 driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);2574 Thread.sleep(1000);2575 Thread.sleep(5000);2576 driver.findElement(By.name("btnPreview")).click();2577 test.log(LogStatus.PASS, "Clicked on submit button");2578 driver.switchTo().defaultContent();2579 driver.switchTo().frame("mainFrame");2580 driver.switchTo().frame("main");2581 if( driver.findElement(By.xpath("/html/body/form/table[1]/tbody/tr/td/table/tbody/tr/td/table/tbody/tr[2]/td[2]/table/tbody/tr[2]/td/input")).isDisplayed())2582 { 2583 test.log(LogStatus.PASS, "Process NACHA file successfully.");2584 driver.findElement(By.xpath("/html/body/form/table[1]/tbody/tr/td/table/tbody/tr/td/table/tbody/tr[2]/td[2]/table/tbody/tr[2]/td/input")).click();2585 }2586 else2587 {2588 test.log(LogStatus.FAIL, "Process NACHA is not updated successfully.");2589 }2590 }2591 }2592 }2593 public void ACH_Deposit_Status(String SSN,String FileName) throws Exception2594 {2595 Excel TestData = new Excel("E:/QC_Workspace/AA_Automation/TestData/PDL/"+FileName); 2596 int lastrow=TestData.getLastRow("NewLoan");2597 System.out.println("NewLoan "+lastrow);2598 String sheetName="NewLoan"; 2599 for(int row=2;row<=lastrow;row++)2600 { 2601 String RegSSN = TestData.getCellData(sheetName,"SSN",row);2602 if(SSN.equals(RegSSN))2603 {2604 String TxnType=TestData.getCellData(sheetName,"TxnType",row);2605 String TenderType = TestData.getCellData(sheetName,"TenderType",row); 2606 String ProductID=TestData.getCellData(sheetName,"ProductID",row);2607 String UserName = TestData.getCellData(sheetName,"UserName",row);2608 String Password = TestData.getCellData(sheetName,"Password",row);2609 String StoreID = TestData.getCellData(sheetName,"StoreID",row);2610 String AdminURL=TestData.getCellData(sheetName,"AdminURL",row);2611 System.out.println(AdminURL);2612 test.log(LogStatus.INFO, "Scheduler-Store Aging");2613 System.out.println(ProductID); 2614 String AppURL = TestData.getCellData(sheetName,"AppURL",row);2615 appUrl = AppURL;2616 this.Login(UserName,Password,StoreID);2617 String SSN1 = SSN.substring(0, 3);2618 String SSN2 = SSN.substring(3,5);2619 String SSN3 = SSN.substring(5,9);2620 Thread.sleep(5000);2621 driver.switchTo().frame("topFrame");2622 driver.findElement(By.xpath("//*[contains(text(),'Loan Transactions')]")).click(); 2623 test.log(LogStatus.PASS, "Clicked on Loan Transactions");2624 driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);2625 driver.switchTo().defaultContent();2626 driver.switchTo().frame("mainFrame");2627 driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);2628 driver.findElement(By.cssSelector("li[id='911101']")).click(); 2629 test.log(LogStatus.PASS, "Clicked on Transactions"); 2630 driver.switchTo().frame("main"); 2631 driver.findElement(By.name("ssn1")).sendKeys(SSN1);2632 test.log(LogStatus.PASS, "SSN1 is entered: "+SSN1);2633 driver.findElement(By.name("ssn2")).sendKeys(SSN2);2634 test.log(LogStatus.PASS, "SSN2 is entered: "+SSN2);2635 driver.findElement(By.name("ssn3")).sendKeys(SSN3);2636 test.log(LogStatus.PASS, "SSN3 is entered: "+SSN3);2637 driver.findElement(By.name("submit1")).click();2638 test.log(LogStatus.PASS, "Click on submit Button"); 2639 for(String winHandle : driver.getWindowHandles()){2640 driver.switchTo().window(winHandle);2641 }2642 driver.switchTo().defaultContent();2643 driver.switchTo().frame("mainFrame");2644 driver.switchTo().frame("main");2645 driver.findElement(By.name("button")).click();2646 test.log(LogStatus.PASS, "Click on GO Button");2647 for(String winHandle : driver.getWindowHandles()){2648 driver.switchTo().window(winHandle);2649 } 2650 driver.switchTo().defaultContent();2651 driver.switchTo().frame("mainFrame");2652 driver.switchTo().frame("main");2653 if(ProductID.equals("PDL"))2654 {2655 2656 //driver.findElement(By.name("button")).click();2657 ///html/body/form[1]/table/tbody/tr/td/table/tbody/tr/td/table[2]/tbody/tr[7]/td[2]/table/tbody/tr/td/table/tbody/tr[4]/td[11]/input[1] 2658 driver.findElement(By.xpath("//input[@value='Go' and @type='button']")).click();2659 //driver.findElement(By.xpath("/html/body/form[1]/table/tbody/tr/td/table/tbody/tr/td/table[2]/tbody/tr[7]/td[2]/table/tbody/tr/td/table/tbody/tr[4]/td[11]/input[1]")).click();2660 // /html/body/form[1]/table/tbody/tr/td/table/tbody/tr/td/table[2]/tbody/tr[7]/td[2]/table/tbody/tr/td/table/tbody/tr[4]/td[11]/input[1] 2661 }2662 // driver.findElement(By.name("button")).click();2663 test.log(LogStatus.PASS, "Click on GO Button");2664 for( String winHandle1 : driver.getWindowHandles())2665 {2666 driver.switchTo().window(winHandle1);2667 } 2668 driver.switchTo().defaultContent();2669 driver.switchTo().frame("mainFrame");2670 driver.switchTo().frame("main");2671 driver.findElement(By.name("transactionList")).sendKeys("History");2672 /* if(ProductID.equals("LOC"))2673 {*/2674 //*[@id="go_Button"]2675 driver.findElement(By.xpath("//*[@id='go_Button']")).click();2676 test.log(LogStatus.PASS, "Click on Go for TRANSACTION Selection Button");2677 //driver.findElement(By.name("button")).click(); 2678 //}2679 for( String winHandle1 : driver.getWindowHandles())2680 {2681 driver.switchTo().window(winHandle1);2682 } 2683 driver.switchTo().defaultContent();2684 driver.switchTo().frame("mainFrame");2685 driver.switchTo().frame("main");2686 //*[@id="totPart"]/tbody/tr/td/table/tbody/tr/td/table/tbody/tr[2]/td/p[2]/input[1] Confirm Yes button2687 String AchDeposit=null;2688 2689 AchDeposit = driver.findElement(By.xpath("/html/body/table/tbody/tr/td/table/tbody/tr/td/form/table[3]/tbody/tr[3]/td[5]")).getText();2690 2691 if((AchDeposit).contains("ACH Deposit"))2692 {2693 test.log(LogStatus.PASS,"ACHDeposit Record is Displayed " );2694 }2695 else2696 {2697 test.log(LogStatus.PASS,"ACHDeposit Record is not Displayed.");2698 }2699 2700 }2701 }2702 } 2703 2704 @Test (priority=0)2705 2706 public void Loan_AgeStore_ProcessDeposit_Nacha_DepositShouldPost() throws Exception {2707 2708 // Start test. Mention test script name2709 String FileName= "Loan_AgeStore_ProcessDeposit_Nacha_DepositShouldPost_TestData.xls";2710 Excel TestData = new Excel("E:/QC_Workspace/AA_Automation/TestData/PDL/"+FileName); 2711 int lastrow=TestData.getLastRow("NewLoan");2712 String sheetName="NewLoan";2713 //int lastrow=TestData.getLastRow("Borrower");2714 System.out.println(lastrow);2715 for(int row=2;row<=lastrow;row++)2716 {2717 String RunFlag = TestData.getCellData(sheetName,"Run",row);2718 //System.out.println(RunFlag);2719 if(RunFlag.equals("Y"))2720 { 2721 //driver.get(appUrl);2722 //test.log(LogStatus.INFO, "Application is launched");2723 //driver.manage().window().maximize();2724 String AppURL = TestData.getCellData(sheetName,"AppURL",row);2725 String UserName = TestData.getCellData(sheetName,"UserName",row);2726 String Password = TestData.getCellData(sheetName,"Password",row);2727 // System.out.println(Password);2728 String StoreId = TestData.getCellData(sheetName,"StoreID",row);2729 String ProductID = TestData.getCellData(sheetName,"ProductID",row);2730 String StateID = TestData.getCellData(sheetName,"StateID",row);2731 String SSN = TestData.getCellData(sheetName,"SSN",row); 2732 String Header = StateID+ "_" + ProductID;2733 //System.out.println(SSN);2734 test = reports.startTest("Loan_AgeStore_ProcessDeposit_Nacha_DepositShouldPost"+Header, "Loan_Age the store up to due date_Process the deposit_Process GB Nacha File from admin Interface_Deposit should post");2735 appUrl = AppURL;2736 this.Login(UserName,Password,StoreId);2737 BorrowerRegistrationpage Reg = new BorrowerRegistrationpage();2738 Reg.RegistrationPage_NewLoan_PDL(driver, test, AppURL, SSN, FileName);2739 this.NewLoan(SSN, FileName);2740 this.AgeStore(SSN, FileName, 0);2741 this.DrawerDeassign(SSN, FileName);2742 this.EODProcessing(SSN, FileName);2743 this.StoreInfo(SSN, FileName);2744 this.Safeassign(SSN, FileName);2745 this.Drawerassign(SSN, FileName);2746 this.NACHA(SSN, FileName, 0);2747 this.ACH_Deposit_Status(SSN, FileName);2748 //WebDriverWait wait = new WebDriverWait(driver, 10); 2749 //wait(100);2750 // this.RegistrationPage(SSN);2751 }2752 }2753 //this.Login("CSR353","1234","353");2754 2755 }2756 2757 2758 2759 @AfterMethod2760 @AfterTest2761 public void tearDown() {2762 // Ending Test2763 reports.endTest(test);2764 // writing everything into HTML report2765 reports.flush();2766 }2767 @AfterClass2768 public void quit() {2769 // Closing browser2770 driver.quit();2771 }2772 public void takeScreenShot(WebDriver driver, String filePath) {2773 File scrFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);2774 try {2775 FileUtils.copyFile(scrFile, new File(filePath));2776 } catch (IOException e) {2777 e.printStackTrace();2778 }2779 }2780 }...

Full Screen

Full Screen

Source:AdminConfig.java Github

copy

Full Screen

...1217 } else {1218 negativeCase(Testname, firstWinHandle, "", "Selecting the EmailFlag check box in eArchive Mail Settings in client app admin is failed");1219 }1220 1221 if (doesElementExist2(properties.getProperty("Cltappfourdigitpin"), 5)) {1222 WebElement chkboxfourdigitpin = driver.findElement(By.cssSelector(properties.getProperty("Cltappfourdigitpin")));1223 1224 if ( chkboxfourdigitpin.isSelected())1225 {1226 log.logLine(Testname, false, "4 digit PIN encryption checkbox is already selected in eArchive Mail Settings in client app admin");1227 }else{1228 ((JavascriptExecutor) driver).executeScript("arguments[0].click()", chkboxfourdigitpin);1229 }1230 log.logLine(Testname, false, "Selected the 4 digit PIN encryption check box in eArchive Mail Settings in client app admin sucessfull");1231 } else {1232 negativeCase(Testname, firstWinHandle, "", "Selecting the 4 digit PIN encryption check box in eArchive Mail Settings in client app admin is failed"); 1233 }1234 1235 if (doesElementExist2(properties.getProperty("CltappEmailHistory"), 5)) {1236 WebElement chkboxemalhistory = driver.findElement(By.cssSelector(properties.getProperty("CltappEmailHistory")));1237 1238 if ( chkboxemalhistory.isSelected())1239 {1240 log.logLine(Testname, false, "Email History checkbox is already selected in eArchive Mail Settings in client app admin");1241 }else{1242 ((JavascriptExecutor) driver).executeScript("arguments[0].click()", chkboxemalhistory); ...

Full Screen

Full Screen

Source:priceTrackerApplicationTests.java Github

copy

Full Screen

...119 // Alternatively the same thing can be done like this120 // driver.navigate().to("http://www.google.com");121 // Find the text input element by its name122 //WebElement element = driver.findElement(By.name("q"));123 //WebElement element = driver.findElement(By.className("mat-input-element mat-form-field-autofill-control pintextbox ng-pristine ng-invalid cdk-text-field-autofill-monitored ng-touched"));124 125 WebElement pincodeBar = driver.findElement(By.id("mat-input-0"));126 127 JavascriptExecutor js = (JavascriptExecutor) driver;128 js.executeScript("arguments[0].click();",pincodeBar);129 130 // Enter something to search for131 pincodeBar.sendKeys("134109");132 133 driver.findElement(By.className("pin-search-btn")).click();134 135 WebElement ageFilter = driver.findElement(By.id("flexRadioDefault2"));136 137 JavascriptExecutor js1 = (JavascriptExecutor) driver;138 js1.executeScript("arguments[0].click();",ageFilter);139 140 //driver.findElement(By.id("flexRadioDefault2")).click();141 142 //WebElement ageFilter = driver.findElement(By.id("flexRadioDefault2")).click();143 // Now submit the form. WebDriver will find the form for us from the element144 //element.submit();145 // Check the title of the page146 //System.out.println("Page title is: " + driver.getTitle());147 148 List<WebElement> listOfCenters = driver.findElements(By.className("slot-available-wrap"));149 logger.info("size is "+listOfCenters.size());150 for(WebElement center : listOfCenters) {151 logger.info("Center Info -> "+center.getText());152 String textToCheck = center.getText().toString();153 //logger.info("text to check->"+textToCheck);154 String[] valuesToBeCheckedTemp = textToCheck.split("\n");155 System.out.println("Size is "+valuesToBeCheckedTemp.length);156 int totalSize = valuesToBeCheckedTemp.length;157 int totalOccurences = 0;158 totalOccurences += (countOccurencesOf(textToCheck, "Booked"))*3;159 totalOccurences += countOccurencesOf(textToCheck, "NA");160 if((totalSize-totalOccurences)!=0) {161 System.out.println("!!!!!!!!!!!! VACCINE AVAILABLE !!!!!!!!!!!!!!!!!!!!!!!");162 }163 else {164 System.out.println("!!!!!!!!!!!! VACCINE NOT AVAILABLE !!!!!!!!!!!!!!!!!!!!!!!");165 }166 167 //logger.info("split text-> "+center.getText().split(" ").length);168 169 }170 171 //pincodeBar.clear();172 //pincodeBar.sendKeys("134112");173 //driver.findElement(By.className("pin-search-btn")).click();174 //List<WebElement> listOfCenters2 = driver.findElements(By.className("slot-available-wrap"));175 //logger.info("size is "+listOfCenters2.size());176 //logger.info("size->"+driver.findElements(By.className("slot-available-wrap")).size());177 178 179 //D:\geckodriver.exe180 181 // Google's search is rendered dynamically with JavaScript.182 // Wait for the page to load, timeout after 10 seconds183 (new WebDriverWait(driver, 10)).until(new ExpectedCondition<Boolean>() {184 public Boolean apply(WebDriver d) {185 //logger.info("->->"+d.findElement(By.className(className)));186 //d.findElements(By.className("center-name-title"));187 //d.findElements(By.className("slot-available-wrap"));188 String textToCheck;189 List<WebElement> listOfText = d.findElements(By.className("slot-available-wrap"));190 for(WebElement text: listOfText) {191 192 }193 //logger.info("text->->"+d.findElements(By.className("slot-available-wrap")).get(0).getText());194 //logger.info("->->"+d.findElements(By.className("center-name-title")));195 //logger.info("->->"+d.findElements(By.className("slot-available-wrap")));196 return d.getTitle().toLowerCase().startsWith("cheese!");197 }198 });199 // Should see: "cheese! - Google Search"200 System.out.println("Page title is: " + driver.getTitle());201 //Close the browser202 driver.quit();203 }204 205 @Test206 void checkSlotByDistrict() throws IOException, MessagingException, InterruptedException, AWTException {207 /*208 System.setProperty("webdriver.chrome.driver", "C:\\selenium\\chromedriver.exe");209 chromeOptions options = new ChromeOptions();210 options.setExperimentalOption("debuggerAddress", "127.0.0.1:<customPort>");211 WebDriver driver = new ChromeDriver(options);212 */213 214 215 // Create a new instance of the Firefox driver216 // Notice that the remainder of the code relies on the interface, 217 // not the implementation.218 System.setProperty("webdriver.gecko.driver", "src/main/resources/geckodriver.exe");219 System.setProperty("java.awt.headless", "false");220 WebDriver driver = new FirefoxDriver();221 driver.manage().window().maximize();222 //Point point = new Point(300, 500);223 //driver.manage().window().setPosition(point);224 //String response = doc.normalise().select("script#is_script").html().toString();225 // And now use this to visit Google226 //driver.get("http://www.google.com");227 //driver.get("https://selfregistration.cowin.gov.in");228 229 230 driver.get("https://www.cowin.gov.in/home");231 232 233 // Alternatively the same thing can be done like this234 // driver.navigate().to("http://www.google.com");235 // Find the text input element by its name236 //WebElement element = driver.findElement(By.name("q"));237 //WebElement element = driver.findElement(By.className("mat-input-element mat-form-field-autofill-control pintextbox ng-pristine ng-invalid cdk-text-field-autofill-monitored ng-touched"));238 239 WebElement element = driver.findElement(By.id("mat-input-0"));240 241 // to select the search-for-district toggle option242 WebElement pinOrDistrictSelector = driver.findElement(By.id("status"));243 JavascriptExecutor js = (JavascriptExecutor) driver;244 js.executeScript("arguments[0].click();",pinOrDistrictSelector);245 246 // filling in state value247 WebElement state = driver.findElement(By.id("mat-select-0"));248 state.sendKeys("Haryana");249 250 251 // filling in district value252 WebElement district = driver.findElement(By.id("mat-select-2"));253 district.click();254 district.sendKeys("Panchkula");255 256 /*257 WebElement searchButton = driver.findElement(By.className("pin-search-btn"));258 JavascriptExecutor js1 = (JavascriptExecutor) driver;259 js1.executeScript("arguments[0].click();",searchButton);260 */261 driver.findElement(By.className("pin-search-btn")).click();262 driver.findElement(By.className("pin-search-btn")).click();263 264 WebElement ageFilter = driver.findElement(By.id("flexRadioDefault2"));265 JavascriptExecutor js1 = (JavascriptExecutor) driver;266 js1.executeScript("arguments[0].click();",ageFilter);267 268 Robot robot = new Robot();269 // Scroll Down using Robot class270 robot.mouseWheel(12);271 //robot.keyPress(KeyEvent.VK_PAGE_DOWN);272 //robot.keyPress(KeyEvent.VK_PAGE_DOWN);273 //robot.keyPress(KeyEvent.VK_PAGE_DOWN);274 //robot.keyPress(KeyEvent.VK_PAGE_DOWN);275 //robot.keyRelease(KeyEvent.VK_PAGE_DOWN);276 277 //WebElement searchButton = driver.findElement(By.cssSelector("button.pin-search-btn.district-search"));278 /*279 WebElement searchButton = driver.findElement(By.xpath("//button[contains(text(),'Search')]"));280 searchButton.sendKeys(Keys.ENTER);281 logger.info("->->"+searchButton.getLocation());282 JavascriptExecutor js1 = (JavascriptExecutor) driver;283 js1.executeScript("arguments[0].click();",searchButton);284 searchButton.click();285 */286 //WebElement searchButton = driver.findElement(By.className("pin-search-btn.district-search"));287 //driver.findElement(By.xpath("//button[contains(text(),'district')]")).click();288 289 /*290 WebElement ageFilter = driver.findElement(By.id("flexRadioDefault2"));291 JavascriptExecutor js1 = (JavascriptExecutor) driver;292 js1.executeScript("arguments[0].click();",ageFilter);293 */294 //Select dropdown = new Select(driver.findElement(By.id("mat-select-0")));295 //Select dropdown = new Select(driver.findElement(By.xpath("//mat-select[@id=\"mat-select-0\"]")));296 297 //Select dropdown = new Select(driver.findElement( By.xpath(xpathExpression) ));298 299 //dropdown.selectByValue("Haryana");300 301 302 303 //district.sendKeys("Search By District");304 305 306 307 //pinOrDistrictSelector.click();308 //district.click();309 // Enter something to search for310 //element.sendKeys("134109");311 312 //driver.findElement(By.className("pin-search-btn")).click();313 // Now submit the form. WebDriver will find the form for us from the element314 //element.submit();315 // Check the title of the page316 //System.out.println("Page title is: " + driver.getTitle());317 318 List<WebElement> listOfCenters = driver.findElements(By.className("slot-available-wrap"));319 for(WebElement center : listOfCenters) {320 logger.info("Center Info -> "+center.getText());321 String textToCheck = center.getText().toString();322 //logger.info("text to check->"+textToCheck);323 String[] valuesToBeCheckedTemp = textToCheck.split("\n");324 System.out.println("Size is "+valuesToBeCheckedTemp.length);325 int totalSize = valuesToBeCheckedTemp.length;326 int totalOccurences = 0;327 totalOccurences += (countOccurencesOf(textToCheck, "Booked"))*3;328 totalOccurences += countOccurencesOf(textToCheck, "NA");329 if((totalSize-totalOccurences)!=0) {330 System.out.println("!!!!!!!!!!!! VACCINE AVAILABLE !!!!!!!!!!!!!!!!!!!!!!!");331 }332 else {333 System.out.println("!!!!!!!!!!!! VACCINE NOT AVAILABLE !!!!!!!!!!!!!!!!!!!!!!!");334 }335 336 //logger.info("split text-> "+center.getText().split(" ").length);337 338 }339 //logger.info("size->"+driver.findElements(By.className("slot-available-wrap")).size());340 //D:\geckodriver.exe341 342 // Google's search is rendered dynamically with JavaScript.343 // Wait for the page to load, timeout after 10 seconds344 (new WebDriverWait(driver, 10)).until(new ExpectedCondition<Boolean>() {345 public Boolean apply(WebDriver d) {346 //logger.info("->->"+d.findElement(By.className(className)));347 //d.findElements(By.className("center-name-title"));348 //d.findElements(By.className("slot-available-wrap"));349 String textToCheck;350 List<WebElement> listOfText = d.findElements(By.className("slot-available-wrap"));351 for(WebElement text: listOfText) {352 353 }354 //logger.info("text->->"+d.findElements(By.className("slot-available-wrap")).get(0).getText());355 //logger.info("->->"+d.findElements(By.className("center-name-title")));356 //logger.info("->->"+d.findElements(By.className("slot-available-wrap")));357 return d.getTitle().toLowerCase().startsWith("cheese!");358 }359 });360 // Should see: "cheese! - Google Search"361 System.out.println("Page title is: " + driver.getTitle());362 //Close the browser363 driver.quit();364 }365 366 public int countOccurencesOf(String mainString, String word) {367 // split the string by spaces in a368 //String a[] = mainString.split(" ");369 System.out.println("Checking -> "+mainString);370 String a[] = mainString.split("\n");371 372 // search for pattern in a373 int count = 0;374 for (int i = 0; i < a.length; i++)375 {376 // if match found increase count377 if (word.equals(a[i]))378 count++;379 }380 381 System.out.println(word + " occurred " + count + " times");382 383 return count;384 }385 386 private Document getNewConnection(String LINK) throws IOException, MessagingException, InterruptedException {387 Document doc = null;388 try {389 //doc = Jsoup.connect(LINK).userAgent("Mozilla/17.0").get();390 doc = Jsoup.connect(LINK).timeout((int) TIMEOUT).get();391 }392 catch(SocketException e) {393 e.printStackTrace();394 }395 finally {396 if(restart) {397 logger.info("error while fetching from link, restarting...");398 backupengine.restart();399 }400 }401 return doc;402 }403 404 @Test405 public void testStart() throws IOException, MessagingException, InterruptedException {406 logger.info("Starting engine...........");407 trackOrders tracker = new trackOrders();408 productList = tracker.loadProductPriceData();409 logger.info("List size is "+productList.size());410 trackFlipkartOrdersV2(productList);411 412 }413 414 415 @Test416 @SuppressWarnings({ "static-access", "unchecked" })417 public void trackFlipkartOrdersV2(ArrayList<Product> productList) throws IOException, MessagingException, InterruptedException {418 logger.info(productList.size()+" items ready to be tracked...");419 counter = 0;420 for(Product product : productList) {421 IS_FIRST_TIME = false;422 if(product.getLastObservedPrice().isEmpty()) {423 IS_FIRST_TIME = true;424 }425 restart=false;426 counter++;427 Document doc = null;428 429 doc = getNewConnection(product.getProductLink());430 431 String response = doc.normalise().select("script#is_script").html().toString();432 char[] responseArray = response.toCharArray();433 long start = response.indexOf("finalPrice");434 boolean record = false;435 String result = "";436 if( (start>0) && (response != null) ) {437 try {438 for(;responseArray[(int) start]!='}';start++) {439 if(responseArray[(int) start]=='{') {440 record = true;441 }442 if(record) {443 result+=responseArray[(int) start];444 }445 }446 restart = true;447 }448 catch(ArrayIndexOutOfBoundsException e) {449 e.printStackTrace();450 restart=false;451 }452 finally {453 if(!restart) {454 logger.info("Encountered array out of bound exception, trying to restart...");455 //backupengine.restart();456 }457 }458 }459 else {460 logger.info("Product is currently unavailable, hence skipping it...");461 continue;462 }463 464 result+='}';465 Map<String,String> resultMap = mapper.readValue(result, Map.class);466 String price = resultMap.get("decimalValue");467 currentPrice = Float.parseFloat(price);468 //logger.info("Current price is "+currentPrice);469 try {470 lastObservedPrice = !product.getLastObservedPrice().isEmpty() ? Float.parseFloat(product.getLastObservedPrice()) : currentPrice;471 }472 catch(Exception e) {473 IS_FIRST_TIME=true;474 }475 476 if(currentPrice!=lastObservedPrice) {477 if(!IS_FIRST_TIME) {478 logger.info("!!!!!!!!!!!!!PRODUCT PRICE CHANGED!!!!!!!!!!!!!");479 }480 try {481 logger.info(counter+"- Price of "+product.getProductLink()+" changed from "+lastObservedPrice+" to "+currentPrice);482 if(!IS_FIRST_TIME) {483 //sender.sendPriceDropMail(product.getProductLink(),currentPrice,lastObservedPrice);484 }485 }486 catch(Exception e) {487 e.printStackTrace();488 restart=false;489 }490 finally {491 if(!restart) {492 logger.info("Encountered exception while sending price drop mail, trying to restart...");493 //backupengine.restart();494 }495 }496 497 }498 else {499 float temporaryPrice = (lastObservedPrice==0.0) ? currentPrice : lastObservedPrice;500 logger.info(counter+"- Price didnt change from "+temporaryPrice+" for "+product.getProductLink());501 }502 503 /*504 * if(IS_FIRST_TIME) { lastObservedPrice=currentPrice; }505 */506 507 if(IS_FIRST_TIME) {508 product.setLastObservedPrice(String.valueOf(currentPrice));509 product.setMinPrice(String.valueOf(currentPrice));510 product.setMaxPrice(String.valueOf(currentPrice));511 //logger.info("Product changed to "+product.toString());512 }513 else {514 product.setLastObservedPrice(String.valueOf(currentPrice));515 if(currentPrice<Float.parseFloat(product.getMinPrice())) {516 product.setMinPrice(String.valueOf(currentPrice));517 }518 519 if(currentPrice>Float.parseFloat(product.getMaxPrice())) {520 product.setMaxPrice(String.valueOf(currentPrice));521 }522 }523 524 525 526 527 }528 529 //for(Product product : productList) { logger.info(product.toString()); }530 531 try {532 writePojoToCsv(productList);533 } catch (CsvDataTypeMismatchException e) {534 e.printStackTrace();535 restart=false;536 } catch (CsvRequiredFieldEmptyException e) {537 e.printStackTrace();538 restart=false;539 } catch (IOException e) {540 e.printStackTrace();541 restart=false;542 } catch (URISyntaxException e) {543 e.printStackTrace();544 restart=false;545 }546 finally {547 if(!restart) {548 logger.info("Encountered exception while writing to CSV file, trying to restart...");549 //backupengine.restart();550 }551 }552 }553 554 public void writePojoToCsv(ArrayList<Product> productList) throws IOException, URISyntaxException, CsvDataTypeMismatchException, CsvRequiredFieldEmptyException {555 556 Writer writer = new FileWriter(productPriceDataBook);557 558 ColumnPositionMappingStrategy<Product> mappingStrategy= new ColumnPositionMappingStrategy<Product>(); 559 mappingStrategy.setType(Product.class); 560 StatefulBeanToCsvBuilder<Product> builder = new StatefulBeanToCsvBuilder<Product>(writer);561 StatefulBeanToCsv<Product> beanWriter = builder.withMappingStrategy(mappingStrategy).build(); 562 563 beanWriter.write(productList);564 writer.flush();565 logger.info("CSV File written successfully!!!");566 567 }568 569 @Test570 void startEngine() throws IOException, MessagingException, InterruptedException {571 logger.info("Starting engine...........");572 trackOrders tracker = new trackOrders();573 productList = tracker.loadProductPriceData();574 logger.info("List size is "+productList.size());575 printProductList(productList);576 while(true) {577 //tracker.trackFlipkartOrders();578 tracker.trackFlipkartOrdersV2(productList);579 //tracker.trackAmazonOrders();580 logger.info("Going to sleep for "+WAIT_DURATION_IN_MINUTES+" minutes..............");581 //stayAlive();582 }583 }584 585 @Test586 private void readFileUsingCSV() throws IOException, URISyntaxException {587 588 Reader reader = Files.newBufferedReader(Paths.get(ClassLoader.getSystemResource(productPriceDataBook).toURI()));589 590 List<String[]> productListString = new ArrayList<>();591 592 CSVParser parser = new CSVParserBuilder()593 .withSeparator(',')594 .withIgnoreQuotations(true)595 .build();596 597 CSVReader csvReader = new CSVReaderBuilder(reader)598 .withSkipLines(1)599 .withCSVParser(parser)600 .build();601 602 try {603 productListString = csvReader.readAll();604 reader.close();605 csvReader.close();606 }607 catch(Exception e) {608 e.printStackTrace();609 }610 611 for(String[] product : productListString) {612 for(int i = 0;i<product.length;i++) {613 logger.info("Got -> "+product[i]);614 }615 }616 617 }618 619 @Test620 public void printDataUsingCSV() throws IOException, URISyntaxException {621 622 Reader reader = Files.newBufferedReader(Paths.get(ClassLoader.getSystemResource(productPriceDataBook).toURI()));623 624 List<String[]> productListString = new ArrayList<>();625 626 CSVParser parser = new CSVParserBuilder()627 .withSeparator(',')628 .withIgnoreQuotations(true)629 .build();630 631 CSVReader csvReader = new CSVReaderBuilder(reader)632 .withSkipLines(1)633 .withCSVParser(parser)634 .build();635 636 try {637 productListString = csvReader.readAll();638 reader.close();639 csvReader.close();640 }641 catch(Exception e) {642 e.printStackTrace();643 }644 645 for(String[] product : productListString) {646 for(int i = 0;i<product.length;i++) {647 logger.info("Got -> "+product[i]);648 649 650 }651 }652 653 }654 655 @Test656 public void printDataUsingCSVbean() throws IOException, URISyntaxException {657 658 Reader reader = Files.newBufferedReader(Paths.get(ClassLoader.getSystemResource(productPriceDataBook).toURI()));659 660 List<String[]> productListString = new ArrayList<>();661 662 CSVParser parser = new CSVParserBuilder()663 .withSeparator(',')664 .withIgnoreQuotations(true)665 .build();666 667 CSVReader csvReader = new CSVReaderBuilder(reader)668 .withSkipLines(1)669 .withCSVParser(parser)670 .build();671 672 try {673 productListString = csvReader.readAll();674 reader.close();675 csvReader.close();676 }677 catch(Exception e) {678 e.printStackTrace();679 }680 681 for(String[] product : productListString) {682 for(int i = 0;i<product.length;i++) {683 logger.info("Got -> "+product[i]);684 685 686 }687 }688 689 }690 691 @Test692 public void csvToPojo() throws IOException, URISyntaxException, CsvDataTypeMismatchException, CsvRequiredFieldEmptyException {693 694 ColumnPositionMappingStrategy<Product> strategy = new ColumnPositionMappingStrategy<Product>();695 char delimiter = ',';696 697 strategy.setType(Product.class);698 699 //String[] columnHeaders = new String[] {"LINK","Last Observed Price","Minimum Price","Maximum Price"};700 //strategy.setColumnMapping(columnHeaders);701 702 CsvToBean<Product> csv = new CsvToBean<Product>();703 csv.setMappingStrategy(strategy);704 csv.setCsvReader(new CSVReader(new FileReader(productPriceDataBook)));705 //productList = csv.parse(strategy, new CSVReader(new FileReader(productPriceDataBook),delimiter));706 707 productList = (ArrayList<Product>) csv.parse();708 709 for(Product product : productList) {710 logger.info("Product is "+product);711 }712 713 writePojoToCsv();714 715 }716 717 718 719 @Test720 public void writePojoToCsv() throws IOException, URISyntaxException, CsvDataTypeMismatchException, CsvRequiredFieldEmptyException {721 722 Writer writer = new FileWriter(productPriceDataBook);723 724 ColumnPositionMappingStrategy<Product> mappingStrategy= new ColumnPositionMappingStrategy<Product>(); 725 mappingStrategy.setType(Product.class); 726 StatefulBeanToCsvBuilder<Product> builder = new StatefulBeanToCsvBuilder<Product>(writer);727 StatefulBeanToCsv<Product> beanWriter = builder.withMappingStrategy(mappingStrategy).build(); 728 729 beanWriter.write(productList);730 writer.flush();731 logger.info("CSV File written successfully!!!");732 733 734 735 }736 737 @Test738 public void addNewProduct() throws IOException, URISyntaxException, CsvDataTypeMismatchException, CsvRequiredFieldEmptyException {739 740 ArrayList<Product> productList = new ArrayList<>();741 Product p = new Product();...

Full Screen

Full Screen

Source:PinParser.java Github

copy

Full Screen

...86 WebDriver driver = null;//new ChromeDriver();87 try {88 driver = getWebDriverFromPool();89 //driver.get("http://sb.188bet.com/en-gb/sports/1/competition/full-time-asian-handicap-and-over-under?competitionids=26726,30631,28809,26326,29593,27325,29398,26470,26244,27487,29490,30754,27668,27317,30756,26334,26140,50991,27068,30757,27942,31006,26826,30711,29402,29366,30657,26723,27540,29485,26472,27202,27967,27314,34222,28188,29061,27166,30758,28301,30665,26228,38741,28586,28649,27250,28641,26396,28366,27164,28136,48444,29106,26380,26793,46705,26213,26067,26526,28487,28732,27691,26619,26840,28864,27076,39439,28777,26218,26986,26993,28138,26124,26862,28524,27582,27609");90 driver.get("https://www.pin1111.com/");91 Thread.sleep(5000);92 driver.findElement(By.id("loginButton")).click();93 Thread.sleep(10000);94 driver.findElement(By.className("customerId")).sendKeys("EP767675");95 driver.findElement(By.className("password")).sendKeys("Moon_Fly5");96 driver.findElement(By.className("loginSubmit")).click();97 Thread.sleep(5000);98 driver.findElement(By.xpath("//a[@class='general_button green loginNext']")).click();99 //100 Thread.sleep(5000);101 String htmlSource = driver.getPageSource();102 Document leagues = Jsoup.parse(htmlSource);103 driver.get("https://members.pin1111.com/Sportsbook/Asia/en-US/Bet/Soccer/Moneyline/Double/null/null/Regular/SportsBookAll/Decimal/7/#tab=Menu&sport=");104 Thread.sleep(3000);105 String lines = driver.getPageSource();106 //Document linesDoc = Jsoup.parse(lines);107 /*driver.manage().window().maximize();108 int i = 0 ;109 while(i++ < 20) {110 new Actions(driver).sendKeys(Keys.PAGE_DOWN).perform();111 Thread.sleep(500);112 }113 i = 0;114 while(i++ < 30) {115 new Actions(driver).sendKeys(Keys.PAGE_UP).perform();116 Thread.sleep(100);117 }*/118 //Element idLInes = linesDoc.getElementById("lines");119 Map<String, Object> json = (Map<String, Object>)((JavascriptExecutor) driver).executeScript("return LINES.state.currentSportJson;");120 List<Map<String, Object>> markets = (List)json.get("Markets");121 Map<String, Object> gamesContainers = (Map<String, Object>)markets.get(1).get("GamesContainers");122 //today events123 fillEvents(gamesContainers, events, driver);124 //early markets125 gamesContainers = (Map<String, Object>)markets.get(2).get("GamesContainers");126 fillEvents(gamesContainers, events, driver);127 /*if (idLInes != null) {128 fillBets(driver, idLInes , "Today_29", events);129 idLInes = linesDoc.getElementById("lines");130 driver.navigate().refresh();131 fillBets(driver, idLInes , "Early_29", events);132 }*/133 } catch (Exception e) {134 logger.error("Pin exception - ", e);135 } finally {136 if (driver != null) {137 returnWebDriverToPool(driver);138 }139 }140 return events;141 }142 private void fillEvents(Map<String, Object> gamesContainers, List<BasicEvent> events, WebDriver driver) throws Exception {143 for (String containerKey: gamesContainers.keySet()) {144 Map<String, List<Map>> container = (Map)gamesContainers.get(containerKey);145 for (Map<String, Object> line : container.get("GameLines")) {146 BasicEvent event = new BasicEvent();147 //event.date148 final String team1 = (String)((Map)line.get("TmH")).get("Txt");149 event.team1 = Teams.getTeam(team1.trim());150 final String team2 = (String)((Map)line.get("TmA")).get("Txt");151 event.team2 = Teams.getTeam(team2.trim());152 if (event.team1 == Teams.TEAM_UNKNOWN || event.team2 == Teams.TEAM_UNKNOWN) {153 logger.warn("Pin - unknown teams: " + team1 + ":" + event.team1 + ";" + team2 + ":" + event.team2);154 continue;155 }156 event.site = BetSite.PINNACLE;157 event.link = "pin1111.com";158 event.date = (String)line.get("Date"); //line.Date;159 //String day = ((String) line.get("DispDate")).substring(0, 5) + "/2015";160 event.day = format.parse(event.date.split(" ")[0]);161 event.bets.put(BetType.P1, getOdds((String)((List)line.get("WagerMap")).get(0)));162 event.bets.put(BetType.X, getOdds((String)((List)line.get("WagerMap")).get(1)));163 //event.bets.put(BetType.P2, getOdds((String)((List)line.get("WagerMap")).get(2))); TODO164 //additional165 String additionalOddsLink = "https://members.pin1111.com" + ((String)line.get("Alt")).split("\"")[1];166 Object addBets = (Object)((JavascriptExecutor) driver).executeScript("window.addBets = \"\";");167 Thread.sleep(100);168 ((JavascriptExecutor) driver)169 .executeScript("return LINES.ajax.post(\"" + additionalOddsLink + "\")." +170 "done(function(d) {window.addBets = d;}).fail(function(d) {window.addBets = d});");171 Thread.sleep(100);172 String addBetsPage = (String)((JavascriptExecutor) driver).executeScript("return window.addBets;");173 int waitCount = 0;174 while (addBetsPage.length() < 10 && waitCount++ < 30) {175 Thread.sleep(100);176 addBetsPage = (String)((JavascriptExecutor) driver).executeScript("return window.addBets;");177 }178 if (addBetsPage != null) {179 //check for teams180 if (addBetsPage.contains(team1) || addBetsPage.contains(team2)) {181 fillAddLines(event, addBetsPage);182 } else {183 logger.fatal("Pin incorrect add lines");184 }185 }186 EventSender.sendEvent(event);187 events.add(event);188 //PostMethod addPost = new PostMethod(additionalOddsLink);189 }190 }191 }192 public void fillAddLines(BasicEvent event, String body) throws Exception {193 StringBuilder html = new StringBuilder();194 html.append("<!DOCTYPE html><html><body>");195 html.append(body);196 html.append("</body></html>");197 Document smallDoc = Jsoup.parse(html.toString());198 Element spreadTotal = smallDoc.getElementsByClass("spreadTotal").first();199 if (spreadTotal != null) {200 for (Element overUnderLine: spreadTotal.select("tr")) {201 if (overUnderLine.hasClass("periodLabel") && !overUnderLine.select("th").text().equalsIgnoreCase("Match- Handicap/Over Under")) {202 break;203 }204 if (!overUnderLine.hasClass("periodLabel") && !overUnderLine.hasClass("columnLabel")) {205 Elements lineTd = overUnderLine.select("td");206 if (lineTd != null && lineTd.size() == 7) {207 //fora208 String fora1Href = lineTd.get(2).select("a").first().attr("href");209 if (fora1Href.contains("line=")) {210 String fora1 = fora1Href.split("line=")[1];211 BetType betF1 = BetDataMapping.betsTotal.get(fora1 + "F1");212 String fora1Val = lineTd.get(2).text();213 if (betF1 != null && fora1Val != null && !fora1Val.isEmpty()) {214 event.bets.put(betF1, fora1Val);215 }216 }217 String fora2Href = lineTd.get(3).select("a").first().attr("href");218 if (fora2Href.contains("line=")) {219 String fora2 = fora2Href.split("line=")[1];220 BetType betF2 = BetDataMapping.betsTotal.get(fora2 + "F2");221 String fora2Val = lineTd.get(3).text();222 if (betF2 != null && fora2Val != null && !fora2Val.isEmpty()) {223 event.bets.put(betF2, fora2Val);224 }225 }226 //total227 String totalOverHref = lineTd.get(5).select("a").first().attr("href");228 if (totalOverHref.contains("line=")) {229 String totalOver = totalOverHref.split("line=")[1];230 BetType betOver = BetDataMapping.betsTotal.get(totalOver + "M");231 String totalOverVal = lineTd.get(5).text();232 if (betOver != null && totalOverVal != null && !totalOverVal.isEmpty()) {233 event.bets.put(betOver, totalOverVal);234 }235 }236 String totalUnderHref = lineTd.get(6).select("a").first().attr("href");237 if (totalUnderHref.contains("line=")) {238 String totalUnder = totalUnderHref.split("line=")[1];239 BetType betUnder = BetDataMapping.betsTotal.get(totalUnder + "L");240 String totalUnderVal = lineTd.get(6).text();241 if (betUnder != null && totalUnderVal != null && !totalUnderVal.isEmpty()) {242 event.bets.put(betUnder, totalUnderVal);243 }244 }245 }246 }247 }248 }249 }250 public void fillBets(WebDriver driver, Element idLInes , String lines, List<BasicEvent> events) throws Exception {251 Element today = idLInes.getElementById(lines);252 if (today != null) {253 Element table = today.select("table").first();254 int pdCount = 0;255 boolean multiPD = true;256 Elements evRows = table.select("tr");257 for (Element evRow: table.getElementsByClass("evRow")) {258 Elements tds = evRow.select("td");259 if (tds != null && tds.size() == 9) {260 String[] teams = tds.get(1).text().split("-vs-");261 BasicEvent event = new BasicEvent();262 if (lines.equals("Today_29")) {263 event.day = new Date();264 event.date = event.day.toString();265 } else if (lines.equals("Early_29")) {266 event.date = tds.get(0).text().trim();267 event.day = format.parse(event.date.substring(0, 5) + "/" + Calendar.getInstance().get(Calendar.YEAR));268 }269 event.team1 = Teams.getTeam(teams[0].trim());270 event.team2 = Teams.getTeam(teams[1].trim());271 if (event.team1 == Teams.TEAM_UNKNOWN || event.team2 == Teams.TEAM_UNKNOWN) {272 //continue;273 }274 event.bets.put(BetType.P1, tds.get(2).text());275 event.bets.put(BetType.X, tds.get(3).text());276 event.bets.put(BetType.P2, tds.get(4).text());277 final String href = tds.get(8).select("a").first().attr("href");278 clickLinkByHref(driver, href, multiPD, multiPD);279 if (pdCount++ < 4) {280 multiPD = false;281 } else {282 pdCount = 0;283 multiPD = true;284 }285 //driver.findElement(By.cssSelector("a[href*='" + href + "']")).click();286 Thread.sleep(200);287 Document smallDoc = Jsoup.parse(driver.getPageSource());288 Element spreadTotal = smallDoc.getElementsByClass("spreadTotal").first();289 int count = 0;290 while (spreadTotal == null && count++ < 20) {291 Thread.sleep(200);292 smallDoc = Jsoup.parse(driver.getPageSource());293 spreadTotal = smallDoc.getElementsByClass("spreadTotal").first();294 }295 if (spreadTotal != null) {296 for (Element overUnderLine: spreadTotal.select("tr")) {297 if (overUnderLine.hasClass("periodLabel") && !overUnderLine.select("th").text().equalsIgnoreCase("Match- Handicap / Over Under")) {298 break;299 }300 if (!overUnderLine.hasClass("periodLabel") && !overUnderLine.hasClass("columnLabel")) {301 Elements lineTd = overUnderLine.select("td");302 if (lineTd != null && lineTd.size() == 7) {303 //fora304 String fora1Href = lineTd.get(2).select("a").first().attr("href");305 if (fora1Href.contains("line=")) {306 String fora1 = fora1Href.split("line=")[1];307 BetType betF1 = BetDataMapping.betsTotal.get(fora1 + "F1");308 String fora1Val = lineTd.get(2).text();309 if (betF1 != null && fora1Val != null && !fora1Val.isEmpty()) {310 event.bets.put(betF1, fora1Val);311 }312 }313 String fora2Href = lineTd.get(3).select("a").first().attr("href");314 if (fora2Href.contains("line=")) {315 String fora2 = fora2Href.split("line=")[1];316 BetType betF2 = BetDataMapping.betsTotal.get(fora2 + "F2");317 String fora2Val = lineTd.get(3).text();318 if (betF2 != null && fora2Val != null && !fora2Val.isEmpty()) {319 event.bets.put(betF2, fora2Val);320 }321 }322 //total323 String totalOverHref = lineTd.get(5).select("a").first().attr("href");324 if (totalOverHref.contains("line=")) {325 String totalOver = totalOverHref.split("line=")[1];326 BetType betOver = BetDataMapping.betsTotal.get(totalOver + "M");327 String totalOverVal = lineTd.get(5).text();328 if (betOver != null && totalOverVal != null && !totalOverVal.isEmpty()) {329 event.bets.put(betOver, totalOverVal);330 }331 }332 String totalUnderHref = lineTd.get(6).select("a").first().attr("href");333 if (totalUnderHref.contains("line=")) {334 String totalUnder = totalUnderHref.split("line=")[1];335 BetType betUnder = BetDataMapping.betsTotal.get(totalUnder + "L");336 String totalUnderVal = lineTd.get(6).text();337 if (betUnder != null && totalUnderVal != null && !totalUnderVal.isEmpty()) {338 event.bets.put(betUnder, totalUnderVal);339 }340 }341 }342 }343 }344 }345 ((JavascriptExecutor) driver).executeScript("LINES.helpers.alternateLines.close();");346 events.add(event);347 }348 }349 }350 }351 private void clickLinkByHref(WebDriver driver, String href, boolean multiPD, boolean isRec) {352 List<WebElement> anchors = driver.findElements(By.tagName("a"));353 Iterator<WebElement> i = anchors.iterator();354 while(i.hasNext()) {355 WebElement anchor = i.next();356 try {357 final String hrefAttr = anchor.getAttribute("href");358 if (hrefAttr != null && hrefAttr.contains(href)) {359 Actions actions = new Actions(driver);360 //Actions actionsMove = new Actions(driver);361 //actionsMove.moveToElement(anchor);362 //actionsMove.perform();363 actions.moveToElement(anchor).click().perform();364 if (multiPD) {365 new Actions(driver).sendKeys(Keys.DOWN).perform();366 new Actions(driver).sendKeys(Keys.DOWN).perform();367 new Actions(driver).sendKeys(Keys.DOWN).perform();368 new Actions(driver).sendKeys(Keys.DOWN).perform();369 new Actions(driver).sendKeys(Keys.DOWN).perform();370 new Actions(driver).sendKeys(Keys.DOWN).perform();371 new Actions(driver).sendKeys(Keys.DOWN).perform();372 Thread.sleep(200);373 if (isRec) {374 clickLinkByHref(driver, href, false, false);375 }376 }377 break;378 }379 } catch (Exception e) {380 logger.error("Pin webDriver exception - ", e);381 }382 }383 }384 /*385 String sessionToken = "";386 //get token387 HttpClient httpClient = new HttpClient(HttpClientInitializer.getConnectionManager());388 //authorize(httpClient);389 login();390 //HttpPost postHttp = new HttpPost("https://www.matchbook.com/bpapi/rest/security/session/");391 GetMethod getData = new GetMethod("https://members.pin1111.com/Sportsbook/Asia/en-US/GetLines/Soccer/Moneyline/0/null/null/Regular/SportsBookAll/Decimal/7/false/?");392 getData.setQueryString(new NameValuePair[] {393 new NameValuePair("buySellLevels", "{}"),394 });395 getData.addRequestHeader(new Header("Cookie", "PCTR=637195278844525542; UserPrefsCookie=device=d&languageGroup=asian&languageId=1&linesTypeView=d&priceStyle" +396 "=Decimal; LastPageCookie=url=http://www.pin1111.com/default.aspx&time=3/13/2015 12:51:03 PM; UserAccess" +397 "=0; GRP=!qvH72fSqKL/NoB/huYL6pw2e6Lf7lY+a7UAPRkFgPv3G4MUX0mGonA+Od+dt; TS0164fdd7=01ecdb00b7897d2f22" +398 "089c1267a7c1cd5c3e032359e9c36d37d7050e5d2d6210a9f83ceea2bc8c613b7b6bd9fab43db29272a01c22f5105d568467" +399 "2fa2c07f3179a841f945f328d6b3cd5061652c1f0c6024c23c4b7729418099169f0f5567c8849aa0a01d1d857b8ba38259d39f37df205f3aa54010b071bef75f6d1f5c679287f89bc055bcdc8057fb3e5c82bfe6dc2ed742b2b9" +400 "; ADRUM=s=1426272606418&r=https%3A%2F%2Fwww.pin1111.com%2F%3F0; enhanced=pass; bootstraprun=no; Webmetrics-RUMn" +401 "=s=1426272606417&r=https%3A%2F%2Fwww.pin1111.com%2F; ADRUM_BT=R%3a116%7cclientRequestGUID%3a1bcd7fcd-86cc-48e2-8786-c6c68fcdca81" +402 "%7cbtId%3a783%7cbtERT%3a2; custid=id=EP767675&hash=F4D159EF7FFC2D5177C409A7B4FEC56A"));403 try {404 int returnCode = httpClient.executeMethod(getData);405 if (returnCode == HttpStatus.SC_OK) {406 String retLeague = IOUtils.toString(new InputStreamReader(getData.getResponseBodyAsStream(), "UTF-8"));407 logger.info(retLeague);408 MoneyLine moneyLine = gson.fromJson(retLeague, MoneyLine.class);409 logger.info(moneyLine.toString());410 for (String containerKey: moneyLine.Sport.Markets.get(2).GamesContainers.keySet()) {411 GamesContainer container = moneyLine.Sport.Markets.get(2).GamesContainers.get(containerKey);412 for (GameLine line: container.GameLines) {413 BasicEvent event = new BasicEvent();414 //event.date415 event.team1 = Teams.getTeam(line.TmH.Txt.trim());416 event.team2 = Teams.getTeam(line.TmA.Txt.replace("\\\\r\\\\n", "").trim());417 if (event.team1 == Teams.TEAM_UNKNOWN || event.team2 == Teams.TEAM_UNKNOWN) {418 continue;419 }420 event.site = "pinnacle";421 event.date = line.Date;422 String day = line.DispDate.substring(0,5) + "/2015";423 event.day = format.parse(day);424 event.bets.put(Bet.P1, getOdds(line.WagerMap.get(0)));425 event.bets.put(Bet.X, getOdds(line.WagerMap.get(1)));426 event.bets.put(Bet.P2, getOdds(line.WagerMap.get(2)));427 //additional428 String additionalOddsLink = "https://members.pin1111.com" + line.Alt.split("\"")[1];429 PostMethod addPost = new PostMethod(additionalOddsLink);430 UUID reqId = UUID.randomUUID();431 addPost.addRequestHeader(new Header("Cookie", "PCTR=637195278844525542; UserPrefsCookie=device=d&languageGroup=asian&languageId=1&linesTypeView=d&priceStyle" +432 "=Decimal; LastPageCookie=url=http://www.pin1111.com/default.aspx&time=3/13/2015 12:51:03 PM; UserAccess" +433 "=0; GRP=!qvH72fSqKL/NoB/huYL6pw2e6Lf7lY+a7UAPRkFgPv3G4MUX0mGonA+Od+dt; TS0164fdd7=01ecdb00b7897d2f22" +434 "089c1267a7c1cd5c3e032359e9c36d37d7050e5d2d6210a9f83ceea2bc8c613b7b6bd9fab43db29272a01c22f5105d568467" +435 "2fa2c07f3179a841f945f328d6b3cd5061652c1f0c6024c23c4b7729418099169f0f5567c8849aa0a01d1d857b8ba38259d39f37df205f3aa54010b071bef75f6d1f5c679287f89bc055bcdc8057fb3e5c82bfe6dc2ed742b2b9" +436 "; ADRUM=s=1426272606418&r=https%3A%2F%2Fwww.pin1111.com%2F%3F0; enhanced=pass; bootstraprun=no; Webmetrics-RUM" +437 "=s=1426272606417&r=https%3A%2F%2Fwww.pin1111.com%2F; custid=id=EP767675&hash=F4D159EF7FFC2D5177C409A7B4FEC56A"));438 addPost.addRequestHeader(new Header("Cookie", "R:120|clientRequestGUID:" + reqId + "|btId:601|btERT:" + ++ert));439 addPost.addRequestHeader(new Header("Accept", "text/plain, ; q=0.01"));440 addPost.addRequestHeader(new Header("Accept-Encoding", "gzip, deflate"));441 addPost.addRequestHeader(new Header("Accept-Language", "ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3"));442 addPost.addRequestHeader(new Header("Cache-Control", "no-cache"));443 addPost.addRequestHeader(new Header("Connection", "keep-alive"));444 addPost.addRequestHeader(new Header("Content-Length", "9"));445 addPost.addRequestHeader(new Header("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"));446 addPost.addRequestHeader(new Header("Host", "members.pin1111.com"));447 addPost.addRequestHeader(new Header("Pragma", "no-cache"));448 addPost.addRequestHeader(new Header("Referer", "https://members.pin1111.com/Sportsbook/Asia/en-US/Bet/Soccer/Moneyline/Double/null/null/Regular/SportsBookAll/Decimal/7/"));449 addPost.addRequestHeader(new Header("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0"));450 addPost.addRequestHeader(new Header("X-Requested-With", "XMLHttpRequest"));451 StringRequestEntity requestEntity = new StringRequestEntity("test=test");452 addPost.setRequestEntity(requestEntity);453 returnCode = httpClient.executeMethod(addPost);454 if (returnCode == HttpStatus.SC_OK) {455 StringBuilder smallHtml = new StringBuilder();456 smallHtml.append("<!DOCTYPE html><html><body>");457 GZIPInputStream zippedInputStream = new GZIPInputStream(addPost.getResponseBodyAsStream());458 //String authRet = IOUtils.toString(new InputStreamReader(post.getResponseBodyAsStream(), "UTF-8"));459 String ret = IOUtils.toString(new InputStreamReader(zippedInputStream));460 smallHtml.append(ret);461 smallHtml.append("</body></html>");462 logger.info(ret);463 Document smallDoc = Jsoup.parse(smallHtml.toString());464 Element spreadTotal = smallDoc.getElementsByClass("spreadTotal").first();465 if (spreadTotal != null) {466 for (Element overUnderLine: spreadTotal.select("tr")) {467 if (overUnderLine.hasClass("periodLabel") && !overUnderLine.select("th").text().equalsIgnoreCase("Match- Handicap / Over Under")) {468 break;469 }470 if (!overUnderLine.hasClass("periodLabel") && !overUnderLine.hasClass("columnLabel")) {471 Elements lineTd = overUnderLine.select("td");472 if (lineTd != null && lineTd.size() == 7) {473 //fora474 String fora1 = lineTd.get(2).select("a").first().attr("href").split("line=")[1];475 String fora2 = lineTd.get(3).select("a").first().attr("href").split("line=")[1];476 Bet betF1 = BetDataMapping.betsTotal.get(fora1 + "F1");477 Bet betF2 = BetDataMapping.betsTotal.get(fora2 + "F2");478 String fora1Val = lineTd.get(2).text();479 String fora2Val = lineTd.get(3).text();480 if (betF1 != null && fora1Val != null && !fora1Val.isEmpty()) {481 event.bets.put(betF1, fora1Val);482 }483 if (betF2 != null && fora2Val != null && !fora2Val.isEmpty()) {484 event.bets.put(betF2, fora2Val);485 }486 //total487 String totalOver = lineTd.get(5).select("a").first().attr("href").split("line=")[1];488 Bet betOver = BetDataMapping.betsTotal.get(totalOver + "M");489 String totalOverVal = lineTd.get(5).text();490 String totalUnder = lineTd.get(6).select("a").first().attr("href").split("line=")[1];491 Bet betUnder = BetDataMapping.betsTotal.get(totalUnder + "L");492 String totalUnderVal = lineTd.get(6).text();493 if (betOver != null && totalOverVal != null && !totalOverVal.isEmpty()) {494 event.bets.put(betOver, totalOverVal);495 }496 if (betUnder != null && totalUnderVal != null && !totalUnderVal.isEmpty()) {497 event.bets.put(betUnder, totalUnderVal);498 }499 }500 }501 }502 }503 //Element window = new Element();504 }505 events.add(event);506 }507 }508 }509 } catch (Exception e) {510 logger.info("ex + " + e);511 e.printStackTrace();512 }513 return events;514 /*PostMethod post = new PostMethod("https://www.pin1111.com/login/authenticate/Classic/en-US");515 post.addRequestHeader(new Header("ADRUM", "isAjax:true"));516 post.addRequestHeader(new Header("Accept", ""));517 post.addRequestHeader(new Header("Accept-Encoding", "gzip, deflate"));518 post.addRequestHeader(new Header("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"));519 post.addRequestHeader(new Header("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0"));520 post.addRequestHeader(new Header("Host", "www.pin1111.com"));521 post.addRequestHeader(new Header("Referer", "https://www.pin1111.com/"));522 post.addRequestHeader(new Header("X-Requested-With", "XMLHttpRequest"));523 post.addRequestHeader(new Header("Cookie", "Cookie:PCTR=637140822655419184; ASP.NET_SessionId=blz5qja0lucggttqp3coag5m; " +524 "UserPrefsCookie=languageId=1&priceStyle=decimal&linesTypeView=s&device=d&languageGroup=all;"));525 try {526 StringRequestEntity requestEntity = new StringRequestEntity(527 "ctl00%24LDDL=1&ctl00%24PSDDL=decimal&CustomerId=EP767675&Password=Moon_Fly5&AppId=Classic");528 post.setRequestEntity(requestEntity);529 int returnCode = httpClient.executeMethod(post);530 if (returnCode == HttpStatus.SC_MOVED_TEMPORARILY) {531 String retLeague = IOUtils.toString(new InputStreamReader(post.getResponseBodyAsStream(), "UTF-8"));532 logger.info(retLeague);533 //League leagueObj = gson.fromJson(retLeague, League.class);534 GetMethod getLogin = new GetMethod("https://www.pin1111.com/login/Deposit/Classic/en-US?");535 getLogin.setQueryString(new NameValuePair[] {536 new NameValuePair("CustomerId", "EP767675"),537 new NameValuePair("NextSteps", "4"),538 new NameValuePair("IsAjaxRequest", "True"),539 });540 getLogin.addRequestHeader(new Header("ADRUM", "isAjax:true"));541 getLogin.addRequestHeader(new Header("Accept", ""));542 getLogin.addRequestHeader(new Header("Accept-Encoding", "gzip, deflate"));543 getLogin.addRequestHeader(new Header("Accept-Language", "ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3"));544 getLogin.addRequestHeader(new Header("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"));545 getLogin.addRequestHeader(new Header("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0"));546 getLogin.addRequestHeader(new Header("X-Requested-With", "XMLHttpRequest"));547 getLogin.addRequestHeader(new Header("Cookie", post.getResponseHeader("Set-Cookie").getValue()));548 returnCode = httpClient.executeMethod(getLogin);549 //if (returnCode == HttpStatus.SC_OK) {550 retLeague = IOUtils.toString(new InputStreamReader(getLogin.getResponseBodyAsStream(), "UTF-8"));551 logger.info(retLeague);552 //}553 }554 } catch (Exception e) {555 }556 return events;557 }558 private void authorize(HttpClient httpClient) {559 GetMethod getMain = new GetMethod("https://www.pin1111.com/");560 getMain.addRequestHeader(new Header("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0"));561 getMain.addRequestHeader(new Header("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,q=0.8"));562 getMain.addRequestHeader(new Header("Accept-Language", "ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3"));563 getMain.addRequestHeader(new Header("Accept-Encoding", "gzip, deflate"));564 getMain.addRequestHeader(new Header("Cookie", "Webmetrics-RUM=s=1426096981500&r=https%3A%2F%2Fwww.pin1111.com%2F; ADRUM=s=1426096981502&r=https%3A%2F" +565 "%2Fwww.pin1111.com%2F%3F0"));566 getMain.addRequestHeader(new Header("Host", "www.pin1111.com"));567 getMain.addRequestHeader(new Header("Connection", "keep-alive"));568 try {569 int returnCode = HttpStatus.SC_OK; //httpClient.executeMethod(getMain);570 if (returnCode == HttpStatus.SC_OK) {571 PostMethod post = new PostMethod("https://www.pin1111.com/login/authenticate/Classic/en-GB");572 post.addRequestHeader(new Header("ADRUM", "isAjax:true"));573 post.addRequestHeader(new Header("Accept", ""));574 post.addRequestHeader(new Header("Accept-Encoding", "gzip, deflate"));575 post.addRequestHeader(new Header("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"));576 post.addRequestHeader(new Header("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0"));577 post.addRequestHeader(new Header("Host", "www.pin1111.com"));578 post.addRequestHeader(new Header("Referer", "https://www.pin1111.com/"));579 post.addRequestHeader(new Header("X-Requested-With", "XMLHttpRequest"));580 post.addRequestHeader(new Header("Cookie", "TS01b38df3=01ecdb00b79e190bc19222bbd20f419d2999668f57c9f9b3b80bb256b3ae9a8b06dffb8fd1723ff" +581 "631ac9d2e35a78b2beec79a14d4dfe60a7f7dc627e758e77b2a77b0bc6c; Webmetrics-RUM=s=1426097198483&r=https%3A%2F%2Fwww.pin1111.com%2F;" +582 " ADRUM=s=1426097198485&r=https%3A%2F%2Fwww.pin1111.com%2F%3F0; ASP.NET_SessionId=vuy4w0ui3ubaw2iyok04tbr1; PCTR=637195252531470018; " +583 "UserPrefsCookie=languageId=2&priceStyle=decimal&linesTypeView=c&device=d&languageGroup=all; " +584 "LastPageCookie=url=http://www.pin1111.com/default.aspx&time=11/03/2015 12:07:41; " +585 "TS0164fdd7=01ecdb00b7ef4c85089eb5629c9472b754bb3b7919c9f9b3b80bb256b3ae9a8b06dffb8fd1773f550b06860ce2e5b55dc5b9d4ac6a0f01cea" +586 "a1a8c3abc65b2204af35f5abce71adeb4b7d3a7254d69aaa569830ad02ae9380828f562f8fc38ceca1c83691f"));587 StringRequestEntity requestEntity = new StringRequestEntity(588 "ctl00%24LDDL=1&ctl00%24PSDDL=decimal&CustomerId=EP767675&Password=Moon_Fly5&AppId=Classic");589 post.setRequestEntity(requestEntity);590 returnCode = HttpStatus.SC_MOVED_TEMPORARILY; //httpClient.executeMethod(post);591 if (returnCode == HttpStatus.SC_MOVED_TEMPORARILY) {592 GetMethod getData = new GetMethod("https://members.pin1111.com/Sportsbook/Asia/en-US/GetLines/Soccer/Moneyline/0/null/null/Regular/SportsBookAll/Decimal/7/false/?");593 getData.setQueryString(new NameValuePair[] {594 new NameValuePair("buySellLevels", "{}"),595 });596 getData.addRequestHeader(new Header("Cookie", "ADRUM_BT=R%3a116%7cclientRequestGUID%3a13f812a0-cc0b-4b71-a7f3-aaaa54f31b9b%7cbtId%3a397%7cbtERT%3a723" +597 "; PCTR=637195268650950038; UserPrefsCookie=device=d&languageGroup=asian&languageId=1&linesTypeView=d" +598 "&priceStyle=Decimal; LastPageCookie=url=http://www.pin1111.com/default.aspx&time=11/03/2015 12:34:25" +599 "; TS0164fdd4=01eedb00b774eec99ba1ad8bc1620f6d786fc63d8103b4839d5c74bad47274830638759a8297bdb73cb1e57" +600 "708bf972c4de307ecb521f42567aa2a29b838b842b0db931a53bc1466ed4b8ad2860d9d4d84bc5f45122b7f8fa203c54bb99" +601 "eddd4c30f42ee95372fcc463391b86914645ac7d4843effc56a7ba50616b037983d4b8b3752c267156a8a9fa95a6ca537b5efe891ff52c9" +602 "; custid=id=EP767675&hash=CB3B674031EFA310BC150E729EB165F3; UserAccess=0; GRP=!iAwW1b7IGAqnpZctniSipadkm1hHZzZcXBlu5AfZ01DeBMX7blWpmu1f" +603 "/tcZ; bootstraprun=no; Webmetrics-RUM=s=1426098810293&r=https%3A%2F%2Fwww.pin1111.com%2F; ADRUM=s=1426098810294" +604 "&r=https%3A%2F%2Fwww.pin1111.com%2F%3F0; enhanced=pass"));605 returnCode = httpClient.executeMethod(getData);606 if (returnCode == HttpStatus.SC_OK) {}607 }608 }609 } catch (Exception e) {610 logger.info("ex" + e);611 }612 }*/613 private static String getOdds(String oddsA) {614 int firstPos = oddsA.indexOf(">");615 if (firstPos != -1) {616 int secondPos = oddsA.indexOf("<", firstPos);617 if (secondPos != -1) {618 return oddsA.substring(firstPos + 1, secondPos);...

Full Screen

Full Screen

Source:Topic_14_JavascriptExecutor.java Github

copy

Full Screen

...53 clickToElementByJS("//a[text()='Mobile']");54 55 clickToElementByJS("//a[text()='Samsung Galaxy']/parent::h2/following-sibling::div[@class='actions']/button");56 57 Assert.assertTrue(isExpectedTextInInnerText("Samsung Galaxy was added to your shopping cart."));58 59 clickToElementByJS("//a[text()='Customer Service']");60 61 scrollToElement("//input[@id='newsletter']");62 63 sendkeyToElementByJS("//input[@id='newsletter']", getRandomEmail());64 65 clickToElementByJS("//button[@title='Subscribe']");66 67 Assert.assertTrue(isExpectedTextInInnerText("Thank you for your subscription."));68 69 navigateToUrlByJS("http://demo.guru99.com/v4/");70 explicitWait.until(ExpectedConditions.urlToBe("http://demo.guru99.com/v4/"));71 72 Assert.assertEquals((String) executeForBrowser("return document.domain;"), "demo.guru99.com");73 }74 75 //@Test76 public void TC_02_Validation_Message() {77 navigateToUrlByJS("https://automationfc.github.io/html5/index.html");78 79 clickToElementByJS("//input[@name='submit-btn']");80 sleepInSecond(1);81 82 Assert.assertEquals(getElementValidationMessage("//input[@id='fname']"), "Please fill out this field.");83 84 sendkeyToElementByJS("//input[@id='fname']", "Automation FC");85 sleepInSecond(1);86 87 clickToElementByJS("//input[@name='submit-btn']");88 sleepInSecond(1);89 90 Assert.assertEquals(getElementValidationMessage("//input[@id='pass']"), "Please fill out this field.");91 92 sendkeyToElementByJS("//input[@id='pass']", "123456");93 sleepInSecond(1);94 95 clickToElementByJS("//input[@name='submit-btn']");96 sleepInSecond(1);97 98 Assert.assertEquals(getElementValidationMessage("//input[@id='em']"), "Please fill out this field.");99 100 sendkeyToElementByJS("//input[@id='em']", "123");101 sleepInSecond(1);102 103 clickToElementByJS("//input[@name='submit-btn']");104 sleepInSecond(1);105 106 Assert.assertEquals(getElementValidationMessage("//input[@id='em']"), "Please include an '@' in the email address. '123' is missing an '@'.");107 108 sendkeyToElementByJS("//input[@id='em']", "123@234");109 sleepInSecond(1);110 111 clickToElementByJS("//input[@name='submit-btn']");112 sleepInSecond(1);113 114 Assert.assertEquals(getElementValidationMessage("//input[@id='em']"), "Please match the requested format.");115 116 sendkeyToElementByJS("//input[@id='em']", "123@234.567");117 sleepInSecond(1);118 119 clickToElementByJS("//input[@name='submit-btn']");120 sleepInSecond(1);121 122 Assert.assertEquals(getElementValidationMessage("//select"), "Please select an item in the list.");123 }124 125 //@Test126 public void TC_03_New_Customer() {127 navigateToUrlByJS("http://demo.guru99.com/v4");128 129 String loginPageUrl, userID, password;130 String name, dob, address, city, state, pin, phone, email;131 132 By nameTextboxBy = By.name("name");133 By dobTextboxBy = By.name("dob");134 By addressTextAreaBy = By.name("addr");135 By cityTextboxBy = By.name("city");136 By stateTextboxBy = By.name("state");137 By pinTextboxBy = By.name("pinno");138 By phoneTextboxBy = By.name("telephoneno");139 By emailTextboxBy = By.name("emailid");140 By passwordTextboxBy = By.name("password");141 142 name = "John Kennedy";143 dob = "1960-01-01";144 address = "564 Suitable Address";145 city = "New York";146 state = "California";147 pin = "999666";148 phone = "0999666999";149 email = getRandomEmail();150 151 loginPageUrl = driver.getCurrentUrl();152 driver.findElement(By.xpath("//a[text()='here']")).click();153 driver.findElement(By.xpath("//input[@name='emailid']")).sendKeys(email);154 driver.findElement(By.xpath("//input[@name='btnLogin']")).click();155 userID = driver.findElement(By.xpath("//td[text()='User ID :']/following-sibling::td")).getText();156 password = driver.findElement(By.xpath("//td[text()='Password :']/following-sibling::td")).getText();157 158 driver.get(loginPageUrl);159 driver.findElement(By.xpath("//input[@name='uid']")).sendKeys(userID);160 driver.findElement(By.xpath("//input[@name='password']")).sendKeys(password);161 driver.findElement(By.xpath("//input[@name='btnLogin']")).click();162 Assert.assertTrue(driver.findElement(By.xpath("//td[text()='Manger Id : " + userID + "']")).isDisplayed());163 164 driver.findElement(By.xpath("//a[text()='New Customer']")).click();165 driver.findElement(nameTextboxBy).sendKeys(name);166 167 //REMOVE DATE PICKER168 removeAttributeInDOM("//input[@name='dob']", "type");169 sleepInSecond(1);170 171 driver.findElement(dobTextboxBy).sendKeys(dob);172 driver.findElement(addressTextAreaBy).sendKeys(address);173 driver.findElement(cityTextboxBy).sendKeys(city);174 driver.findElement(stateTextboxBy).sendKeys(state);175 driver.findElement(pinTextboxBy).sendKeys(pin);176 driver.findElement(phoneTextboxBy).sendKeys(phone);177 driver.findElement(emailTextboxBy).sendKeys(email);178 driver.findElement(passwordTextboxBy).sendKeys(password);179 driver.findElement(By.name("sub")).click();180 Assert.assertTrue(driver.findElement(By.xpath("//p[text()='Customer Registered Successfully!!!']")).isDisplayed());181 Assert.assertEquals(driver.findElement(By.xpath("//td[text()='Customer Name']/following-sibling::td")).getText(), name);182 Assert.assertEquals(driver.findElement(By.xpath("//td[text()='Birthdate']/following-sibling::td")).getText(), dob);183 Assert.assertEquals(driver.findElement(By.xpath("//td[text()='Address']/following-sibling::td")).getText(), address);184 Assert.assertEquals(driver.findElement(By.xpath("//td[text()='City']/following-sibling::td")).getText(), city);185 Assert.assertEquals(driver.findElement(By.xpath("//td[text()='State']/following-sibling::td")).getText(), state);186 Assert.assertEquals(driver.findElement(By.xpath("//td[text()='Pin']/following-sibling::td")).getText(), pin);187 Assert.assertEquals(driver.findElement(By.xpath("//td[text()='Mobile No.']/following-sibling::td")).getText(), phone);188 Assert.assertEquals(driver.findElement(By.xpath("//td[text()='Email']/following-sibling::td")).getText(), email);189 }190 191 @Test192 public void TC_04_Register() {193 navigateToUrlByJS("http://live.demoguru99.com/");194 195 clickToElementByJS("//div[@id='header-account']//a[text()='My Account']");196 197 198 }199 200 public void sleepInSecond(long second) {...

Full Screen

Full Screen

Source:JavascriptExecutor.java Github

copy

Full Screen

...143 * @see WebDriver.Timeouts#setScriptTimeout(java.time.Duration)144 */145 Object executeAsyncScript(String script, Object... args);146 /**147 * Commonly used scripts may be "pinned" to the WebDriver session,148 * allowing them to be called efficiently by their handle rather than149 * sending the entire script across the wire for every call.150 * <p>151 * The default implementation of this adheres to the API's expectations152 * but is inefficient.153 *154 * @see #executeScript(ScriptKey, Object...)155 * @param script The Javascript to execute.156 * @return A handle which may later be used in {@link #executeScript(ScriptKey, Object...)}157 * @throws JavascriptException If the script cannot be pinned for some reason.158 */159 default ScriptKey pin(String script) {160 Require.nonNull("Script to pin", script);161 return UnpinnedScriptKey.pin(this, script);162 }163 /**164 * Deletes the reference to a script that has previously been pinned.165 * Subsequent calls to {@link #executeScript(ScriptKey, Object...)} will166 * fail for the given {@code key}.167 */168 default void unpin(ScriptKey key) {169 Require.nonNull("Key to unpin", key);170 Require.stateCondition(171 key instanceof UnpinnedScriptKey,172 "Script key should have been generated by this driver");173 UnpinnedScriptKey.unpin(this, (UnpinnedScriptKey) key);174 }175 /**176 * @return The {@link ScriptKey}s of all currently pinned scripts.177 */178 default Set<ScriptKey> getPinnedScripts() {179 return Collections.unmodifiableSet(UnpinnedScriptKey.getPinnedScripts(this).stream()180 .map(key -> (ScriptKey) key)181 .collect(Collectors.toSet()));182 }183 /**184 * Calls a script by the {@link ScriptKey} returned by {@link #pin(String)}.185 * This can be thought of as inlining the pinned script and simply calling186 * {@link #executeScript(String, Object...)}.187 *188 * @see #executeScript(String, Object...)189 */190 default Object executeScript(ScriptKey key, Object... args) {191 Require.stateCondition(192 key instanceof UnpinnedScriptKey,193 "Script key should have been generated by this driver");194 if (!getPinnedScripts().contains(key)) {195 throw new JavascriptException("Script is unpinned");196 }197 return executeScript(((UnpinnedScriptKey) key).getScript(), args);198 }199}...

Full Screen

Full Screen

Source:Cowin.java Github

copy

Full Screen

...32 WebElement districtDropDownClicked = driver33 .findElement(By.xpath("/html/body/div[2]/div[2]/div/div/div/mat-option[19]/span"));34 districtDropDownClicked.click();35 Thread.sleep(2000);36 WebElement Search = driver.findElement(By.xpath("//button[@class = 'pin-search-btn district-search']"));37 Search.click();38 Thread.sleep(2000);39// WebElement Eighteen = driver.findElement(By.xpath("//label[@class='form-check-label' and contains(text(),'Age 18+') ]"));40// Eighteen.click();41// Thread.sleep(2000);42 List<WebElement> row = driver.findElements(By.xpath(43 "/html/body/app-root/div/app-home/div[2]/div/appointment-table/div/div/div/div/div/div/div/div/div/div/div[2]/form/div/div/div[6]/div/div/div/div"));44 System.out.println("No of cols are : " + row.size());45 int rsize = row.size();46 List<WebElement> col = driver.findElements(By.xpath(47 "/html/body/app-root/div/app-home/div[2]/div/appointment-table/div/div/div/div/div/div/div/div/div/div/div[2]/form/div/div/div[6]/div/div/div/div[13]/div/div/div[2]/ul/li"));48 System.out.println("No of cols are : " + col.size());49 int csize = col.size();50 for (int i = 1; i < rsize - 1; i++) {...

Full Screen

Full Screen

pin

Using AI Code Generation

copy

Full Screen

1JavascriptExecutor js = (JavascriptExecutor) driver;2js.executeScript("arguments[0].setAttribute('style', 'border: 2px solid red;');", element);3js.executeScript("arguments[0].setAttribute('style', 'border: 2px solid green;');", element);4js.executeScript("arguments[0].setAttribute('style', 'border: 2px solid blue;');", element);5js.executeScript("arguments[0].setAttribute('style', 'border: 2px solid yellow;');", element);6js.executeScript("arguments[0].setAttribute('style', 'border: 2px solid orange;');", element);7js.executeScript("arguments[0].setAttribute('style', 'border: 2px solid black;');", element);8js.executeScript("arguments[0].setAttribute('style', 'border: 2px solid white;');", element);9js.executeScript("arguments[0].setAttribute('style', 'border: 2px solid purple;');", element);10js.executeScript("arguments[0].setAttribute('style', 'border: 2px solid pink;');", element);11js.executeScript("arguments[0].setAttribute('style', 'border: 2px solid brown;');", element);12js.executeScript("arguments[0].setAttribute('style', 'border: 2px solid grey;');", element);13js.executeScript("arguments[0].setAttribute('style', 'border: 2px solid yellowgreen;');", element);14js.executeScript("arguments[0].setAttribute('style', 'border: 2px solid darkblue;');", element);15js.executeScript("arguments[0].setAttribute('style', 'border: 2px solid darkgreen;');", element);16js.executeScript("arguments[0].setAttribute('style', 'border: 2px solid darkred;');", element);17js.executeScript("arguments[0].setAttribute('style', 'border: 2px solid darkmagenta;');", element);18js.executeScript("arguments[0].setAttribute('style', 'border: 2px solid darkorange;');", element);19js.executeScript("arguments[0].setAttribute('style', 'border: 2px solid darkslateblue;');", element);20js.executeScript("arguments[0].setAttribute('style', 'border: 2px solid darkslategray;');", element);

Full Screen

Full Screen

pin

Using AI Code Generation

copy

Full Screen

1JavascriptExecutor js = (JavascriptExecutor) driver;2js.executeScript("arguments[0].scrollIntoView();", element);3JavascriptExecutor js = (JavascriptExecutor) driver;4js.executeScript("window.scrollBy(0,500)");5JavascriptExecutor js = (JavascriptExecutor) driver;6js.executeScript("window.scrollBy(0,document.body.scrollHeight)");7JavascriptExecutor js = (JavascriptExecutor) driver;8js.executeScript("window.scrollTo(0,0)");9JavascriptExecutor js = (JavascriptExecutor) driver;10js.executeScript("window.scrollTo(0,document.body.scrollHeight)");11JavascriptExecutor js = (JavascriptExecutor) driver;12js.executeScript("window.scrollTo(0,document.body.scrollHeight)");13JavascriptExecutor js = (JavascriptExecutor) driver;14js.executeScript("window.scrollTo(0,document.body.scrollHeight)");15JavascriptExecutor js = (JavascriptExecutor) driver;16js.executeScript("window.scrollTo(0,document.body.scrollHeight)");17JavascriptExecutor js = (JavascriptExecutor) driver;18js.executeScript("window.scrollTo(0,document.body.scrollHeight)");19JavascriptExecutor js = (JavascriptExecutor) driver;20js.executeScript("window.scrollTo(0,document.body.scrollHeight)");21JavascriptExecutor js = (JavascriptExecutor) driver;22js.executeScript("window.scrollTo(0,document.body.scrollHeight)");23JavascriptExecutor js = (JavascriptExecutor) driver;24js.executeScript("window.scrollTo(0,document.body.scrollHeight)");25JavascriptExecutor js = (JavascriptExecutor) driver;26js.executeScript("window.scrollTo(0,document.body.scrollHeight)");

Full Screen

Full Screen

pin

Using AI Code Generation

copy

Full Screen

1JavascriptExecutor jse = (JavascriptExecutor) driver;2jse.executeScript("arguments[0].scrollIntoView(true);", element);3JavascriptExecutor jse = (JavascriptExecutor) driver;4jse.executeScript("window.scrollBy(0,250)", "");5JavascriptExecutor jse = (JavascriptExecutor) driver;6jse.executeScript("window.scrollBy(0,document.body.scrollHeight)", "");7JavascriptExecutor jse = (JavascriptExecutor) driver;8jse.executeScript("window.scrollBy(0,1000)", "");9JavascriptExecutor jse = (JavascriptExecutor) driver;10jse.executeScript("window.scrollBy(0,500)", "");11JavascriptExecutor jse = (JavascriptExecutor) driver;12jse.executeScript("window.scrollBy(0,1500)", "");13JavascriptExecutor jse = (JavascriptExecutor) driver;14jse.executeScript("window.scrollBy(0,2000)", "");15JavascriptExecutor jse = (JavascriptExecutor) driver;16jse.executeScript("window.scrollBy(0,3000)", "");17JavascriptExecutor jse = (JavascriptExecutor) driver;18jse.executeScript("window.scrollBy(0,4000)", "");19JavascriptExecutor jse = (JavascriptExecutor) driver;20jse.executeScript("window.scrollBy(0,5000)", "");21JavascriptExecutor jse = (JavascriptExecutor) driver;22jse.executeScript("window.scrollBy(0,6000)", "");23JavascriptExecutor jse = (JavascriptExecutor) driver;24jse.executeScript("window.scrollBy(0,7000)", "");

Full Screen

Full Screen

pin

Using AI Code Generation

copy

Full Screen

1JavascriptExecutor js = (JavascriptExecutor) driver;2js.executeScript("arguments[0].setAttribute('style', arguments[1]);", element, "color: red; border: 2px solid red;");3JavascriptExecutor js = (JavascriptExecutor) driver;4js.executeScript("arguments[0].setAttribute('style', arguments[1]);", element, "color: red; border: 2px solid red;");5JavascriptExecutor js = (JavascriptExecutor) driver;6js.executeScript("arguments[0].setAttribute('style', arguments[1]);", element, "color: red; border: 2px solid red;");7JavascriptExecutor js = (JavascriptExecutor) driver;8js.executeScript("arguments[0].setAttribute('style', arguments[1]);", element, "color: red; border: 2px solid red;");9JavascriptExecutor js = (JavascriptExecutor) driver;10js.executeScript("arguments[0].setAttribute('style', arguments[1]);", element, "color: red; border: 2px solid red;");11JavascriptExecutor js = (JavascriptExecutor) driver;12js.executeScript("arguments[0].setAttribute('style', arguments[1]);", element, "color: red; border: 2px solid red;");13JavascriptExecutor js = (JavascriptExecutor) driver;14js.executeScript("arguments[0].setAttribute('style', arguments[1]);", element, "color: red; border: 2px solid red;");15JavascriptExecutor js = (JavascriptExecutor) driver;16js.executeScript("arguments[0].setAttribute('style', arguments[1]);", element, "color: red; border: 2px solid red;");17JavascriptExecutor js = (JavascriptExecutor) driver;18js.executeScript("arguments[0].setAttribute('style', arguments[1]);

Full Screen

Full Screen

pin

Using AI Code Generation

copy

Full Screen

1JavascriptExecutor js = (JavascriptExecutor) driver;2js.executeScript("arguments[0].click();", element);3JavascriptExecutor js = (JavascriptExecutor) driver;4js.executeScript("window.scrollBy(0,2000)");5JavascriptExecutor js = (JavascriptExecutor) driver;6js.executeScript("window.scrollBy(0,document.body.scrollHeight)");7JavascriptExecutor js = (JavascriptExecutor) driver;8js.executeScript("arguments[0].setAttribute('style', 'background: yellow; border: 2px solid red;');", element);9JavascriptExecutor js = (JavascriptExecutor) driver;10js.executeScript("arguments[0].setAttribute('style', 'border: solid 2px white');", element);11JavascriptExecutor js = (JavascriptExecutor) driver;12js.executeScript("arguments[0].setAttribute('style', 'border: solid 2px white');", element);13JavascriptExecutor js = (JavascriptExecutor) driver;14js.executeScript("arguments[0].setAttribute('style', 'border: solid 2px white');", element);15JavascriptExecutor js = (JavascriptExecutor) driver;16js.executeScript("arguments[0].setAttribute('style', 'border: solid 2px white');", element);17JavascriptExecutor js = (JavascriptExecutor) driver;18js.executeScript("arguments[0].setAttribute('style', 'border: solid 2px white');", element);19JavascriptExecutor js = (JavascriptExecutor) driver;20js.executeScript("arguments[0].setAttribute('style', 'border: solid 2px white');", element);21JavascriptExecutor js = (JavascriptExecutor) driver;22js.executeScript("arguments[0].setAttribute('style', 'border:

Full Screen

Full Screen

pin

Using AI Code Generation

copy

Full Screen

1JavascriptExecutor js = (JavascriptExecutor) driver;2js.executeScript("window.scrollBy(0,2000)");3Actions action = new Actions(driver);4action.sendKeys(Keys.PAGE_DOWN).perform();5Actions action = new Actions(driver);6action.sendKeys(Keys.PAGE_UP).perform();7Actions action = new Actions(driver);8action.sendKeys(Keys.END).perform();9Actions action = new Actions(driver);10action.sendKeys(Keys.HOME).perform();11Actions action = new Actions(driver);12action.sendKeys(Keys.ARROW_DOWN).perform();13Actions action = new Actions(driver);14action.sendKeys(Keys.ARROW_UP).perform();15Actions action = new Actions(driver);16action.sendKeys(Keys.ARROW_RIGHT).perform();17Actions action = new Actions(driver);18action.sendKeys(Keys.ARROW_LEFT).perform();19Actions action = new Actions(driver);20action.sendKeys(Keys.ESCAPE).perform();21Actions action = new Actions(driver);22action.sendKeys(Keys.ENTER).perform();23Actions action = new Actions(driver);24action.sendKeys(Keys.CONTROL, Keys.SUBTRACT).perform();25Actions action = new Actions(driver);26action.sendKeys(Keys.CONTROL, Keys.ADD).perform();27Actions action = new Actions(driver);28action.sendKeys(Keys.CONTROL, Keys.NUMPAD0).perform();29Actions action = new Actions(driver);30action.sendKeys(Keys.CONTROL, Keys.NUMPAD1).perform();31Actions action = new Actions(driver);32action.sendKeys(Keys.CONTROL, Keys.NUMP

Full Screen

Full Screen

pin

Using AI Code Generation

copy

Full Screen

1JavascriptExecutor je = (JavascriptExecutor) driver;2je.executeScript("arguments[0].scrollIntoView(true);",element);3Actions actions = new Actions(driver);4actions.moveToElement(element);5actions.perform();6Point point = element.getLocation();7Robot robot = new Robot();8robot.mouseMove(point.getX(), point.getY());9JavascriptExecutor js = (JavascriptExecutor) driver;10js.executeScript("arguments[0].scrollIntoView();", element);11JavascriptExecutor js = (JavascriptExecutor) driver;12js.executeScript("arguments[0].scrollIntoView(true);", element);13JavascriptExecutor js = (JavascriptExecutor) driver;14js.executeScript("arguments[0].scrollIntoView(false);", element);15JavascriptExecutor js = (JavascriptExecutor) driver;16js.executeScript("window.scrollTo(0

Full Screen

Full Screen

pin

Using AI Code Generation

copy

Full Screen

1JavascriptExecutor js = (JavascriptExecutor) driver;2js.executeScript("mobile: pin", pin);3JavascriptExecutor js = (JavascriptExecutor) driver;4js.executeScript("mobile: unpin", unpin);5JavascriptExecutor js = (JavascriptExecutor) driver;6js.executeScript("mobile: resetApp", resetApp);7JavascriptExecutor js = (JavascriptExecutor) driver;8js.executeScript("mobile: isAppInstalled", isAppInstalled);9JavascriptExecutor js = (JavascriptExecutor) driver;10js.executeScript("mobile: installApp", installApp);11JavascriptExecutor js = (JavascriptExecutor) driver;12js.executeScript("mobile: removeApp", removeApp);13JavascriptExecutor js = (JavascriptExecutor) driver;14js.executeScript("mobile: launchApp", launchApp);15JavascriptExecutor js = (JavascriptExecutor) driver;16js.executeScript("mobile: closeApp", closeApp);17JavascriptExecutor js = (JavascriptExecutor) driver;18js.executeScript("mobile: runAppInBackground", runAppInBackground);

Full Screen

Full Screen

Selenium 4 Tutorial:

LambdaTest’s Selenium 4 tutorial is covering every aspects of Selenium 4 testing with examples and best practices. Here you will learn basics, such as how to upgrade from Selenium 3 to Selenium 4, to some advanced concepts, such as Relative locators and Selenium Grid 4 for Distributed testing. Also will learn new features of Selenium 4, such as capturing screenshots of specific elements, opening a new tab or window on the browser, and new protocol adoptions.

Chapters:

  1. Upgrading From Selenium 3 To Selenium 4?: In this chapter, learn in detail how to update Selenium 3 to Selenium 4 for Java binding. Also, learn how to upgrade while using different build tools such as Maven or Gradle and get comprehensive guidance for upgrading Selenium.

  2. What’s New In Selenium 4 & What’s Being Deprecated? : Get all information about new implementations in Selenium 4, such as W3S protocol adaption, Optimized Selenium Grid, and Enhanced Selenium IDE. Also, learn what is deprecated for Selenium 4, such as DesiredCapabilites and FindsBy methods, etc.

  3. Selenium 4 With Python: Selenium supports all major languages, such as Python, C#, Ruby, and JavaScript. In this chapter, learn how to install Selenium 4 for Python and the features of Python in Selenium 4, such as Relative locators, Browser manipulation, and Chrom DevTool protocol.

  4. Selenium 4 Is Now W3C Compliant: JSON Wireframe protocol is retiring from Selenium 4, and they are adopting W3C protocol to learn in detail about the advantages and impact of these changes.

  5. How To Use Selenium 4 Relative Locator? : Selenium 4 came with new features such as Relative Locators that allow constructing locators with reference and easily located constructors nearby. Get to know its different use cases with examples.

  6. Selenium Grid 4 Tutorial For Distributed Testing: Selenium Grid 4 allows you to perform tests over different browsers, OS, and device combinations. It also enables parallel execution browser testing, reads up on various features of Selenium Grid 4 and how to download it, and runs a test on Selenium Grid 4 with best practices.

  7. Selenium Video Tutorials: Binge on video tutorials on Selenium by industry experts to get step-by-step direction from automating basic to complex test scenarios with Selenium.

Selenium 101 certifications:

LambdaTest also provides certification for Selenium testing to accelerate your career in Selenium automation testing.

Run Selenium automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in Interface-JavascriptExecutor

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful