Example usage for org.openqa.selenium.interactions Action perform

List of usage examples for org.openqa.selenium.interactions Action perform

Introduction

In this page you can find the example usage for org.openqa.selenium.interactions Action perform.

Prototype

void perform();

Source Link

Usage

From source file:Scenarios.AutoPay.Enroll_autopay_leasing_Individual_Creditcard_with_insurance_without_tax.java

@Test(dataProvider = "getLoginData")
public void Enroll_autopay_leasing_Individual_Creditcard_with_ins_without_tax(
        Hashtable<String, String> tabledata) throws InterruptedException {

    if (!(tabledata.get("Runmode").equals("Y") && tabledata.get("AutoPay").equals("Y"))) {
        resultFlag = "skip";
        logger.log(LogStatus.SKIP,//w  w w  .  j  a  v  a  2 s .co  m
                "Enroll_autopay_leasing_Individual_Creditcard_with_insurance_without_tax is Skipped");
        throw new SkipException("Skipping the test");
    }

    try {

        //Login to the application as PM 
        logger = extent.startTest("Enroll_autopay_leasing_Individual_Creditcard_with_insurance_without_tax",
                "Enroll Into Autopay Thru Leasing _Individual_WithInsurance_WithoutTax_Check");

        testcaseName = tabledata.get("TestCases");
        Reporter.log("Test case started: " + testcaseName, true);

        LoginPage login = new LoginPage(driver);
        login.login(tabledata.get("UserName"), tabledata.get("Password"));
        logger.log(LogStatus.INFO, "PM Logged in successfully");

        Generic_Class generics = new Generic_Class();
        driver.manage().timeouts().implicitlyWait(6000, TimeUnit.SECONDS);
        JavascriptExecutor jse = (JavascriptExecutor) driver;

        //connecting to customer device
        Dashboard_BifrostHostPopUp Bifrostpop = new Dashboard_BifrostHostPopUp(driver);
        Reporter.log("object created successfully", true);
        String biforstNum = Bifrostpop.getBiforstNo();

        Reporter.log(biforstNum + "", true);
        Thread.sleep(8000);

        Robot robot = new Robot();
        robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_T);
        robot.keyRelease(KeyEvent.VK_CONTROL);
        robot.keyRelease(KeyEvent.VK_T);
        Thread.sleep(6000);
        ArrayList<String> tabs = new ArrayList<String>(driver.getWindowHandles());
        driver.switchTo().window(tabs.get(1));
        Thread.sleep(5000);
        driver.get(generics.getPropertyValue("CustomerScreenPath_QA"));

        List<WebElement> biforstSystem = driver.findElements(
                By.xpath("//div[@class='scrollable-area']//span[@class='bifrost-label vertical-center']"));
        for (WebElement ele : biforstSystem) {
            if (biforstNum.equalsIgnoreCase(ele.getText().trim())) {
                Reporter.log(ele.getText() + "", true);
                ele.click();
                break;
            }
        }

        //driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL,Keys.PAGE_DOWN);
        robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_PAGE_DOWN);
        robot.keyRelease(KeyEvent.VK_CONTROL);
        robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
        Thread.sleep(5000);
        driver.switchTo().window(tabs.get(0));

        Thread.sleep(5000);
        driver.findElement(By.xpath(
                "//div[@id='cfsConnectionDialog']//div[@class='after-connected padding-top']//p/input[@class='psbutton-low-priority']"))
                .click();
        Thread.sleep(5000);
        logger.log(LogStatus.INFO, "clicked on continue successfully");

        // Login into PM dashboard 
        PM_Homepage pm_home = new PM_Homepage(driver);
        logger.log(LogStatus.INFO, "PM Home page object created successfully");

        String scpath = Generic_Class.takeScreenShotPath();
        String image = logger.addScreenCapture(scpath);
        logger.log(LogStatus.PASS, "Navigate to PM dashboard");
        logger.log(LogStatus.INFO, "Image", image);

        Thread.sleep(8000);
        pm_home.clk_findAndLeaseSpace();
        logger.log(LogStatus.PASS, "Clicked on Find And Lease A Space");

        StandardStoragePage StandardStoragePage = new StandardStoragePage(driver);
        Thread.sleep(8000);
        //StandardStoragePage.Clk_ChkBx_AvlSpace();

        List<WebElement> avaSpaecs = driver.findElements(By.xpath(
                "//div[@id='select-space-size']//span[@class='leftalignedinlineblockspan dimensions']/../../preceding-sibling::span"));

        for (WebElement space : avaSpaecs) {
            space.click();
        }

        logger.log(LogStatus.PASS, "Clicked available space in StandardStorage");
        scpath = Generic_Class.takeScreenShotPath();
        image = logger.addScreenCapture(scpath);
        logger.log(LogStatus.PASS, "Selected available spaces");
        logger.log(LogStatus.INFO, "Image", image);

        Thread.sleep(4000);
        StandardStoragePage.click_Search();
        logger.log(LogStatus.PASS, "Clicked on Search button");
        Reporter.log("Clicked on Search button", true);

        //selecting one space from grid
        SpaceDashboard_ThisLoc thisSpace = new SpaceDashboard_ThisLoc(driver);
        Thread.sleep(8000);
        //      space.select_GivenSpace(tabledata.get("SpaceNumber"));
        //      logger.log(LogStatus.PASS,"Clicked on radio button-to select one space");
        //      Reporter.log("Clicked on radio button-to select one space",true);

        //============Fetching space number and based on that clicking the radio button========================
        List<WebElement> norows = driver
                .findElements(By.xpath("//div[@class='k-grid-content ps-container']//table//tbody//tr"));
        String avlSpace = null;
        if (norows.size() > 0) {
            Thread.sleep(5000);

            avlSpace = driver
                    .findElement(By.xpath(
                            "//div[@id='onsiteUnitGrid']//table/tbody/tr[1]//td[@class='grid-cell-space']"))
                    .getText();
            Reporter.log("space number is:" + avlSpace, true);
        } else {

            logger.log(LogStatus.INFO, "Application is not populating any data/space details");

        }

        WebElement RdBtn_Space = driver
                .findElement(By.xpath("//div[@id='onsiteUnitGrid']//table//tbody//tr//td[text()='" + avlSpace
                        + "']/preceding-sibling::td//input"));

        jse.executeScript("arguments[0].scrollIntoView()", RdBtn_Space);
        jse.executeScript("arguments[0].click();", RdBtn_Space);

        logger.log(LogStatus.PASS, "Clicked on radio button based on the space no: " + avlSpace);
        Reporter.log("Clicked on radio button  based on the space no: " + avlSpace, true);

        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");

        logger.log(LogStatus.PASS,
                "check the radio button based on the space and click on the  reservation button");
        scpath = Generic_Class.takeScreenShotPath();
        image = logger.addScreenCapture(scpath);
        logger.log(LogStatus.PASS,
                "check the radio button based on the space and click on the  reservation button");
        logger.log(LogStatus.INFO,
                "check the radio button based on the space and click on the  reservation button", image);

        Thread.sleep(5000);
        thisSpace.click_Rent();
        logger.log(LogStatus.PASS, "Clicked on Rent button");
        Reporter.log("Clicked on Rent button", true);

        Leasing_ConfirmSpace confirmSpace = new Leasing_ConfirmSpace(driver);
        Thread.sleep(8000);
        /*if(!driver.findElement(By.xpath("//div[@id='cfsConnectionDialog']//div[@class='after-connected padding-top']//p/input[@class='psbutton-low-priority']")).isDisplayed()){
                
           logger.log(LogStatus.INFO, "Bifrost Connection Continue button not displayed");
        }else{
           driver.findElement(By.xpath("//div[@id='cfsConnectionDialog']//div[@class='after-connected padding-top']//p/input[@class='psbutton-low-priority']")).click();
                
           logger.log(LogStatus.INFO, "Clicked on Bifrost Connection Continue button");
        }
         */
        confirmSpace.clk_ConfirmwtCust();
        Thread.sleep(6000);
        logger.log(LogStatus.PASS, "Clicked on Confirm with Customer button");
        Reporter.log("Clicked on Confirm with Customer button", true);

        //driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL,Keys.PAGE_DOWN);
        robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_PAGE_DOWN);
        robot.keyRelease(KeyEvent.VK_CONTROL);
        robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
        Thread.sleep(5000);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.PASS, "Switched to Customer Screen");

        //Validating CFS
        scpath = Generic_Class.takeScreenShotPath();
        image = logger.addScreenCapture(scpath);
        logger.log(LogStatus.PASS, "Validating CFS Screen and confirming with Customer");
        logger.log(LogStatus.PASS, "Validating CFS Screen and confirming with Customer " + image);

        Thread.sleep(8000);
        driver.findElement(
                By.xpath("//div[@class='footer-row clearfix-container']/button[@id='confirmButton']")).click();
        logger.log(LogStatus.PASS, "Clicked on Confirm button in customer screen");
        Reporter.log("Clicked on Confirm button in customer screen", true);

        Thread.sleep(8000);
        //driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL,Keys.PAGE_DOWN);
        robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_PAGE_DOWN);
        robot.keyRelease(KeyEvent.VK_CONTROL);
        robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
        driver.switchTo().window(tabs.get(0));
        logger.log(LogStatus.PASS, "Switching back to PM screen");
        Reporter.log("Switching back to PM screen", true);

        //Filling contact information

        Leasing_ContactInfoPage contactinfo = new Leasing_ContactInfoPage(driver);
        Thread.sleep(5000);
        String FN = "AUT" + generics.get_RandmString();
        //contactinfo.txt_Fname(tabledata.get("Firstname"));
        contactinfo.txt_Fname(FN);
        contactinfo.txt_Lname(tabledata.get("LastName"));
        contactinfo.clickContact_State();
        List<WebElement> allstates = driver.findElements(
                By.xpath("//ul[@id='ContactForm_Identification_StateTypeID_listbox']/li[@class='k-item']"));

        //Identify the WebElement which will appear after scrolling down

        for (WebElement state : allstates) {
            Thread.sleep(2000);
            if (tabledata.get("StateCode").equalsIgnoreCase(state.getText())) {
                state.click();
                logger.log(LogStatus.INFO, "Click on State successfully");
                break;
            }
        }

        //contactinfo.select_State(tabledata.get("StateCode"));
        contactinfo.txt_Number(tabledata.get("DrivingLicenseNum"));
        contactinfo.txt_street1(tabledata.get("Street"));
        contactinfo.txt_city(tabledata.get("City"));

        contactinfo.select_State2address();
        List<WebElement> allstatesadd = driver
                .findElements(By.xpath("//ul[@id='lesseeinfo-address-statecode_listbox']/li[@class='k-item']"));

        for (WebElement state : allstatesadd) {
            Thread.sleep(2000);
            if (tabledata.get("StateCode").equalsIgnoreCase(state.getText())) {
                state.click();
                break;
            }
        }

        //contactinfo.select_State2(tabledata.get("State"));
        Thread.sleep(3000);
        contactinfo.txt_Zipcode(tabledata.get("Zipcode"));
        contactinfo.select_phoneType1();
        Thread.sleep(3000);
        /*List<WebElement> phonTypes1= driver.findElements(By.xpath("//ul[@id='ContactForm_LesseePhones[_-index-__0]_Phone_PhoneTypeID_listbox')]//li[@class='k-item']"));  //div[@id='ContactForm_LesseePhones[_-index-__0]_Phone_PhoneTypeID-list']
        System.out.println(phonTypes1.size());
        for(WebElement type: phonTypes1)
        {
           System.out.println(type.getText());
           System.out.println(tabledata.get("PhoneType"));
           Thread.sleep(3000);
           if(tabledata.get("PhoneType").contains(type.getText().trim()))
           {
              type.click();
              break;
           }
        }*/
        driver.findElement(
                By.xpath("//ul[@class='k-list k-reset ps-container ps-active-y']/li[contains(text(), '"
                        + tabledata.get("PhoneType") + " ')]"))
                .click();
        Thread.sleep(2000);
        contactinfo.txt_AreaCode(tabledata.get("Areacode"));
        Thread.sleep(2000);
        contactinfo.txt_Exchg(tabledata.get("Exchange"));
        Thread.sleep(2000);
        contactinfo.txt_lineNumber(tabledata.get("LineNumber"));
        Thread.sleep(2000);
        contactinfo.txt_email(tabledata.get("Email"));
        Thread.sleep(3000);
        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");
        contactinfo.click_CustLookUp();
        logger.log(LogStatus.INFO, "Clicked on Customer Lookup successfully");

        Thread.sleep(15000);
        // Click on New Customer button on Choose an Account PopUp
        driver.findElement(By.linkText("Create New Customer")).click();

        // Select "Yes" Radio button for Military
        Thread.sleep(8000);
        driver.findElement(By.xpath("//label[@id='currently-military-false']/span[1]")).click();

        // Click on Verify button
        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");
        Thread.sleep(6000);
        driver.findElement(By.partialLinkText("Verify")).click();
        logger.log(LogStatus.INFO, "Clicked on Verify button successfully");

        Thread.sleep(8000);
        //if(contactinfo.verify_overrideAddress_Select())
        /*if(driver.findElements(By.xpath("//div[@id='lesseeAddressInput']/div[@class='verificationElement verification-failed margin']//a[contains(text(),'Select')]")).size()!=0)
        {
           contactinfo.click_overrideAddress_Select();
        }*/
        //if(contactinfo.verify_overridePhone_Select())
        /*if(driver.findElements(By.xpath("//ul[@id='phoneList']//div[@class='verificationElement verification-failed margin']//a[contains(text(),'Select')]")).size()!=0)
        {
           contactinfo.click_overridePhone_Select();
        }
         */
        Thread.sleep(5000);
        scpath = Generic_Class.takeScreenShotPath();
        image = logger.addScreenCapture(scpath);
        logger.log(LogStatus.PASS, "Entered the contact info details in Contact Info page");
        logger.log(LogStatus.INFO, "Entered the contact info details in Contact Info page", image);

        driver.findElement(By.id("confirmWithCustomerButton")).click();

        Thread.sleep(5000);
        //Click on Confirm with Cust button

        logger.log(LogStatus.INFO, "clicking on Confirm with cust button successfully");

        // Navigating to Customer screen
        //driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL,Keys.PAGE_DOWN);
        robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_PAGE_DOWN);
        robot.keyRelease(KeyEvent.VK_CONTROL);
        robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
        Thread.sleep(8000);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully");
        scpath = Generic_Class.takeScreenShotPath();
        image = logger.addScreenCapture(scpath);
        logger.log(LogStatus.PASS, "Validating CFS Screen and confirming with Customer");
        logger.log(LogStatus.PASS, "Validating CFS Screen and confirming with Customer " + image);

        Thread.sleep(6000);
        driver.findElement(By.id("confirmButton")).click();
        logger.log(LogStatus.INFO, "clicking on Confirm button successfully");

        Thread.sleep(5000);
        //driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL,Keys.PAGE_DOWN);
        robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_PAGE_DOWN);
        robot.keyRelease(KeyEvent.VK_CONTROL);
        robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
        driver.switchTo().window(tabs.get(0));
        logger.log(LogStatus.INFO, "Switch to Main page successfully");

        //      driver.findElement(By.id("EmergencyContactForm_EmergencyContacts_0__FirstName")).sendKeys("Ravi");
        //      driver.findElement(By.id("EmergencyContactForm_EmergencyContacts_0__LastName")).sendKeys("M");
        //      driver.findElement(By.xpath("//div[@class='floatleft']/span[@class='k-widget k-dropdown k-header contact-relationship-type']")).click();

        //Entering Emergency Contact details
        Thread.sleep(5000);
        Leasing_EmergencyConatctsPage emergCon = new Leasing_EmergencyConatctsPage(driver);
        logger.log(LogStatus.INFO, "Navigated to Emergency Contact Page");
        emergCon.enterEmergencyFN("Test");
        Thread.sleep(2000);
        emergCon.enterEmergencyLN("G");
        Thread.sleep(2000);
        emergCon.clickRelationship_dropdown();
        //Selecting Relation ship type
        Thread.sleep(5000);
        List<WebElement> allRelations = driver
                .findElements(By.xpath("//ul[starts-with(@id,'relationshipType')]//li[@class='k-item']"));

        for (WebElement relation : allRelations) {
            Thread.sleep(2000);
            if (tabledata.get("Relation").equalsIgnoreCase(relation.getText())) {
                relation.click();
                logger.log(LogStatus.INFO, "Selected relation value from dropdown successfully");

                break;
            }
        }
        Thread.sleep(3000);
        emergCon.txt_street1(tabledata.get("Street"));
        Thread.sleep(3000);
        emergCon.txt_city(tabledata.get("City"));
        Thread.sleep(2000);
        emergCon.clickStateList();
        Thread.sleep(5000);
        List<WebElement> allstates1 = driver.findElements(By.xpath(
                "//ul[@id='EmergencyContactForm_EmergencyContacts_0__Address_StateCode_listbox']//li[@class='k-item']"));

        for (WebElement state : allstates1) {
            Thread.sleep(2000);
            if (tabledata.get("StateCode").equalsIgnoreCase(state.getText())) {
                state.click();
                break;
            }
        }

        Thread.sleep(5000);
        emergCon.enterZipCode(tabledata.get("Zipcode"));
        emergCon.clickPhoneType();

        Thread.sleep(5000);
        /*List<WebElement> phonTypes= driver.findElements(By.xpath("//ul[@id='EmergencyContactForm_EmergencyContacts_0__Address_StateCode_listbox')]//li[@class='k-item']"));
                
        for(WebElement type: phonTypes)
        {
           Thread.sleep(2000);
           if(tabledata.get("PhoneType").contains(type.getText()))
           {
              type.click();
              break;
           }
        }*/

        driver.findElement(
                By.xpath("//ul[@class='k-list k-reset ps-container ps-active-y']/li[contains(text(), '"
                        + tabledata.get("PhoneType") + " ')]"))
                .click();
        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");
        Thread.sleep(5000);

        emergCon.txt_AreaCode(tabledata.get("Areacode"));
        emergCon.txt_Exchg(tabledata.get("Exchange"));
        emergCon.txt_lineNumber(tabledata.get("LineNumber"));
        emergCon.txt_email(tabledata.get("Email"));
        emergCon.clickAuthorizedfor_radio();

        Thread.sleep(6000);
        if (emergCon.verifyCustVerify_btn()) {
            emergCon.clickVerify_btn();
            logger.log(LogStatus.INFO, "Clicked on Verify button successfully");

        }
        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");
        Thread.sleep(8000);
        if (driver.findElements(By.xpath(
                "//div[starts-with(@id,'address')]//div[@class='verificationElement verification-failed margin']//div/a[contains(text(),'Select')]"))
                .size() != 0) {

            emergCon.click_overrideAddress_Select();
            logger.log(LogStatus.INFO, "Clicking on Override Address Select button successfully");
        }

        /*if(driver.findElements(By.xpath("//div[starts-with(@id,'phone')]//div[@class='verificationElement verification-failed margin']//div/a[contains(text(),'Select')]")).size()!=0){
                
           emergCon.click_overrideAddress_Select();
           logger.log(LogStatus.INFO, "Clicking on Override Address Select button successfully");
        }
         */
        Thread.sleep(5000);
        scpath = Generic_Class.takeScreenShotPath();
        image = logger.addScreenCapture(scpath);
        logger.log(LogStatus.PASS, "Entered the emergency info details in Emergency Info page");
        logger.log(LogStatus.INFO, "Entered the emergency info details in Emergency Info page", image);

        emergCon.clickconfirmWithCust();
        logger.log(LogStatus.INFO, "Clicking on Confirm with Customer Button");
        //         
        //         Thread.sleep(8000);
        //         if(driver.findElement(By.xpath("//div[@class='verificationElement verification-changed margin']//a[contains(text(),'Use Selected Address')]")).isDisplayed())
        //         {
        //            driver.findElement(By.xpath("//div[@class='verificationElement verification-changed margin']//a[contains(text(),'Use Selected Address')]")).click();
        //         }
        //
        //         emergCon.clickconfirmWithCust();

        //driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL,Keys.PAGE_DOWN);
        robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_PAGE_DOWN);
        robot.keyRelease(KeyEvent.VK_CONTROL);
        robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
        Thread.sleep(8000);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully");

        scpath = Generic_Class.takeScreenShotPath();
        image = logger.addScreenCapture(scpath);
        logger.log(LogStatus.PASS, "Validating CFS Screen and confirming with Customer");
        logger.log(LogStatus.PASS, "Validating CFS Screen and confirming with Customer " + image);
        Thread.sleep(6000);
        driver.findElement(By.id("confirmButton")).click();
        Thread.sleep(6000);
        logger.log(LogStatus.INFO, "clicking on Confirm button successfully");
        //driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL,Keys.PAGE_DOWN);
        Thread.sleep(8000);
        driver.switchTo().window(tabs.get(0));
        robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_PAGE_DOWN);
        robot.keyRelease(KeyEvent.VK_CONTROL);
        robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
        logger.log(LogStatus.INFO, "Switch to Main page successfully");

        Leasing_AuthorizedAccessContactsPage autContact = new Leasing_AuthorizedAccessContactsPage(driver);

        Thread.sleep(8000);
        /*
        if(driver.findElements(By.xpath("//div[@id='cfsConnectionDialog']//div[@class='after-connected padding-top']//p/input[@class='psbutton-low-priority']")).size()!=0){
                
           driver.findElement(By.xpath("//div[@id='cfsConnectionDialog']//div[@class='after-connected padding-top']//p/input[@class='psbutton-low-priority']")).click();
           logger.log(LogStatus.INFO, "Clicked on Bifrost Connection Continue button");
        }else{
           logger.log(LogStatus.INFO, "Bifrost Connection Continue button not displayed");
        }*/

        /*robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_PAGE_DOWN);
        robot.keyRelease(KeyEvent.VK_CONTROL);
        robot.keyRelease(KeyEvent.VK_PAGE_DOWN); 
        Thread.sleep(8000);
        driver.switchTo().window(tabs.get(1));
        Thread.sleep(5000);
                
                
        robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_PAGE_DOWN);
        robot.keyRelease(KeyEvent.VK_CONTROL);
        robot.keyRelease(KeyEvent.VK_PAGE_DOWN); 
        Thread.sleep(8000);
        driver.switchTo().window(tabs.get(0));
         */
        //if(autContact.verifySaveProceed_btn())
        /*if(driver.findElements(By.xpath("//span[@id='customerSaveButton']")).size()!=0)
        {   
           Thread.sleep(6000);
           autContact.enterFirstName("Rudra");
                
           Thread.sleep(6000);
           autContact.enterLastName("G");
                
           Thread.sleep(6000);
           autContact.clickPhonelist();
                
           Thread.sleep(6000);
           autContact.enterAreacode("415");
                
                
           Thread.sleep(6000);
           autContact.enterExchange("972");
                
                
           Thread.sleep(6000);
           autContact.enterLineNum("6400");
                
                
           Thread.sleep(6000);
           autContact.clickSavenProceed();
                
        }
                
        else{*/
        autContact.clickConfirmCust();
        //}
        //driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL,Keys.PAGE_DOWN);
        robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_PAGE_DOWN);
        robot.keyRelease(KeyEvent.VK_CONTROL);
        robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
        Thread.sleep(8000);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully");

        scpath = Generic_Class.takeScreenShotPath();
        image = logger.addScreenCapture(scpath);
        logger.log(LogStatus.PASS, "Validating CFS Screen and confirming with Customer");
        logger.log(LogStatus.PASS, "Validating CFS Screen and confirming with Customer " + image);

        Thread.sleep(6000);
        driver.findElement(By.id("confirmButton")).click();
        logger.log(LogStatus.INFO, "clicking on Confirm button successfully");

        Thread.sleep(8000);
        //driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL,Keys.PAGE_DOWN);
        robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_PAGE_DOWN);
        robot.keyRelease(KeyEvent.VK_CONTROL);
        robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
        driver.switchTo().window(tabs.get(0));
        logger.log(LogStatus.INFO, "Switch to Main page successfully");

        Thread.sleep(8000);
        Leasing_EligiblePromotionsPage eligpromo = new Leasing_EligiblePromotionsPage(driver);

        scpath = Generic_Class.takeScreenShotPath();
        image = logger.addScreenCapture(scpath);
        logger.log(LogStatus.PASS, "Validating Monthly rent and Promotions in Eligible Promotion Page");
        logger.log(LogStatus.PASS, "Validating Monthly rent and Promotions in Eligible Promotion Page", image);
        Thread.sleep(8000);
        eligpromo.clickSavenProceed();

        Thread.sleep(8000);
        Leasing_LeaseQuestionairePage leaseQues = new Leasing_LeaseQuestionairePage(driver);

        leaseQues.clickStorageContent();

        Thread.sleep(5000);

        List<WebElement> allstorage = driver.findElements(By.xpath(
                "//ul[@id='LeaseQuestionnaireUnits_0__RentalUnitContentsTypeID_listbox']//li[@class='k-item']"));

        for (WebElement storage : allstorage) {
            if (tabledata.get("StorageContent").equalsIgnoreCase(storage.getText())) {
                storage.click();
                break;
            }
        }

        //Insurance is ON

        Thread.sleep(5000);
        leaseQues.clickAddInsuranceYes();

        Thread.sleep(8000);
        leaseQues.clickCoverageList();

        List<WebElement> allcoverage = driver.findElements(By.xpath(
                "//div[@id='LeaseQuestionnaireUnits_0__InsuranceSelection-list']//ul[@id='LeaseQuestionnaireUnits_0__InsuranceSelection_listbox']//li[@class='k-item']"));

        /*for(WebElement coverage: allcoverage)
        {
           if(tabledata.get("InsuranceCoverage").equalsIgnoreCase(coverage.getText()))
           {
              System.out.println(coverage.getText());
              coverage.click();
              break;
           }
        }*/

        for (WebElement coverage : allcoverage) {
            Thread.sleep(5000);
            coverage.click();
            logger.log(LogStatus.INFO, "Selected value from Insurance dropdown");

            break;
        }
        Thread.sleep(8000);
        if (driver.findElements(By.xpath(
                "//form[@id='addendumsForm']//div[@class='padding lease-access-keypad-zone']//span[@class='k-widget k-dropdown k-header access-zone']"))
                .size() != 0) {

            leaseQues.clickAccessZone();

            Thread.sleep(8000);

            List<WebElement> allAccessZone = driver.findElements(By.xpath(
                    "//div[@id='LeaseQuestionnaireUnits_0__GateControllerTimeZoneID-list']//ul[@id='LeaseQuestionnaireUnits_0__GateControllerTimeZoneID_listbox']//li[@class='k-item']"));

            for (WebElement accessZone : allAccessZone) {
                Thread.sleep(5000);
                accessZone.click();
                break;
            }

        }
        Thread.sleep(8000);
        if (driver.findElements(By.xpath(
                "//form[@id='addendumsForm']//div[@class='padding lease-access-keypad-zone']//span[@class='k-widget k-dropdown k-header keypad-zone']"))
                .size() != 0) {
            leaseQues.clickKeypadZone();
            Thread.sleep(8000);
            List<WebElement> allKaypadZone = driver.findElements(By.xpath(
                    "//div[@id='LeaseQuestionnaireUnits_0__KeypadZone-list']//ul[@id='LeaseQuestionnaireUnits_0__KeypadZone_listbox']//li[@class='k-item']"));

            for (WebElement keypadZone : allKaypadZone) {
                Thread.sleep(5000);
                keypadZone.click();
                break;
            }
        }
        Thread.sleep(8000);
        scpath = Generic_Class.takeScreenShotPath();
        image = logger.addScreenCapture(scpath);
        logger.log(LogStatus.PASS, "Selected Insurance and gate access code");
        logger.log(LogStatus.INFO, "Selected Insurance and gate access code", image);

        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");
        Thread.sleep(5000);

        if (leaseQues.verifySaveAndProceedBtn()) {

            leaseQues.clickSaveAndProceedBtn();
            Thread.sleep(5000);
        } else {

            leaseQues.clickConfirmCust();
        }
        Thread.sleep(5000);
        //driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL,Keys.PAGE_DOWN);
        robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_PAGE_DOWN);
        robot.keyRelease(KeyEvent.VK_CONTROL);
        robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
        Thread.sleep(8000);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully");

        scpath = Generic_Class.takeScreenShotPath();
        image = logger.addScreenCapture(scpath);
        logger.log(LogStatus.PASS, "Validating CFS Screen and confirming with Customer");
        logger.log(LogStatus.PASS, "Validating CFS Screen and confirming with Customer " + image);

        Thread.sleep(6000);
        driver.findElement(By.id("confirmButton")).click();
        logger.log(LogStatus.INFO, "clicking on Confirm button successfully");

        Thread.sleep(10000);

        List<WebElement> allCheckbox = driver.findElements(
                By.xpath("//section[@class='term-group term-group--active']//input[@type='checkbox']"));

        for (WebElement checkbox : allCheckbox) {
            checkbox.click();
        }
        Thread.sleep(5000);
        driver.findElement(By.id("confirmButton")).click();

        Thread.sleep(8000);
        /*         List<WebElement> allCheckbox1=driver.findElements(By.xpath("//section[@class='term-group term-group--active']//input[@type='checkbox']"));
                
        for(WebElement checkbox:allCheckbox1)
        {
           checkbox.click();
        }
        Thread.sleep(5000);
        driver.findElement(By.id("confirmButton")).click();
                
        Thread.sleep(8000);
        List<WebElement> allCheckbox2=driver.findElements(By.xpath("//section[@class='term-group term-group--active']//input[@type='checkbox']"));
                
        for(WebElement checkbox:allCheckbox2)
        {
           checkbox.click();
        }
        Thread.sleep(5000);
        driver.findElement(By.id("confirmButton")).click();
                
        Thread.sleep(8000);
        List<WebElement> allCheckbox3=driver.findElements(By.xpath("//section[@class='term-group term-group--active']//input[@type='checkbox']"));
                
        for(WebElement checkbox:allCheckbox3)
        {
           checkbox.click();
        }
        Thread.sleep(5000);
        driver.findElement(By.id("confirmButton")).click();
                
                
        Thread.sleep(8000);
        List<WebElement> allCheckbox4=driver.findElements(By.xpath("//section[@class='term-group term-group--active']//input[@type='checkbox']"));
                
        for(WebElement checkbox:allCheckbox4)
        {
           checkbox.click();
        }
        Thread.sleep(5000);
        driver.findElement(By.id("confirmButton")).click();
                
        Thread.sleep(5000);
        driver.findElement(By.id("confirmButton")).click();*/

        /*         WebElement signature = driver.findElement(By.xpath("//div[@class='sig sigWrapper']/canvas[@class='pad js-signature-canvas']"));
        Actions actionBuilder = new Actions(driver);          
        Action drawAction = actionBuilder.moveToElement(signature,660,96).click().clickAndHold(signature)
              .moveByOffset(120, 120).moveByOffset(60,70).moveByOffset(-140,-140).release(signature).build();
        drawAction.perform();
                
        Thread.sleep(5000);
        driver.findElement(By.id("confirmButton")).click();
        Thread.sleep(5000);
        //driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL,Keys.PAGE_DOWN);
        robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_PAGE_DOWN);
        robot.keyRelease(KeyEvent.VK_CONTROL);
        robot.keyRelease(KeyEvent.VK_PAGE_DOWN); 
        Thread.sleep(6000);
        driver.switchTo().window(tabs.get(0));*/

        Leasing_ReviewNApprovePage review = new Leasing_ReviewNApprovePage(driver);

        Thread.sleep(8000);
        //review.clickApprove_btn();

        Thread.sleep(8000);
        /*   robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_PAGE_DOWN);
        robot.keyRelease(KeyEvent.VK_CONTROL);
        robot.keyRelease(KeyEvent.VK_PAGE_DOWN); 
        Thread.sleep(6000);
        driver.switchTo().window(tabs.get(1));*/

        List<WebElement> allCheckbox1 = driver.findElements(
                By.xpath("//section[@class='term-group term-group--active']//input[@type='checkbox']"));

        for (WebElement checkbox : allCheckbox1) {
            checkbox.click();
        }
        Thread.sleep(5000);

        scpath = Generic_Class.takeScreenShotPath();
        image = logger.addScreenCapture(scpath);
        logger.log(LogStatus.PASS, "Validating CFS Screen and confirming with Customer");
        logger.log(LogStatus.PASS, "Validating CFS Screen and confirming with Customer " + image);

        driver.findElement(By.id("confirmButton")).click();
        Thread.sleep(5000);
        WebElement signature1 = driver.findElement(
                By.xpath("//div[@class='sig sigWrapper']/canvas[@class='pad js-signature-canvas']"));
        Actions actionBuilder1 = new Actions(driver);
        Action drawAction1 = actionBuilder1.moveToElement(signature1, 660, 96).click().clickAndHold(signature1)
                .moveByOffset(120, 120).moveByOffset(60, 70).moveByOffset(-140, -140).release(signature1)
                .build();
        drawAction1.perform();

        Thread.sleep(5000);
        driver.findElement(By.id("confirmButton")).click();
        Thread.sleep(5000);
        //driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL,Keys.PAGE_DOWN);
        robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_PAGE_DOWN);
        robot.keyRelease(KeyEvent.VK_CONTROL);
        robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
        Thread.sleep(6000);
        driver.switchTo().window(tabs.get(0));
        Thread.sleep(6000);
        review.clickApprove_btn();
        //review.clickInsuranceApprove_Btn();
        Thread.sleep(3000);

        // Doing page refresh
        /*robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_PAGE_DOWN);
        robot.keyRelease(KeyEvent.VK_CONTROL);
        robot.keyRelease(KeyEvent.VK_PAGE_DOWN); 
        Thread.sleep(8000);
        driver.switchTo().window(tabs.get(1));
        Thread.sleep(5000);
                
                
        robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_PAGE_DOWN);
        robot.keyRelease(KeyEvent.VK_CONTROL);
        robot.keyRelease(KeyEvent.VK_PAGE_DOWN); 
        Thread.sleep(8000);
        driver.switchTo().window(tabs.get(0));*/
        Thread.sleep(3000);
        review.clickSaveproceed_btn();

        Leasing_RentalFeePage rentalfee = new Leasing_RentalFeePage(driver);

        Thread.sleep(15000);
        String scpath1 = Generic_Class.takeScreenShotPath();
        String image1 = logger.addScreenCapture(scpath1);
        logger.log(LogStatus.PASS, "Validating rental fee in Rental Fee Pag");
        logger.log(LogStatus.PASS, "Validating rental fee in Rental Fee Page", image1);

        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");

        rentalfee.clickConfirmCust_btn();
        Thread.sleep(8000);
        //driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL,Keys.PAGE_DOWN);
        robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_PAGE_DOWN);
        robot.keyRelease(KeyEvent.VK_CONTROL);
        robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully");

        scpath = Generic_Class.takeScreenShotPath();
        image = logger.addScreenCapture(scpath);
        logger.log(LogStatus.PASS, "Validating CFS Screen and confirming with Customer");
        logger.log(LogStatus.PASS, "Validating CFS Screen and confirming with Customer " + image);

        Thread.sleep(6000);
        driver.findElement(By.id("confirmButton")).click();
        logger.log(LogStatus.INFO, "clicking on Confirm button successfully");

        Thread.sleep(5000);
        //driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL,Keys.PAGE_DOWN);
        robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_PAGE_DOWN);
        robot.keyRelease(KeyEvent.VK_CONTROL);
        robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
        driver.switchTo().window(tabs.get(0));
        logger.log(LogStatus.INFO, "Switch to Main page successfully");
        Thread.sleep(8000);

        Leasing_PaymentMethodsPage payment = new Leasing_PaymentMethodsPage(driver);

        Thread.sleep(5000);
        String amount = driver
                .findElement(By.xpath(
                        "//div[@id='payment-form']//div[@id='payment-table']//div/span[@class='js-total']"))
                .getText();

        Thread.sleep(5000);
        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");

        // Doing Payment through Credit Card
        driver.findElement(By.xpath(
                "//div[@id='payment-methods']//span[@class='k-widget k-dropdown k-header payment-method-dropdown']"))
                .click();
        Thread.sleep(5000);
        driver.findElement(By.xpath(
                "//div[contains(@class,'k-list-container k-popup k-group k-reset')]/ul/li[contains(text(),'Credit')]"))
                .click();
        logger.log(LogStatus.INFO,
                "select the credit card option  from the list and click on the credit card option");

        Thread.sleep(5000);
        payment.clickmanualentry();
        logger.log(LogStatus.INFO, "click on the enter manually tab");
        Thread.sleep(10000);

        // Performing task in Credit card popup //
        if (driver
                .findElement(By.xpath(
                        "//div[@class='k-widget k-window']//span[contains(text(),'Manual Credit Card Entry')]"))
                .isDisplayed()) {
            logger.log(LogStatus.INFO, "Credit Card Popup is displayed");
            driver.findElement(By.xpath(
                    "//div[@class='k-widget k-window']//span[contains(text(),'Manual Credit Card Entry')]"))
                    .click();
        } else {
            logger.log(LogStatus.INFO, "Credit Card Popup is not displayed");
        }

        WebElement frame = driver.findElement(By.xpath("//div[iframe[@id='iframe_Creditcard_info']]/iframe"));
        driver.switchTo().frame(frame);

        //Entering Credit Card Number
        driver.findElement(By.xpath("//input[@id='cardNumber']")).sendKeys("4111111111111111");
        Thread.sleep(5000);
        robot.keyPress(KeyEvent.VK_TAB);
        robot.keyRelease(KeyEvent.VK_TAB);

        //Selecting Expiry Month
        robot.keyPress(KeyEvent.VK_0);
        robot.keyRelease(KeyEvent.VK_0);
        robot.keyPress(KeyEvent.VK_0);
        robot.keyRelease(KeyEvent.VK_0);
        robot.keyPress(KeyEvent.VK_TAB);
        Thread.sleep(5000);

        //Selecting Expiry Year
        robot.keyPress(KeyEvent.VK_2);
        robot.keyRelease(KeyEvent.VK_2);
        robot.keyPress(KeyEvent.VK_2);
        robot.keyRelease(KeyEvent.VK_2);
        Thread.sleep(5000);

        //Clicking on Accept Button
        robot.keyPress(KeyEvent.VK_TAB);
        robot.keyRelease(KeyEvent.VK_TAB);
        robot.keyPress(KeyEvent.VK_ENTER);
        robot.keyRelease(KeyEvent.VK_ENTER);

        scpath = Generic_Class.takeScreenShotPath();
        image = logger.addScreenCapture(scpath);
        logger.log(LogStatus.PASS, "Entered details in Credit Card popup successfully");
        logger.log(LogStatus.PASS, "Entered details in Credit Card popup successfully", image);

        Thread.sleep(10000);
        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");
        driver.findElement(By.xpath("//input[@id='cardholderName']")).sendKeys("Test");
        Thread.sleep(5000);

        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");
        Thread.sleep(3000);
        payment.clickCCField();

        robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_A);
        robot.keyRelease(KeyEvent.VK_CONTROL);
        robot.keyRelease(KeyEvent.VK_A);
        robot.keyPress(KeyEvent.VK_DELETE);
        robot.keyRelease(KeyEvent.VK_DELETE);

        Thread.sleep(2000);
        payment.enterCCAmount(amount);
        Thread.sleep(5000);

        scpath = Generic_Class.takeScreenShotPath();
        Reporter.log(scpath, true);
        image = logger.addScreenCapture(scpath);
        logger.log(LogStatus.PASS, "Card and amount details entered successfully");
        logger.log(LogStatus.INFO, "Image", image);
        Thread.sleep(4000);

        payment.clickCCAutopayCheckBox();
        logger.log(LogStatus.INFO, "Clicked on Autopay check box successfully");
        Thread.sleep(5000);

        payment.clickapplybtn();
        logger.log(LogStatus.INFO, "Click on Apply button successfully");

        scpath = Generic_Class.takeScreenShotPath();
        image = logger.addScreenCapture(scpath);
        logger.log(LogStatus.PASS, "Entering Card holder name and total amount");
        logger.log(LogStatus.PASS, "Entering Card holder name and total amount " + image);

        Thread.sleep(5000);
        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");
        payment.click_CollectSignature();
        logger.log(LogStatus.INFO, "Click on Collect signature button successfully");

        Thread.sleep(6000);
        robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_PAGE_DOWN);
        robot.keyRelease(KeyEvent.VK_CONTROL);
        robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully");
        Thread.sleep(6000);

        scpath = Generic_Class.takeScreenShotPath();
        image = logger.addScreenCapture(scpath);
        logger.log(LogStatus.PASS, "Validating CFS Screen and confirming with Customer");
        logger.log(LogStatus.PASS, "Validating CFS Screen and confirming with Customer " + image);
        Thread.sleep(5000);

        signature1 = driver
                .findElement(By.xpath("//div[@class='signature-area']/canvas[@class='signature-pad']"));
        actionBuilder1 = new Actions(driver);
        drawAction1 = actionBuilder1.moveToElement(signature1, 660, 96).click().clickAndHold(signature1)
                .moveByOffset(120, 120).moveByOffset(60, 70).moveByOffset(-140, -140).release(signature1)
                .build();
        drawAction1.perform();
        Thread.sleep(6000);
        payment.clickAccept_Btn();
        logger.log(LogStatus.INFO, "Customer Signature and click on Accept button successfully");

        Thread.sleep(6000);
        robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_PAGE_DOWN);
        robot.keyRelease(KeyEvent.VK_CONTROL);
        robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
        driver.switchTo().window(tabs.get(0));

        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");
        Thread.sleep(5000);
        payment.clickApprove_Btn();
        logger.log(LogStatus.INFO, "Click on Approve button successfully");
        Thread.sleep(6000);
        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");

        Thread.sleep(6000);
        //driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL,Keys.PAGE_DOWN);
        robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_PAGE_DOWN);
        robot.keyRelease(KeyEvent.VK_CONTROL);
        robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully");
        Thread.sleep(6000);

        scpath = Generic_Class.takeScreenShotPath();
        image = logger.addScreenCapture(scpath);
        logger.log(LogStatus.PASS, "Validating CFS Screen and confirming with Customer");
        logger.log(LogStatus.PASS, "Validating CFS Screen and confirming with Customer " + image);
        Thread.sleep(5000);

        signature1 = driver
                .findElement(By.xpath("//div[@class='signature-area']/canvas[@class='signature-pad']"));
        actionBuilder1 = new Actions(driver);
        drawAction1 = actionBuilder1.moveToElement(signature1, 660, 96).click().clickAndHold(signature1)
                .moveByOffset(120, 120).moveByOffset(60, 70).moveByOffset(-140, -140).release(signature1)
                .build();
        drawAction1.perform();
        Thread.sleep(6000);
        payment.clickAccept_Btn();
        logger.log(LogStatus.INFO, "Customer Signature and click on Accept button successfully");

        Thread.sleep(6000);
        robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_PAGE_DOWN);
        robot.keyRelease(KeyEvent.VK_CONTROL);
        robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
        driver.switchTo().window(tabs.get(0));

        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");
        Thread.sleep(5000);
        //payment.clickApprove_Btn();
        driver.findElement(By.xpath("(//a[contains(text(),'Approve')])[2]")).click();
        logger.log(LogStatus.INFO, "Click on Approve button successfully");
        Thread.sleep(6000);

        Thread.sleep(6000);
        payment.clickSubmit_btn();
        logger.log(LogStatus.INFO, "Click on Submit button successfully");

        Thread.sleep(5000);

        Leasing_TransactionCompletePage transcom = new Leasing_TransactionCompletePage(driver);

        Thread.sleep(5000);
        transcom.enterEmployeeNum(tabledata.get("UserName"));

        Thread.sleep(5000);
        scpath = Generic_Class.takeScreenShotPath();
        image = logger.addScreenCapture(scpath);
        logger.log(LogStatus.PASS, "Entering Employee ID");
        logger.log(LogStatus.PASS, "Entering Employee ID " + image);
        Thread.sleep(5000);

        transcom.clickOk_btn();

        Thread.sleep(5000);
        scpath = Generic_Class.takeScreenShotPath();
        image = logger.addScreenCapture(scpath);
        logger.log(LogStatus.PASS, "Validating Gate Code Confirmation");
        logger.log(LogStatus.PASS, "Validating Gate Code Confirmation " + image);

        Thread.sleep(18000);

        try {
            driver.findElement(
                    By.xpath("//div[@class='command-row clearfix-container']//a[contains(text(),'No')]"))
                    .click();
            Thread.sleep(25000);
        } catch (Exception ex) {

        }

        Thread.sleep(30000);

        try {
            Alert alert = driver.switchTo().alert();
            driver.findElement(By.xpath("//a[contains(text(),'OK')]")).click();
            Thread.sleep(15000);
        } catch (Exception ex) {

        }

        Thread.sleep(15000);

        pm_home.clk_AdvSearchLnk();

        Thread.sleep(8000);
        Advance_Search advSearch = new Advance_Search(driver);

        String sqlQuery = "select top 1 accountid from account where customerid = (select customerid from customer where contactid = (select contactid from contact where firstname = '"
                + FN + "')) order by recorddatetime desc";

        String accNUm = DataBase_JDBC.executeSQLQuery(sqlQuery);

        advSearch.enterAccNum(accNUm);

        Thread.sleep(5000);

        logger.log(LogStatus.PASS, "Account Number Created : " + accNUm);
        scpath = Generic_Class.takeScreenShotPath();
        image = logger.addScreenCapture(scpath);
        logger.log(LogStatus.PASS, "Account Number entered in Advance Search Page successfully");
        logger.log(LogStatus.PASS, "Account Number entered in Advance Search Page successfully", image);
        Thread.sleep(3000);

        advSearch.clickSearchAccbtn();
        logger.log(LogStatus.INFO, "Click on Search button successfully");

        Thread.sleep(8000);
        Cust_AccDetailsPage cust_db = new Cust_AccDetailsPage(driver);
        String scpath3 = Generic_Class.takeScreenShotPath();
        String image3 = logger.addScreenCapture(scpath3);
        logger.log(LogStatus.PASS, "Customer Dashboard page");
        logger.log(LogStatus.PASS, "Navigated to Customer Dashboard", image3);

        cust_db.clickSpaceDetails_tab();
        logger.log(LogStatus.INFO, "Click on Space Details tab successfully");

        Thread.sleep(6000);
        Acc_SpaceDetailsPage spaceTab = new Acc_SpaceDetailsPage(driver);

        if (spaceTab.verifyAutopay_Status()) {
            scpath = Generic_Class.takeScreenShotPath();
            image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.PASS, "Autopay Status is enabled successfully");
            logger.log(LogStatus.PASS, "Autopay Status is enabled successfully", image);

        } else {
            scpath = Generic_Class.takeScreenShotPath();
            image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.FAIL, "Autopay Status is Not enabled successfully");
            logger.log(LogStatus.FAIL, "Autopay Status is Not enabled successfully", image);
        }

        Thread.sleep(8000);

        //Verify to see account activity created
        cust_db.click_AccountActivities();
        Thread.sleep(8000);

        Calendar cal = Calendar.getInstance();
        SimpleDateFormat df = new SimpleDateFormat("MM/dd/yyyy", Locale.getDefault());
        String strTodaysDate = df.format(cal.getTime());

        if (driver.findElements(By.xpath("//div[@id='activities-grid']//table//tbody//tr//td[text()='"
                + strTodaysDate
                + "']/following-sibling::td[text()='Autopay']/..//td/div[contains(text(),'Autopay turned on')]"))
                .size() != 0) {
            scpath = Generic_Class.takeScreenShotPath();
            image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.PASS, "AutoPay Status is enabled for the space - Customer Account Dashboard");
            logger.log(LogStatus.INFO, "Image", image);

        } else {

            scpath = Generic_Class.takeScreenShotPath();
            image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.FAIL, "AutoPay Status is not enabled - Customer Account Dashboard");
            logger.log(LogStatus.INFO, "Image", image);
            if (resultFlag.equals("pass"))
                resultFlag = "fail";
        }

        Thread.sleep(3000);
        if (driver.findElements(By.xpath("//div[@id='activities-grid']//table//tbody//tr//td[text()='"
                + strTodaysDate
                + "']/following-sibling::td[text()='Emails']/..//td[contains(text(),'Insurance Addendum')]"))
                .size() != 0) {
            scpath = Generic_Class.takeScreenShotPath();
            image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.PASS, "Insurance Addendum is displayed in Account Activities Section");
            logger.log(LogStatus.PASS, "Insurance Addendum is displayed in Account Activities Section", image);
            Thread.sleep(6000);
            driver.findElement(By.xpath("//div[@id='activities-grid']//table//tbody//tr//td[text()='"
                    + strTodaysDate
                    + "']/following-sibling::td[text()='Emails']/..//td[contains(text(),'Insurance Addendum')]/preceding-sibling::td[@class='k-hierarchy-cell']"))
                    .click();
            Thread.sleep(3000);
            scpath = Generic_Class.takeScreenShotPath();
            image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.PASS, "Validating Insurance Addendum  in Account Activities Section");
            logger.log(LogStatus.PASS, "Validating Insurance Addendum  in Account Activities Section", image);
        } else {

            scpath = Generic_Class.takeScreenShotPath();
            image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.FAIL, "Insurance Addendum is not displayed in Account Activities Section");
            logger.log(LogStatus.FAIL, "Insurance Addendum is not displayed in Account Activities Section",
                    image);
            if (resultFlag.equals("pass"))
                resultFlag = "fail";
        }

        cust_db.clk_DocumentsTab();
        Thread.sleep(10000);

        // Validating Documents Tab

        if (driver.findElements(By.xpath("//div[@id='documents-grid']//table/tbody//tr/td[text()='"
                + strTodaysDate + "']/following-sibling::td[text()='" + avlSpace
                + "']/preceding-sibling::td[text()='Insurance Privacy Policy']")).size() != 0) {
            scpath = Generic_Class.takeScreenShotPath();
            image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.PASS, "Insurance Addendum validation in Documents Tab");
            logger.log(LogStatus.PASS,
                    "Insurance Privacy Policy record is successfully displayed in Documents Tab");
            logger.log(LogStatus.INFO, "Image", image);

        } else {

            scpath = Generic_Class.takeScreenShotPath();
            image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.FAIL, "Insurance Privacy Policy record is not displayed in Documents Tab");
            logger.log(LogStatus.INFO, "Image", image);
            if (resultFlag.equals("pass"))
                resultFlag = "fail";
        }

        if (driver.findElements(By.xpath("//div[@id='documents-grid']//table/tbody//tr/td[text()='"
                + strTodaysDate + "']/following-sibling::td[text()='" + avlSpace
                + "']/preceding-sibling::td[text()='Property AutoPay contract']")).size() != 0) {
            scpath = Generic_Class.takeScreenShotPath();
            image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.PASS, "Autopay Addendum validation in Documents Tab");
            logger.log(LogStatus.PASS,
                    "Propertywalkin AutoPay generated contract record is successfully displayed in Documents Tab");
            logger.log(LogStatus.INFO, "Image", image);

        } else {

            scpath = Generic_Class.takeScreenShotPath();
            image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.FAIL,
                    "Propertywalkin AutoPay generated contract record is not displayed in Documents Tab");
            logger.log(LogStatus.INFO, "Image", image);
            if (resultFlag.equals("pass"))
                resultFlag = "fail";
        }

    } catch (Exception ex) {
        ex.printStackTrace();
        //In the catch block, set the variable resultFlag to fail
        resultFlag = "fail";
        String scpath = Generic_Class.takeScreenShotPath();
        String image = logger.addScreenCapture(scpath);
        logger.log(LogStatus.FAIL, "Validating Monthly rent and Promotions in Eligible Promotion Page", image);
        logger.log(LogStatus.FAIL, "Test script failed due to the exception " + ex);
    }

}

From source file:Scenarios.CustomerSearch.AdvancedSearch_IdNum.java

@Test(dataProvider = "getCustomerSearchData")
public void CustomerSearch_AdvancedSearch_IdNum(Hashtable<String, String> tabledata) throws Exception {

    if (!(tabledata.get("Runmode").equals("Y") && tabledata.get("CustomerSearch").equals("Y"))) {
        resultFlag = "skip";
        throw new SkipException("Skipping the test");
    }/*from  w  ww.  j  a va2  s  .c  om*/

    try {

        //Login to PS Application
        logger = extent.startTest(this.getClass().getSimpleName(), "Advanced Search --ID Num");
        LoginPage login = new LoginPage(driver);
        login.login(tabledata.get("UserName"), tabledata.get("Password"));
        logger.log(LogStatus.INFO, "User logged in successfully as PM");
        String scpath, image;

        Dashboard_BifrostHostPopUp Bifrostpop = new Dashboard_BifrostHostPopUp(driver);

        String biforstNum = Bifrostpop.getBiforstNo();

        //driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL,"t");

        Robot robot = new Robot();
        robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_T);
        robot.keyRelease(KeyEvent.VK_CONTROL);
        robot.keyRelease(KeyEvent.VK_T);

        Thread.sleep(5000);
        ArrayList<String> tabs = new ArrayList<String>(driver.getWindowHandles());
        driver.switchTo().window(tabs.get(1));
        Thread.sleep(15000);
        driver.get(Generic_Class.getPropertyValue("CustomerScreenPath_QA"));

        List<WebElement> biforstSystem = driver.findElements(
                By.xpath("//div[@class='scrollable-area']//span[@class='bifrost-label vertical-center']"));
        for (WebElement ele : biforstSystem) {
            if (biforstNum.equalsIgnoreCase(ele.getText().trim())) {
                Reporter.log(ele.getText() + "", true);
                ele.click();
                break;
            }
        }

        Thread.sleep(5000);
        driver.switchTo().window(tabs.get(0));
        // driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL,Keys.PAGE_DOWN);
        robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_PAGE_DOWN);
        robot.keyRelease(KeyEvent.VK_CONTROL);
        robot.keyRelease(KeyEvent.VK_PAGE_DOWN);

        Thread.sleep(10000);
        driver.findElement(By.xpath(
                "//div[@id='cfsConnectionDialog']//div[@class='after-connected padding-top']//p/input[@class='psbutton-low-priority']"))
                .click();
        Thread.sleep(5000);

        PM_Homepage pmhomepage = new PM_Homepage(driver);
        pmhomepage.clk_AdvSearchLnk();
        Thread.sleep(10000);

        Advance_Search advSearch = new Advance_Search(driver);
        advSearch.enterAccNum(tabledata.get("AccountNumber"));
        JavascriptExecutor js = (JavascriptExecutor) driver;
        js.executeScript("window.scrollBy(2000,0)", "");
        advSearch.clickButton();
        Thread.sleep(40000);

        Acc_CustomerInfoPage custInfo = new Acc_CustomerInfoPage(driver);
        String getAcc = custInfo.getAccNum();
        if (getAcc.equals(tabledata.get("AccountNumber"))) {

            logger.log(LogStatus.PASS, "Navigated to Customer Dashboard");
            scpath = Generic_Class.takeScreenShotPath();
            image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.INFO, "Image", image);

            custInfo.click_EditAccountDetails();
            Thread.sleep(5000);

            Cust_EditAccountDetailsPage editAcc = new Cust_EditAccountDetailsPage(driver);
            editAcc.clickCustInfoRadioBtn();
            Thread.sleep(2000);
            editAcc.clickYesRadioBtn();
            Thread.sleep(1000);
            editAcc.clickLaunchBtn();
            Thread.sleep(5000);

            logger.log(LogStatus.PASS, "Navigated to Customer Information Screen");
            scpath = Generic_Class.takeScreenShotPath();
            image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.INFO, "Image", image);

            Cust_CustomerInfoPage info = new Cust_CustomerInfoPage(driver);
            String license = info.getLicense();
            if (license.equals("A1259871")) {
                license = "A1246835";
            } else {
                license = "A1259871";
            }
            info.enterLicenseNumber(license);

            logger.log(LogStatus.INFO, "Changed the ID Num");
            scpath = Generic_Class.takeScreenShotPath();
            image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.INFO, "Image", image);

            js = (JavascriptExecutor) driver;
            js.executeScript("window.scrollBy(0,3000)", "");

            info.clk_verifyButton();
            Thread.sleep(5000);

            info.clk_ConfirmBtn();
            Thread.sleep(5000);

            driver.switchTo().window(tabs.get(1));
            robot.keyPress(KeyEvent.VK_CONTROL);
            robot.keyPress(KeyEvent.VK_PAGE_DOWN);
            robot.keyRelease(KeyEvent.VK_CONTROL);
            robot.keyRelease(KeyEvent.VK_PAGE_DOWN);

            WebElement signature = driver
                    .findElement(By.xpath("//div[@class='signature-area']/canvas[@class='signature-pad']"));
            Actions actionBuilder = new Actions(driver);
            Action drawAction = actionBuilder.moveToElement(signature, 660, 96).click().clickAndHold(signature)
                    .moveByOffset(120, 120).moveByOffset(60, 70).moveByOffset(-140, -140).release(signature)
                    .build();
            drawAction.perform();
            Thread.sleep(5000);
            driver.findElement(By.xpath("//button[text()='Accept']")).click();
            Thread.sleep(5000);
            driver.switchTo().window(tabs.get(0));
            robot.keyPress(KeyEvent.VK_CONTROL);
            robot.keyPress(KeyEvent.VK_PAGE_DOWN);
            robot.keyRelease(KeyEvent.VK_CONTROL);
            robot.keyRelease(KeyEvent.VK_PAGE_DOWN);

            info.clk_ApproveBtn();
            Thread.sleep(2000);
            logger.log(LogStatus.PASS, "Customer approved the changes from CFS");
            scpath = Generic_Class.takeScreenShotPath();
            image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.INFO, "Image", image);

            info.clk_SaveBtn();
            Thread.sleep(5000);

            EmergencyContact_EmployeeIdPage empId = new EmergencyContact_EmployeeIdPage(driver);
            empId.enter_EmployeeId(tabledata.get("UserName"));
            empId.click_ContinueBtn();
            Thread.sleep(15000);

            //Verifying the changes done
            custInfo = new Acc_CustomerInfoPage(driver);
            String idNum = custInfo.getIdentificationId();
            if (idNum.contains("****" + license.substring(4))) {

                logger.log(LogStatus.PASS, "ID Num updated successfully to " + license);
                scpath = Generic_Class.takeScreenShotPath();
                image = logger.addScreenCapture(scpath);
                logger.log(LogStatus.INFO, "Image", image);

                custInfo.click_BackToDashboard();
                Thread.sleep(10000);

                pmhomepage.clk_AdvSearchLnk();
                Thread.sleep(10000);

                advSearch = new Advance_Search(driver);
                advSearch.search_All();
                Thread.sleep(3000);
                advSearch.clickStatusDropdown();
                Thread.sleep(2000);
                List<WebElement> statusTypes = driver.findElements(
                        By.xpath("//ul[@id='SearchContract_SearchStatusID_listbox']/li[@class='k-item']"));
                for (WebElement type : statusTypes) {
                    if (type.getText().trim().equalsIgnoreCase("All")) {
                        type.click();
                        break;
                    }
                }
                Thread.sleep(4000);
                advSearch.enterIdNum(license);
                logger.log(LogStatus.INFO, "Entered the new ID number in search");
                scpath = Generic_Class.takeScreenShotPath();
                image = logger.addScreenCapture(scpath);
                logger.log(LogStatus.INFO, "Image", image);

                js = (JavascriptExecutor) driver;
                js.executeScript("window.scrollBy(3000,0)", "");
                js.executeScript("window.scrollBy(0,5000)", "");
                advSearch.clickSearchbtn();
                Thread.sleep(45000);

                boolean found = false;
                List<WebElement> elements = driver
                        .findElements(By.xpath("//table[@class='k-selectable']/tbody//tr/td[11]"));
                for (int i = 0; i < elements.size(); i++) {
                    if (i > 7) {
                        break;
                    }
                    if (elements.get(i).getText().equals(tabledata.get("AccountNumber"))) {
                        found = true;
                        break;
                    }
                }

                if (found) {
                    logger.log(LogStatus.PASS, "Id number search is successful");
                    logger.log(LogStatus.PASS,
                            "Id number search returned the correct account number, the one which we updated now");
                    scpath = Generic_Class.takeScreenShotPath();
                    image = logger.addScreenCapture(scpath);
                    logger.log(LogStatus.INFO, "Image", image);
                } else {
                    logger.log(LogStatus.FAIL, "Id number search is successful");
                    logger.log(LogStatus.FAIL,
                            "Id number search returned the correct account number, the one which we updated now");
                    scpath = Generic_Class.takeScreenShotPath();
                    image = logger.addScreenCapture(scpath);
                    logger.log(LogStatus.INFO, "Image", image);
                    if (resultFlag.equals("pass"))
                        resultFlag = "fail";
                }
            } else {
                scpath = Generic_Class.takeScreenShotPath();
                image = logger.addScreenCapture(scpath);
                logger.log(LogStatus.FAIL, "ID Num not updated");
                logger.log(LogStatus.INFO, "Image", image);
                if (resultFlag.equals("pass"))
                    resultFlag = "fail";
            }
        } else {
            scpath = Generic_Class.takeScreenShotPath();
            image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.FAIL, "Navigated to a different customer dashboard");
            logger.log(LogStatus.INFO, "Image", image);
            if (resultFlag.equals("pass"))
                resultFlag = "fail";
        }
    } catch (Exception ex) {
        ex.printStackTrace();
        resultFlag = "fail";
        logger.log(LogStatus.FAIL, "Test script failed due to the exception " + ex);
    }

}

From source file:Scenarios.CustomerSearch.AdvancedSearch_IdNum_And_OtherCriteria.java

@Test(dataProvider = "getLoginData")
public void AdvancedSearch_IdNum_And_OtherCriteria(Hashtable<String, String> tabledata) throws Exception {

    if (!(tabledata.get("Runmode").equals("Y") && tabledata.get("CustomerSearch").equals("Y"))) {
        resultFlag = "skip";
        throw new SkipException("Skipping the test");
    }/*from www .j  a  va  2 s.  com*/

    Reporter.log("Test Case Started", true);
    Thread.sleep(5000);

    try {
        logger = extent.startTest("AdvancedSearch_IdNum_And_OtherCriteria",
                "Customer Search - Advanced Search ID number and other criteria");

        Thread.sleep(5000);
        JavascriptExecutor js = (JavascriptExecutor) driver;
        LoginPage login = new LoginPage(driver);
        login.login(tabledata.get("UserName"), tabledata.get("Password"));
        logger.log(LogStatus.INFO, "Click on Login button successfully");
        String scpath, image;
        Thread.sleep(2000);

        //=================Handling Customer Facing Device================================

        Thread.sleep(5000);
        Dashboard_BifrostHostPopUp Bifrostpop = new Dashboard_BifrostHostPopUp(driver);
        logger.log(LogStatus.INFO, "PopUp window object is created successfully");
        String biforstNum = Bifrostpop.getBiforstNo();
        Robot robot = new Robot();
        robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_T);
        robot.keyRelease(KeyEvent.VK_CONTROL);
        robot.keyRelease(KeyEvent.VK_T);
        Thread.sleep(3000);
        ArrayList<String> tabs = new ArrayList<String>(driver.getWindowHandles());
        Reporter.log(tabs.size() + "", true);
        driver.switchTo().window(tabs.get(1));
        driver.get(Generic_Class.getPropertyValue("CustomerScreenPath_aut"));

        List<WebElement> biforstSystem = driver.findElements(
                By.xpath("//div[@class='scrollable-area']//span[@class='bifrost-label vertical-center']"));
        for (WebElement ele : biforstSystem) {
            if (biforstNum.equalsIgnoreCase(ele.getText().trim())) {
                Reporter.log(ele.getText() + "", true);
                ele.click();
                break;
            }
        }
        robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_PAGE_DOWN);
        robot.keyRelease(KeyEvent.VK_CONTROL);
        robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
        Thread.sleep(5000);
        driver.switchTo().window(tabs.get(0));
        Thread.sleep(5000);
        driver.findElement(By.xpath(
                "//div[@id='cfsConnectionDialog']//div[@class='after-connected padding-top']//p/input[@class='psbutton-low-priority']"))
                .click();
        Thread.sleep(5000);

        //================================== PM Home Page ===============================================

        PM_Homepage pmhomepage = new PM_Homepage(driver);
        Thread.sleep(3000);

        String SiteNumber = pmhomepage.getLocation();
        logger.log(LogStatus.PASS, "location number is:" + SiteNumber);

        //Verifying PM Dash Board is displayed
        if (pmhomepage.get_WlkInCustText().trim().equalsIgnoreCase("Walk-In Customer")) {
            scpath = Generic_Class.takeScreenShotPath();
            Reporter.log(scpath, true);
            image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.PASS, "PM Dashboard is displayed Successfully");
            logger.log(LogStatus.INFO, "PM Dashboard is displayed Successfully", image);
        } else {

            if (resultFlag.equals("pass"))
                resultFlag = "fail";

            scpath = Generic_Class.takeScreenShotPath();
            image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.FAIL, "PM Dashboard is not displayed");
            logger.log(LogStatus.INFO, "PM Dashboard is not displayed", image);

        }
        Thread.sleep(2000);

        pmhomepage.clk_AdvSearchLnk();
        Thread.sleep(6000);
        logger.log(LogStatus.INFO, "Clicked on Advance Search link in PM home page");

        //Advance search page
        Advance_Search advSearch = new Advance_Search(driver);

        advSearch.click_StateDropdown();
        Thread.sleep(3000);
        int numberOfPixelsToDragTheScrollbarDown = 1;
        Actions dragger = new Actions(driver);
        WebElement draggablePartOfScrollbar = driver.findElement(By.xpath(
                "(//ul[@id='SearchContract_StateCode_listbox'])[2]//div[@class='ps-scrollbar-y-rail']//div[@class='ps-scrollbar-y']"));
        Thread.sleep(3000);
        List<WebElement> stateCodes = driver.findElements(
                By.xpath("(//ul[@id='SearchContract_StateCode_listbox'])[2]//li[@class='k-item']"));
        Thread.sleep(3000);

        for (int i = 1; i <= stateCodes.size(); i++) {
            WebElement ele = driver.findElement(By.xpath(
                    "((//ul[@id='SearchContract_StateCode_listbox'])[2]//li[@class='k-item'])[" + i + "]"));
            String value = ele.getText().trim();
            System.out.println(value);
            if (value.equalsIgnoreCase("CA")) {
                ele.click();
                break;
            } else if (i <= 7) {
                dragger.moveToElement(draggablePartOfScrollbar).clickAndHold()
                        .moveByOffset(0, numberOfPixelsToDragTheScrollbarDown).release().build().perform();
                numberOfPixelsToDragTheScrollbarDown += 1;
                Thread.sleep(1000);

            }

        }
        Thread.sleep(1000);

        ((JavascriptExecutor) driver).executeScript("window.scrollTo(500, 0)");
        Thread.sleep(3000);
        advSearch.clickStatusDropdown();
        Thread.sleep(2000);
        List<WebElement> statusTypes = driver.findElements(
                By.xpath("//ul[@id='SearchContract_SearchStatusID_listbox']/li[@class='k-item']"));
        Thread.sleep(2000);
        for (WebElement type : statusTypes) {
            if (type.getText().trim().equalsIgnoreCase("All")) {
                Thread.sleep(2000);
                type.click();
                break;
            }
        }
        Thread.sleep(1000);
        advSearch.enterLastName(tabledata.get("LastName"));
        Thread.sleep(1000);
        logger.log(LogStatus.INFO, "Entered Last Name is: " + tabledata.get("LastName"));
        scpath = Generic_Class.takeScreenShotPath();
        image = logger.addScreenCapture(scpath);
        logger.log(LogStatus.INFO, "img", image);
        Thread.sleep(2000);
        ((JavascriptExecutor) driver).executeScript("window.scrollBy(5000,0)");
        Thread.sleep(5000);
        ((JavascriptExecutor) driver).executeScript("window.scrollBy(0,3000)");
        Thread.sleep(3000);
        advSearch.clickSearchbtn();
        logger.log(LogStatus.INFO, "Clicked Search button successfully");
        Thread.sleep(6000);

        try {
            String accNum = driver
                    .findElement(By.xpath("//div[@id='updateResultsPanel']//table//tbody//tr//td[11]/a"))
                    .getText();
            logger.log(LogStatus.INFO, "Account Number is : " + accNum);

            advSearch.click_accnum_Grid();
            logger.log(LogStatus.INFO, "Clicked on Account Number");
            Thread.sleep(4000);

            Acc_CustomerInfoPage custInfo = new Acc_CustomerInfoPage(driver);

            //String getAcc = custInfo.getAccNum();
            String cusName = driver.findElement(By.xpath("//h1[@class='customer-name bold']")).getText().trim();
            logger.log(LogStatus.INFO, "Customer Name is : " + cusName);

            Thread.sleep(2000);

            ((JavascriptExecutor) driver).executeScript("window.scrollBy(2000,0)");
            Thread.sleep(2000);

            custInfo.click_EditAccountDetails();
            Thread.sleep(5000);

            Cust_EditAccountDetailsPage editAcc = new Cust_EditAccountDetailsPage(driver);
            editAcc.clickCustInfoRadioBtn();
            logger.log(LogStatus.INFO, "Selected Customer Info radio button");
            Thread.sleep(2000);
            editAcc.clickYesRadioBtn();
            logger.log(LogStatus.INFO, "Selected Yes radio button");
            Thread.sleep(1000);
            scpath = Generic_Class.takeScreenShotPath();
            image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.INFO, "Image", image);
            Thread.sleep(1000);
            editAcc.clickLaunchBtn();
            Thread.sleep(5000);

            logger.log(LogStatus.PASS, "Navigated to Customer Information Screen");
            scpath = Generic_Class.takeScreenShotPath();
            image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.INFO, "Image", image);

            Cust_CustomerInfoPage info = new Cust_CustomerInfoPage(driver);
            info.clk_selectIdentificationType();
            Thread.sleep(2000);

            List<WebElement> iden = driver.findElements(By.xpath(
                    "//ul[@id='IndividualInformationModel_ContactIdentification_IdentificationTypeID_listbox']/li"));
            Thread.sleep(2000);
            for (WebElement type : iden) {
                if (type.getText().trim().equalsIgnoreCase("Passport")) {
                    Thread.sleep(2000);
                    type.click();
                    break;
                }
            }
            Thread.sleep(1000);

            info.clk_Country();
            Thread.sleep(2000);

            int numberOfPixelsToDragTheScrollbarDow = 1;
            Actions dragger1 = new Actions(driver);
            WebElement draggablePartOfScrollbar1 = driver.findElement(By.xpath(
                    "//ul[@id='IndividualInformationModel_ContactIdentification_CountryTypeID_listbox']/div[@class='ps-scrollbar-y-rail']//div[@class='ps-scrollbar-y']"));
            Thread.sleep(3000);
            List<WebElement> listCountry1 = driver.findElements(By.xpath(
                    "//ul[@id='IndividualInformationModel_ContactIdentification_CountryTypeID_listbox']/li"));
            Thread.sleep(3000);

            for (int i = 1; i <= listCountry1.size(); i++) {
                WebElement ele = driver.findElement(By.xpath(
                        "//ul[@id='IndividualInformationModel_ContactIdentification_CountryTypeID_listbox']/li["
                                + i + "]"));
                String value = ele.getText().trim();
                System.out.println(value);
                if (value.equalsIgnoreCase("India")) {
                    ele.click();
                    break;
                } else if (i <= 12) {
                    dragger1.moveToElement(draggablePartOfScrollbar1).clickAndHold()
                            .moveByOffset(0, numberOfPixelsToDragTheScrollbarDow).release().build().perform();
                    numberOfPixelsToDragTheScrollbarDow += 1;
                    Thread.sleep(1000);

                }

            }
            Thread.sleep(1000);
            info.enterLicenseNumber(tabledata.get("PassportNumber"));
            logger.log(LogStatus.INFO, "Entered Passport ID Number : " + tabledata.get("PassportNumber"));
            Thread.sleep(3000);
            scpath = Generic_Class.takeScreenShotPath();
            image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.INFO, "Image", image);

            js = (JavascriptExecutor) driver;
            js.executeScript("window.scrollBy(0,3000)", "");

            info.clk_verifyButton();
            Thread.sleep(5000);

            try {
                boolean error = driver
                        .findElement(By.xpath("//div[contains(text(),'Email Address is required')]"))
                        .isDisplayed();
                if (error) {
                    info.clickNoEmailCheckBox();
                    Thread.sleep(2000);

                    js = (JavascriptExecutor) driver;
                    js.executeScript("window.scrollBy(0,3000)", "");

                    info.clk_verifyButton();
                    Thread.sleep(7000);
                }

            } catch (Exception e) {

            }

            info.clk_ConfirmBtn();
            Thread.sleep(5000);

            driver.switchTo().window(tabs.get(1));
            robot.keyPress(KeyEvent.VK_CONTROL);
            robot.keyPress(KeyEvent.VK_PAGE_DOWN);
            robot.keyRelease(KeyEvent.VK_CONTROL);
            robot.keyRelease(KeyEvent.VK_PAGE_DOWN);

            WebElement signature = driver
                    .findElement(By.xpath("//div[@class='signature-area']/canvas[@class='signature-pad']"));
            Actions actionBuilder = new Actions(driver);
            Action drawAction = actionBuilder.moveToElement(signature, 660, 96).click().clickAndHold(signature)
                    .moveByOffset(120, 120).moveByOffset(60, 70).moveByOffset(-140, -140).release(signature)
                    .build();
            drawAction.perform();
            Thread.sleep(5000);
            logger.log(LogStatus.INFO, "Got signature from Customer");
            scpath = Generic_Class.takeScreenShotPath();
            image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.INFO, "img", image);
            driver.findElement(By.xpath("//button[text()='Accept']")).click();
            Thread.sleep(5000);
            driver.switchTo().window(tabs.get(0));
            robot.keyPress(KeyEvent.VK_CONTROL);
            robot.keyPress(KeyEvent.VK_PAGE_DOWN);
            robot.keyRelease(KeyEvent.VK_CONTROL);
            robot.keyRelease(KeyEvent.VK_PAGE_DOWN);

            info.clk_ApproveBtn();
            Thread.sleep(2000);
            logger.log(LogStatus.PASS, "Customer approved the changes from CFS");
            scpath = Generic_Class.takeScreenShotPath();
            image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.INFO, "Image", image);

            info.clk_SaveBtn();
            Thread.sleep(5000);

            EmergencyContact_EmployeeIdPage empId = new EmergencyContact_EmployeeIdPage(driver);
            empId.enter_EmployeeId(tabledata.get("UserName"));
            Thread.sleep(3000);
            empId.click_ContinueBtn();
            Thread.sleep(20000);

            try {
                driver.findElement(By.xpath("//a[contains(text(),'OK')]")).click();
                Thread.sleep(6000);
            } catch (Exception e) {

            }

            Cust_AccDetailsPage accDet = new Cust_AccDetailsPage(driver);
            accDet.click_BackToDashboard();
            Thread.sleep(8000);

            pmhomepage.clk_AdvSearchLnk();
            Thread.sleep(6000);
            logger.log(LogStatus.INFO, "Clicked on Advance Search link in PM home page");

            //Advance search page

            advSearch.click_StateDropdown();
            Thread.sleep(3000);
            int numberOfPixelsToDragTheScrollbarDownn = 1;
            Actions dragger2 = new Actions(driver);
            WebElement draggablePartOfScrollbar2 = driver.findElement(By.xpath(
                    "(//ul[@id='SearchContract_StateCode_listbox'])[2]//div[@class='ps-scrollbar-y-rail']//div[@class='ps-scrollbar-y']"));
            Thread.sleep(3000);
            List<WebElement> stateCodes2 = driver.findElements(
                    By.xpath("(//ul[@id='SearchContract_StateCode_listbox'])[2]//li[@class='k-item']"));
            Thread.sleep(3000);

            for (int i = 1; i <= stateCodes2.size(); i++) {
                WebElement ele = driver.findElement(By.xpath(
                        "((//ul[@id='SearchContract_StateCode_listbox'])[2]//li[@class='k-item'])[" + i + "]"));
                String value = ele.getText().trim();
                System.out.println(value);
                if (value.equalsIgnoreCase("CA")) {
                    ele.click();
                    break;
                } else if (i <= 7) {
                    dragger2.moveToElement(draggablePartOfScrollbar2).clickAndHold()
                            .moveByOffset(0, numberOfPixelsToDragTheScrollbarDownn).release().build().perform();
                    numberOfPixelsToDragTheScrollbarDownn += 1;
                    Thread.sleep(1000);

                }

            }
            Thread.sleep(1000);

            ((JavascriptExecutor) driver).executeScript("window.scrollTo(500, 0)");
            Thread.sleep(3000);
            advSearch.clickStatusDropdown();
            Thread.sleep(2000);
            List<WebElement> statusTypes2 = driver.findElements(
                    By.xpath("//ul[@id='SearchContract_SearchStatusID_listbox']/li[@class='k-item']"));
            Thread.sleep(2000);
            for (WebElement type : statusTypes2) {
                if (type.getText().trim().equalsIgnoreCase("All")) {
                    Thread.sleep(2000);
                    type.click();
                    break;
                }
            }
            Thread.sleep(1000);
            advSearch.enterLastName(tabledata.get("LastName"));
            logger.log(LogStatus.INFO, "Entered Last Name is: " + tabledata.get("LastName"));
            Thread.sleep(2000);
            ((JavascriptExecutor) driver).executeScript("window.scrollBy(5000,0)");
            Thread.sleep(4000);
            advSearch.enterIdNum(tabledata.get("PassportNumber"));
            logger.log(LogStatus.INFO, "Entered Passport id : " + tabledata.get("PassportNumber"));
            Thread.sleep(2000);
            scpath = Generic_Class.takeScreenShotPath();
            image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.INFO, "img", image);
            Thread.sleep(2000);

            ((JavascriptExecutor) driver).executeScript("window.scrollBy(0,3000)");
            Thread.sleep(3000);
            advSearch.clickSearchbtn();
            logger.log(LogStatus.INFO, "Clicked Search button successfully");
            Thread.sleep(6000);

            String accNum1 = driver
                    .findElement(By.xpath("//div[@id='updateResultsPanel']//table//tbody//tr//td[11]/a"))
                    .getText();

            advSearch.click_accnum_Grid();
            logger.log(LogStatus.INFO, "Clicked on Account Number");
            Thread.sleep(6000);

            if (accNum.equals(accNum1)) {
                scpath = Generic_Class.takeScreenShotPath();
                Reporter.log(scpath, true);
                image = logger.addScreenCapture(scpath);
                logger.log(LogStatus.PASS,
                        "Account Number : " + accNum + " is matched successfully " + accNum1);
                logger.log(LogStatus.INFO, "img", image);
            } else {

                if (resultFlag.equals("pass"))
                    resultFlag = "fail";

                scpath = Generic_Class.takeScreenShotPath();
                image = logger.addScreenCapture(scpath);
                logger.log(LogStatus.FAIL,
                        "Account Number : " + accNum + " is not matched successfully " + accNum1);
                logger.log(LogStatus.INFO, "img", image);

            }

            String cusName1 = driver.findElement(By.xpath("//h1[@class='customer-name bold']")).getText()
                    .trim();
            if (cusName.equals(cusName1)) {
                scpath = Generic_Class.takeScreenShotPath();
                Reporter.log(scpath, true);
                image = logger.addScreenCapture(scpath);
                logger.log(LogStatus.PASS,
                        "Customer Name : " + cusName + " is matched successfully " + cusName1);
                logger.log(LogStatus.INFO, "img", image);
            } else {

                if (resultFlag.equals("pass"))
                    resultFlag = "fail";

                scpath = Generic_Class.takeScreenShotPath();
                image = logger.addScreenCapture(scpath);
                logger.log(LogStatus.FAIL,
                        "Customer Name : " + cusName + " is not matched successfully " + cusName1);
                logger.log(LogStatus.INFO, "img", image);

            }

        } catch (Exception e) {
            logger.log(LogStatus.INFO, "No records found for the searched criteria");
            Thread.sleep(1000);
            scpath = Generic_Class.takeScreenShotPath();
            image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.INFO, "img", image);

        }

    } catch (Exception ex) {
        ex.printStackTrace();
        resultFlag = "fail";
        logger.log(LogStatus.FAIL, "Test script failed due to the exception " + ex);
    }

}

From source file:Scenarios.CustomerSearch.BasicSearch_IdNum.java

@Test(dataProvider = "getCustomerSearchData")
public void CustomerSearch_BasicSearch_IdNum(Hashtable<String, String> tabledata) throws Exception {

    if (!(tabledata.get("Runmode").equals("Y") && tabledata.get("CustomerSearch").equals("Y"))) {
        resultFlag = "skip";
        throw new SkipException("Skipping the test");
    }//  ww w  . j a  v  a  2  s. com

    try {

        //Login to PS Application
        logger = extent.startTest(this.getClass().getSimpleName(), "Basic Search -- ID Num");
        LoginPage login = new LoginPage(driver);
        login.login(tabledata.get("UserName"), tabledata.get("Password"));
        logger.log(LogStatus.INFO, "User logged in successfully as PM");
        String scpath, image;

        Dashboard_BifrostHostPopUp Bifrostpop = new Dashboard_BifrostHostPopUp(driver);

        String biforstNum = Bifrostpop.getBiforstNo();

        //driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL,"t");

        Robot robot = new Robot();
        robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_T);
        robot.keyRelease(KeyEvent.VK_CONTROL);
        robot.keyRelease(KeyEvent.VK_T);

        Thread.sleep(5000);
        ArrayList<String> tabs = new ArrayList<String>(driver.getWindowHandles());
        driver.switchTo().window(tabs.get(1));
        Thread.sleep(15000);
        driver.get(Generic_Class.getPropertyValue("CustomerScreenPath_QA"));

        List<WebElement> biforstSystem = driver.findElements(
                By.xpath("//div[@class='scrollable-area']//span[@class='bifrost-label vertical-center']"));
        for (WebElement ele : biforstSystem) {
            if (biforstNum.equalsIgnoreCase(ele.getText().trim())) {
                Reporter.log(ele.getText() + "", true);
                ele.click();
                break;
            }
        }

        Thread.sleep(5000);
        driver.switchTo().window(tabs.get(0));
        // driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL,Keys.PAGE_DOWN);
        robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_PAGE_DOWN);
        robot.keyRelease(KeyEvent.VK_CONTROL);
        robot.keyRelease(KeyEvent.VK_PAGE_DOWN);

        Thread.sleep(10000);
        driver.findElement(By.xpath(
                "//div[@id='cfsConnectionDialog']//div[@class='after-connected padding-top']//p/input[@class='psbutton-low-priority']"))
                .click();
        Thread.sleep(5000);

        PM_Homepage pmhomepage = new PM_Homepage(driver);
        pmhomepage.clk_AdvSearchLnk();
        Thread.sleep(10000);

        Advance_Search advSearch = new Advance_Search(driver);
        advSearch.enterAccNum(tabledata.get("AccountNumber"));
        JavascriptExecutor js = (JavascriptExecutor) driver;
        js.executeScript("window.scrollBy(2000,0)", "");
        advSearch.clickButton();
        Thread.sleep(40000);

        Acc_CustomerInfoPage custInfo = new Acc_CustomerInfoPage(driver);
        String getAcc = custInfo.getAccNum();

        if (getAcc.equals(tabledata.get("AccountNumber"))) {

            logger.log(LogStatus.PASS, "Navigated to Customer Dashboard");
            scpath = Generic_Class.takeScreenShotPath();
            image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.INFO, "Image", image);

            custInfo.click_EditAccountDetails();
            Thread.sleep(5000);

            Cust_EditAccountDetailsPage editAcc = new Cust_EditAccountDetailsPage(driver);
            editAcc.clickCustInfoRadioBtn();
            Thread.sleep(2000);
            editAcc.clickYesRadioBtn();
            Thread.sleep(1000);
            editAcc.clickLaunchBtn();
            Thread.sleep(5000);

            logger.log(LogStatus.PASS, "Navigated to Customer Information Screen");
            scpath = Generic_Class.takeScreenShotPath();
            image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.INFO, "Image", image);

            Cust_CustomerInfoPage info = new Cust_CustomerInfoPage(driver);
            String license = info.getLicense();
            if (license.equals("A1259871")) {
                license = "A1246835";
            } else {
                license = "A1259871";
            }
            info.enterLicenseNumber(license);

            logger.log(LogStatus.INFO, "Changed the ID Num");
            scpath = Generic_Class.takeScreenShotPath();
            image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.INFO, "Image", image);

            js = (JavascriptExecutor) driver;
            js.executeScript("window.scrollBy(0,3000)", "");

            info.clk_verifyButton();
            Thread.sleep(5000);

            info.clk_ConfirmBtn();
            Thread.sleep(5000);

            driver.switchTo().window(tabs.get(1));
            robot.keyPress(KeyEvent.VK_CONTROL);
            robot.keyPress(KeyEvent.VK_PAGE_DOWN);
            robot.keyRelease(KeyEvent.VK_CONTROL);
            robot.keyRelease(KeyEvent.VK_PAGE_DOWN);

            WebElement signature = driver
                    .findElement(By.xpath("//div[@class='signature-area']/canvas[@class='signature-pad']"));
            Actions actionBuilder = new Actions(driver);
            Action drawAction = actionBuilder.moveToElement(signature, 660, 96).click().clickAndHold(signature)
                    .moveByOffset(120, 120).moveByOffset(60, 70).moveByOffset(-140, -140).release(signature)
                    .build();
            drawAction.perform();
            Thread.sleep(5000);
            driver.findElement(By.xpath("//button[text()='Accept']")).click();
            Thread.sleep(5000);
            driver.switchTo().window(tabs.get(0));
            robot.keyPress(KeyEvent.VK_CONTROL);
            robot.keyPress(KeyEvent.VK_PAGE_DOWN);
            robot.keyRelease(KeyEvent.VK_CONTROL);
            robot.keyRelease(KeyEvent.VK_PAGE_DOWN);

            info.clk_ApproveBtn();
            Thread.sleep(2000);
            logger.log(LogStatus.PASS, "Customer approved the changes from CFS");
            scpath = Generic_Class.takeScreenShotPath();
            image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.INFO, "Image", image);

            info.clk_SaveBtn();
            Thread.sleep(5000);

            EmergencyContact_EmployeeIdPage empId = new EmergencyContact_EmployeeIdPage(driver);
            empId.enter_EmployeeId(tabledata.get("UserName"));
            empId.click_ContinueBtn();
            Thread.sleep(15000);

            //Verifying the changes done
            custInfo = new Acc_CustomerInfoPage(driver);
            String idNum = custInfo.getIdentificationId();
            if (idNum.contains("****" + license.substring(4))) {

                logger.log(LogStatus.PASS, "ID Num updated successfully to " + license);
                scpath = Generic_Class.takeScreenShotPath();
                image = logger.addScreenCapture(scpath);
                logger.log(LogStatus.INFO, "Image", image);

                custInfo.click_BackToDashboard();
                Thread.sleep(10000);

                pmhomepage.enter_findCustAddrLocation(license);
                Thread.sleep(5000);
                logger.log(LogStatus.INFO, "Entered the new ID number in search");
                scpath = Generic_Class.takeScreenShotPath();
                image = logger.addScreenCapture(scpath);
                logger.log(LogStatus.INFO, "Image", image);

                Thread.sleep(5000);
                pmhomepage.clk_findCustomer();
                logger.log(LogStatus.PASS, "Clicked on Find Customer Button successfully");
                Thread.sleep(15000);

                advSearch = new Advance_Search(driver);

                js = (JavascriptExecutor) driver;
                js.executeScript("window.scrollBy(3000,0)", "");
                js.executeScript("window.scrollBy(0,5000)", "");

                boolean found = false;
                List<WebElement> elements = driver
                        .findElements(By.xpath("//table[@class='k-selectable']/tbody//tr/td[11]"));
                for (int i = 0; i < elements.size(); i++) {
                    if (i > 7) {
                        break;
                    }
                    if (elements.get(i).getText().equals(tabledata.get("AccountNumber"))) {
                        found = true;
                        break;
                    }
                }

                if (found) {
                    logger.log(LogStatus.PASS, "Id number search is successful");
                    logger.log(LogStatus.PASS,
                            "Id number search returned the correct account number, the one which we updated now");
                    scpath = Generic_Class.takeScreenShotPath();
                    image = logger.addScreenCapture(scpath);
                    logger.log(LogStatus.INFO, "Image", image);
                } else {
                    logger.log(LogStatus.FAIL, "Id number search is successful");
                    logger.log(LogStatus.FAIL,
                            "Id number search returned the correct account number, the one which we updated now");
                    scpath = Generic_Class.takeScreenShotPath();
                    image = logger.addScreenCapture(scpath);
                    logger.log(LogStatus.INFO, "Image", image);
                    if (resultFlag.equals("pass"))
                        resultFlag = "fail";
                }
            } else {
                scpath = Generic_Class.takeScreenShotPath();
                image = logger.addScreenCapture(scpath);
                logger.log(LogStatus.FAIL, "ID Num not updated");
                logger.log(LogStatus.INFO, "Image", image);
                if (resultFlag.equals("pass"))
                    resultFlag = "fail";
            }
        } else {
            scpath = Generic_Class.takeScreenShotPath();
            image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.FAIL, "Navigated to a different customer dashboard");
            logger.log(LogStatus.INFO, "Image", image);
            if (resultFlag.equals("pass"))
                resultFlag = "fail";
        }
    } catch (Exception ex) {
        ex.printStackTrace();
        resultFlag = "fail";
        logger.log(LogStatus.FAIL, "Test script failed due to the exception " + ex);
    }

}

From source file:Scenarios.Payments.MakePayment_Individual_NewCustomer_MultipleSpaces_paythroughCheck.java

@Test(dataProvider = "getCustSearchData")
public void MakePayment_Individual_NewCustomer_MultipleSpaces_paythroughCheck(
        Hashtable<String, String> tabledata) throws InterruptedException {
    try {//from w  w  w  .j a  va2  s  .  c  o  m
        logger = extent.startTest("MakePayment_Individual_NewCustomer_MultipleSpaces_paythroughCheck",
                "MakePayment_Individual_NewCustomer_MultipleSpaces_paythroughCheck");
        Reporter.log("Test case started: " + testcaseName, true);

        if (!(tabledata.get("Runmode").equals("Y") && tabledata.get("Payments").equals("Y"))) {
            resultFlag = "skip";
            throw new SkipException("Skipping the test");
        }

        //Login To the Application
        LoginPage loginPage = new LoginPage(driver);
        loginPage.login(tabledata.get("UserName"), tabledata.get("Password"));
        logger.log(LogStatus.INFO, "Login to Application  successfully");

        Dashboard_BifrostHostPopUp Bifrostpop = new Dashboard_BifrostHostPopUp(driver);
        logger.log(LogStatus.INFO, "PopUp window object is created successfully");
        //Bifrostpop.clickContiDevice();
        Thread.sleep(10000);

        String biforstNum = Bifrostpop.getBiforstNo();

        Reporter.log(biforstNum + "", true);

        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, "t");
        ArrayList<String> tabs = new ArrayList<String>(driver.getWindowHandles());
        Reporter.log(tabs.size() + "", true);
        driver.switchTo().window(tabs.get(1));
        driver.get("http://wc2qa.ps.com/CustomerScreen/Mount");

        List<WebElement> biforstSystem = driver.findElements(
                By.xpath("//div[@class='scrollable-area']//span[@class='bifrost-label vertical-center']"));
        for (WebElement ele : biforstSystem) {
            if (biforstNum.equalsIgnoreCase(ele.getText().trim())) {
                Reporter.log(ele.getText() + "", true);
                ele.click();
                break;
            }
        }

        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        Thread.sleep(5000);
        driver.switchTo().window(tabs.get(0));
        driver.navigate().refresh();
        Thread.sleep(5000);
        driver.findElement(By.xpath(
                "//div[@id='cfsConnectionDialog']//div[@class='after-connected padding-top']//p/input[@class='psbutton-low-priority']"))
                .click();
        Thread.sleep(5000);

        //Verify that the user lands on the "PM Dashboard" screen after login and walkin cust title

        PM_Homepage pmhomepage = new PM_Homepage(driver);
        pmhomepage.clk_findAndLeaseSpace();
        Thread.sleep(10000);
        logger.log(LogStatus.PASS, "find and Lease a space btn is clicked successfully");

        StandardStoragePage stndstorage = new StandardStoragePage(driver);
        logger.log(LogStatus.INFO, "Standard Storage object created");

        stndstorage.click_SqFt50();
        stndstorage.click_SqFt100();
        stndstorage.click_SqFt150();
        Thread.sleep(5000);
        logger.log(LogStatus.PASS, "Selected desired spaces");

        stndstorage.click_Search();
        logger.log(LogStatus.PASS, "Clicked on Search button");
        Reporter.log("Clicked on Search button", true);
        Thread.sleep(10000);

        //============Fetching space number and based on that clicking the radio button========================
        JavascriptExecutor jse = (JavascriptExecutor) driver;
        List<WebElement> norows = driver.findElements(By.xpath(
                "//div[@id='onsiteUnitGrid']//div[@class='k-grid-content ps-container ps-active-y']//table//tbody//tr"));
        String space = null;
        if (norows.size() > 0) {
            Thread.sleep(10000);

            space = driver.findElement(By.xpath(
                    "//div[@id='onsiteUnitGrid']//div[@class='k-grid-content ps-container ps-active-y']//table//tbody//tr[1]/td[4]"))
                    .getText();
            Reporter.log("space number is:" + space, true);
        } else {

            logger.log(LogStatus.INFO, "Application is not populating any data/space details");

        }

        //String Space = "4008";
        WebElement RdBtn_Space = driver.findElement(By.xpath(
                "//td[@class='grid-cell-space'][text()='" + space + "']/../td/input[@name='selectedIds']"));
        logger.log(LogStatus.PASS,
                "check the radio button based on the space and click on the  reservation button");
        jse.executeScript("arguments[0].scrollIntoView()", RdBtn_Space);
        Thread.sleep(10000);
        jse.executeScript("arguments[0].click();", RdBtn_Space);

        logger.log(LogStatus.PASS, "Clicked on check box of a space in this location: " + space);
        Reporter.log("Clicked on check box of a space in this location: " + space, true);
        //generics.Page_ScrollDown();
        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");

        //====================================================================================

        SpaceDashboard_ThisLoc SpaceDashboard_ThisLoc = new SpaceDashboard_ThisLoc(driver);
        Thread.sleep(10000);
        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");
        SpaceDashboard_ThisLoc.click_Rent();
        Thread.sleep(6000);
        logger.log(LogStatus.PASS, "Clicked on Rent button");
        Reporter.log("Clicked on Rent button", true);

        Leasing_ConfirmSpace cnfmSpace = new Leasing_ConfirmSpace(driver);
        Thread.sleep(8000);

        //Add another space
        cnfmSpace.click_AddAnotherSpace();
        //Thread.sleep(10000);
        logger.log(LogStatus.PASS, "Clicked on Add another space  button");

        stndstorage.click_SqFt50();
        stndstorage.click_SqFt100();
        stndstorage.click_SqFt150();
        Thread.sleep(5000);
        logger.log(LogStatus.PASS, "Selected desired spaces");

        stndstorage.click_Search();
        logger.log(LogStatus.PASS, "Clicked on Search button");
        Reporter.log("Clicked on Search button", true);

        //====================================================================================
        List<WebElement> norows1 = driver.findElements(By.xpath(
                "//div[@class='onsite-list']//div[@class='k-grid-content ps-container ps-active-y']//table//tbody//tr"));
        String space1 = null;
        if (norows1.size() > 0) {
            Thread.sleep(10000);

            space1 = driver.findElement(By.xpath(
                    "//div[@class='onsite-list']//div[@class='k-grid-content ps-container ps-active-y']//table//tbody//tr[1]/td[4]"))
                    .getText();
            Reporter.log("space number is:" + space1, true);
        } else {

            logger.log(LogStatus.INFO, "Application is not populating any data/space details");

        }

        //String Space = "4008";
        WebElement RdBtn_Space1 = driver.findElement(By.xpath(
                "//td[@class='grid-cell-space'][text()='" + space1 + "']/../td/input[@name='selectedIds']"));
        logger.log(LogStatus.PASS,
                "check the radio button based on the space and click on the  reservation button");
        jse.executeScript("arguments[0].scrollIntoView()", RdBtn_Space1);
        Thread.sleep(10000);
        jse.executeScript("arguments[0].click();", RdBtn_Space1);

        logger.log(LogStatus.PASS, "Clicked on check box of a space in this location: " + space1);
        Reporter.log("Clicked on check box of a space in this location: " + space1, true);
        //generics.Page_ScrollDown();
        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");

        //======================================================================================
        Thread.sleep(10000);
        //jse.executeScript("window.scrollBy(0,1000)", "");
        EventFiringWebDriver eventFiringWebDriver = new EventFiringWebDriver(driver);
        eventFiringWebDriver.executeScript("document.getElementById('chooseSizeDialog').scrollTop =300");
        //Thread.sleep(5000);
        /*swapVechpage.clk_btn_SwapSpace();
        logger.log(LogStatus.INFO, "clicking on the swap space button");*/
        Thread.sleep(8000);
        driver.findElement(
                By.xpath("//div[@class='OnSite unit-grid-section clearfix']//a[@id='addSpaceButton']")).click();
        logger.log(LogStatus.PASS, "Clicked on Add space  button");

        Thread.sleep(10000);
        cnfmSpace.click_space_radiobtn1();
        Thread.sleep(1000);
        logger.log(LogStatus.PASS, "selected first space");
        //==============================================================

        cnfmSpace.clk_ConfirmwtCust();
        Thread.sleep(10000);

        logger.log(LogStatus.PASS, "Clicked on confirm with customer button");
        Reporter.log("Clicked on confirm with customer button", true);

        //switching to customer screen
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.PASS, "Switching  to customer  screen");
        Reporter.log("Switching  to customer screen", true);
        Thread.sleep(10000);

        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");
        WebElement confirmBtn = driver.findElement(
                By.xpath("//div[@class='footer-row clearfix-container']/button[@id='confirmButton']"));
        Thread.sleep(10000);
        confirmBtn.click();
        logger.log(LogStatus.PASS, "Clicked on confirm  button");
        Reporter.log("Clicked on confirm button", true);
        Thread.sleep(10000);

        //switching back to wc2 tab
        driver.switchTo().window(tabs.get(0));
        Thread.sleep(5000);
        logger.log(LogStatus.PASS, "Switching back to PM  screen");
        Reporter.log("Switching back to PM  screen", true);

        //Filling contact information

        Leasing_ContactInfoPage contactinfo = new Leasing_ContactInfoPage(driver);
        Thread.sleep(5000);
        //String FN = "AUT" + generics.get_RandmString();
        contactinfo.txt_Fname(tabledata.get("Firstname"));
        //contactinfo.txt_Fname(FN);
        contactinfo.txt_Lname(tabledata.get("LastName"));
        contactinfo.clickContact_State();
        List<WebElement> allstates = driver.findElements(
                By.xpath("//ul[@id='ContactForm_Identification_StateTypeID_listbox']/li[@class='k-item']"));

        //Identify the WebElement which will appear after scrolling down

        for (WebElement state : allstates) {
            Thread.sleep(2000);
            if (tabledata.get("StateCode").equalsIgnoreCase(state.getText())) {
                state.click();
                break;
            }
        }

        //contactinfo.select_State(tabledata.get("StateCode"));
        contactinfo.txt_Number(tabledata.get("DrivingLicenseNum"));
        contactinfo.txt_street1(tabledata.get("Street"));
        contactinfo.txt_city(tabledata.get("City"));

        contactinfo.select_State2address();
        List<WebElement> allstatesadd = driver
                .findElements(By.xpath("//ul[@id='lesseeinfo-address-statecode_listbox']/li[@class='k-item']"));

        for (WebElement state : allstatesadd) {
            Thread.sleep(2000);
            if (tabledata.get("StateCode").equalsIgnoreCase(state.getText())) {
                state.click();
                break;
            }
        }

        //contactinfo.select_State2(tabledata.get("State"));
        Thread.sleep(3000);
        contactinfo.txt_Zipcode(tabledata.get("Zipcode"));
        contactinfo.select_phoneType1();
        Thread.sleep(3000);
        /*List<WebElement> phonTypes1= driver.findElements(By.xpath("//ul[@id='ContactForm_LesseePhones[_-index-__0]_Phone_PhoneTypeID_listbox')]//li[@class='k-item']"));  //div[@id='ContactForm_LesseePhones[_-index-__0]_Phone_PhoneTypeID-list']
        System.out.println(phonTypes1.size());
        for(WebElement type: phonTypes1)
        {
           System.out.println(type.getText());
           System.out.println(tabledata.get("PhoneType"));
           Thread.sleep(3000);
           if(tabledata.get("PhoneType").contains(type.getText().trim()))
           {
              type.click();
              break;
           }
        }*/
        driver.findElement(
                By.xpath("//ul[@class='k-list k-reset ps-container ps-active-y']/li[contains(text(), '"
                        + tabledata.get("PhoneType") + " ')]"))
                .click();
        Thread.sleep(2000);
        contactinfo.txt_AreaCode(tabledata.get("Areacode"));
        Thread.sleep(2000);
        contactinfo.txt_Exchg(tabledata.get("Exchange"));
        Thread.sleep(2000);
        contactinfo.txt_lineNumber(tabledata.get("LineNumber"));
        Thread.sleep(2000);
        contactinfo.txt_email(tabledata.get("Email"));
        Thread.sleep(2000);
        contactinfo.click_CustLookUp();

        Thread.sleep(15000);
        // Click on New Customer button on Choose an Account PopUp
        driver.findElement(By.linkText("Create New Customer")).click();

        // Select "No" Radio button for Military
        Thread.sleep(8000);
        driver.findElement(By.xpath("//label[@id='currently-military-false']/span[1]")).click();

        // Click on Verify button
        Thread.sleep(5000);
        driver.findElement(By.partialLinkText("Verify")).click();

        Thread.sleep(8000);
        if (contactinfo.verify_overrideAddress_Select()) {
            contactinfo.click_overrideAddress_Select();
        } else if (contactinfo.verify_overridePhone_Select()) {
            contactinfo.click_overridePhone_Select();
        }

        Thread.sleep(5000);
        driver.findElement(By.id("confirmWithCustomerButton")).click();

        Thread.sleep(5000);
        //Click on Confirm with Cust button

        logger.log(LogStatus.INFO, "clicking on Confirm with cust button successfully");

        // Navigating to Customer screen
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        Thread.sleep(8000);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully");

        Thread.sleep(6000);
        driver.findElement(By.id("confirmButton")).click();
        logger.log(LogStatus.INFO, "clicking on Confirm button successfully");

        Thread.sleep(5000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        driver.switchTo().window(tabs.get(0));
        logger.log(LogStatus.INFO, "Switch to Main page successfully");

        //Declines to provide Emergency contact info
        EmergencyContactData con = new EmergencyContactData(driver);
        Thread.sleep(4000);
        con.click_decline_EmgcyContact();
        logger.log(LogStatus.PASS, "Clicked on checkbox-decline to give Emergency contact");
        Reporter.log("Clicked on checkbox-decline to give Emergency contact", true);
        Thread.sleep(6000);

        con.btn_confirmWithCust();
        Thread.sleep(5000);
        logger.log(LogStatus.PASS, "Clicked on confirm with customer button");
        Reporter.log("Clicked on confirm with customer button", true);

        //switching to customer screen
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.PASS, "Switching  to customer  screen");
        Reporter.log("Switching  to customer screen", true);
        Thread.sleep(5000);

        WebElement confirmBtn3 = driver.findElement(
                By.xpath("//div[@class='footer-row clearfix-container']/button[@id='confirmButton']"));
        confirmBtn3.click();
        logger.log(LogStatus.PASS, "Clicked on confirm  button");
        Reporter.log("Clicked on confirm button", true);
        Thread.sleep(10000);

        //switching back to wc2 tab
        driver.switchTo().window(tabs.get(0));
        Thread.sleep(5000);
        logger.log(LogStatus.PASS, "Switching back to PM  screen");
        Reporter.log("Switching back to PM  screen", true);

        Authorized_Access_Contacts auth = new Authorized_Access_Contacts(driver);
        auth.clk_savebutton();
        Thread.sleep(10000);
        logger.log(LogStatus.PASS, "Clicked on save and proceed button successfully");
        Reporter.log("Clicked on save and proceed button successfully", true);

        //verifying Amount data
        Leasing_EligiblePromotionsPage promo = new Leasing_EligiblePromotionsPage(driver);
        promo.clickSavenProceed();
        logger.log(LogStatus.PASS, "Clicked on save and proceed button successfully");
        Reporter.log("Clicked on save and proceed button successfully", true);
        Thread.sleep(8000);

        Leasing_LeaseQuestionairePage leaseQues = new Leasing_LeaseQuestionairePage(driver);

        leaseQues.clickStorageContent();

        Thread.sleep(5000);

        List<WebElement> allstorage = driver.findElements(By.xpath(
                "//ul[@id='LeaseQuestionnaireUnits_0__RentalUnitContentsTypeID_listbox']//li[@class='k-item']"));

        for (WebElement storage : allstorage) {
            if ((tabledata.get("StorageContent")).equalsIgnoreCase(storage.getText())) {
                storage.click();
                break;
            }
        }

        //Insurance is ON

        Thread.sleep(5000);
        leaseQues.clickAddInsuranceNo();
        logger.log(LogStatus.INFO, "clicked No Insurance");

        Thread.sleep(10000);
        leaseQues.clickAccessZone();

        Thread.sleep(10000);

        List<WebElement> allAccessZone = driver.findElements(By.xpath(
                "//ul[@id='LeaseQuestionnaireUnits_0__GateControllerTimeZoneID_listbox']//li[@class='k-item']"));
        // String acsZone ="01-Normal-24HR";
        for (WebElement accessZone : allAccessZone) {
            if ((tabledata.get("AccessZone")).equalsIgnoreCase(accessZone.getText())) {
                accessZone.click();
                break;
            }
        }

        Thread.sleep(10000);

        /*List<WebElement> allKaypadZone= driver.findElements(By.xpath("//ul[@id='LeaseQuestionnaireUnits_0__KeypadZone_listbox']//li[@class='k-item']"));
                
             //String keyZone="0- Gate 1";
                
             for(WebElement keypadZone: allKaypadZone)
             {
                    if((tabledata.get("KeypadZone")).equalsIgnoreCase(keypadZone.getText()))
                
                    {
                           keypadZone.click();
                           break;
                    }
             }*/

        leaseQues.clickKeypadZone();
        Thread.sleep(3000);
        List<WebElement> allKaypadZone = driver.findElements(By.xpath(
                "//ul[@id='LeaseQuestionnaireUnits_0__KeypadZone_listbox']/li[contains(@id,'KeypadZone_option_selected')]/following-sibling::li"));
        for (WebElement keypadZone : allKaypadZone) {
            if (keypadZone.getText().contains("0 - Gate 1")) {
                keypadZone.click();
                break;
            }
        }

        Thread.sleep(10000);
        leaseQues.clickConfirmCust();

        // switching to customer screen
        logger.log(LogStatus.PASS, "Clicked on Confirm with Customer button");
        Reporter.log("Clicked on Confirm with Customer button", true);

        Thread.sleep(2000);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.PASS, "Switched to Customer Screen");
        Reporter.log("Switched to Customer Screen", true);

        driver.findElement(
                By.xpath("//div[@class='footer-row clearfix-container']/button[@id='confirmButton']")).click();
        logger.log(LogStatus.PASS, "Clicked on Confirm button in customer screen");
        Reporter.log("Clicked on Confirm button in customer screen", true);

        Thread.sleep(12000);
        List<WebElement> allCheckbox = driver.findElements(
                By.xpath("//section[@class='term-group term-group--active']//input[@type='checkbox']"));

        for (WebElement checkbox : allCheckbox) {
            checkbox.click();
        }
        Thread.sleep(5000);
        driver.findElement(By.id("confirmButton")).click();

        Thread.sleep(3000);
        WebElement signature = driver.findElement(
                By.xpath("//div[@class='sig sigWrapper']/canvas[@class='pad js-signature-canvas']"));
        Actions actionBuilder = new Actions(driver);
        Action drawAction = actionBuilder.moveToElement(signature, 660, 96).click().clickAndHold(signature)
                .moveByOffset(120, 120).moveByOffset(60, 70).moveByOffset(-140, -140).release(signature)
                .build();
        drawAction.perform();

        Thread.sleep(4000);
        driver.findElement(By.id("confirmButton")).click();
        Thread.sleep(5000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        Thread.sleep(6000);
        driver.switchTo().window(tabs.get(0));

        Leasing_ReviewNApprovePage review = new Leasing_ReviewNApprovePage(driver);

        Thread.sleep(8000);
        review.clickApprove_btn();

        Thread.sleep(8000);
        review.clickSaveproceed_btn();

        Leasing_RentalFeePage rentalfee = new Leasing_RentalFeePage(driver);

        Thread.sleep(15000);
        logger.log(LogStatus.PASS, "Validating Monthly rent and Promotions in Eligible Promotion Page");

        rentalfee.clickConfirmCust_btn();
        Thread.sleep(8000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully");

        Thread.sleep(6000);
        driver.findElement(By.id("confirmButton")).click();
        logger.log(LogStatus.INFO, "clicking on Confirm button successfully");

        Thread.sleep(5000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        driver.switchTo().window(tabs.get(0));
        logger.log(LogStatus.INFO, "Switch to Main page successfully");
        Thread.sleep(8000);

        Leasing_PaymentMethodsPage payment = new Leasing_PaymentMethodsPage(driver);
        Thread.sleep(2000);
        payment.clickPaymenetList();
        logger.log(LogStatus.INFO, "Clicked on payment clk_PayThroughdropdwn dropdown ");
        Thread.sleep(2000);

        List<WebElement> lst = driver.findElements(By.xpath("//div[@class='k-animation-container']//ul//li"));
        Reporter.log("The size is:" + lst.size(), true);
        int Size = lst.size();
        for (int i = 0; i < Size; i++) {
            if (i == 1) {
                lst.get(i).click();
                break;
            }
        }

        // switching to customer screen
        logger.log(LogStatus.PASS, "Clicked on Confirm with Customer button");
        Reporter.log("Clicked on Confirm with Customer button", true);

        Thread.sleep(2000);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.PASS, "Switched to Customer Screen");
        Reporter.log("Switched to Customer Screen", true);

        driver.findElement(
                By.xpath("//div[@class='footer-row clearfix-container']/button[@id='confirmButton']")).click();
        logger.log(LogStatus.PASS, "Clicked on Confirm button in customer screen");
        Reporter.log("Clicked on Confirm button in customer screen", true);

        Thread.sleep(2000);
        driver.switchTo().window(tabs.get(0));
        logger.log(LogStatus.PASS, "Switching back to PM screen");
        Reporter.log("Switching back to PM screen", true);

        // switched back to Main screen

        payment.clickPaymenetList();
        Thread.sleep(3000);

        driver.findElement(By.xpath(
                "//div[@class='k-list-container k-popup k-group k-reset k-state-border-down']/ul/li[text()='Check']"))
                .click();
        logger.log(LogStatus.PASS, "selected check option option");

        Thread.sleep(6000);
        payment.clickmanualentry();
        logger.log(LogStatus.INFO, "Clicking on Manual entry button successfully");

        payment.Enter_routingNumber(tabledata.get("CheckRoutingNum"));
        logger.log(LogStatus.INFO, "Entering routing Number successfully");

        payment.Enter_accountNumber(tabledata.get("CheckAccNum"));
        logger.log(LogStatus.INFO, "Entering Account Number successfully");

        payment.Enter_checkNumber(tabledata.get("CheckNum"));
        logger.log(LogStatus.INFO, "Entering Check Number successfully");

        Thread.sleep(5000);
        String amount = driver
                .findElement(By.xpath(
                        "//div[text()='Total Remaining']/following-sibling::div[@ class='payment-row__now']"))
                .getText();

        Thread.sleep(5000);
        payment.enterAmount(amount);

        //payment.Enter_checkAmount(tabledata.get("CheckAmount"));
        logger.log(LogStatus.INFO, "Entering Check amount successfully");

        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");
        Thread.sleep(6000);
        payment.Select_autopaycheckbox();
        logger.log(LogStatus.INFO, "Select Auto pay enable checkbox successfully");

        payment.clickApply_btn();
        Thread.sleep(5000);

        Thread.sleep(6000);
        payment.click_CollectSignature();
        logger.log(LogStatus.INFO, "Click on Collect signature button successfully");

        Thread.sleep(6000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully");
        Thread.sleep(6000);

        WebElement signature1 = driver
                .findElement(By.xpath("//div[@class='signature-area']/canvas[@class='signature-pad']"));
        Actions actionBuilder1 = new Actions(driver);
        Action drawAction1 = actionBuilder1.moveToElement(signature1, 660, 96).click().clickAndHold(signature1)
                .moveByOffset(120, 120).moveByOffset(60, 70).moveByOffset(-140, -140).release(signature1)
                .build();
        drawAction1.perform();
        Thread.sleep(6000);
        payment.clickAccept_Btn();
        logger.log(LogStatus.INFO, "Cust Signature and click on Accept button successfully");

        Thread.sleep(6000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        driver.switchTo().window(tabs.get(0));

        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");
        Thread.sleep(10000);
        payment.clickApprove_Btn();
        logger.log(LogStatus.INFO, "Click on Approve button successfully");

        Thread.sleep(6000);
        payment.clickSubmit_btn();
        logger.log(LogStatus.INFO, "Click on Submit button successfully");

        driver.findElement(By.id("employeeNumber")).sendKeys("930326");
        Thread.sleep(2000);
        driver.findElement(By.partialLinkText("Ok")).click();
        Thread.sleep(2000);

        Thread.sleep(5000);
        if (driver.findElement(By.xpath("//a[contains(text(),'No')]")).isDisplayed()) {
            driver.findElement(By.xpath("//a[contains(text(),'No')]")).click();
        } else if (driver.findElement(By.xpath("//a[contains(text(),'Ok')]")).isDisplayed()) {
            driver.findElement(By.xpath("//a[contains(text(),'Ok')]")).click();

        }

        Thread.sleep(15000);

        pmhomepage.clk_AdvSearchLnk();

        Thread.sleep(8000);
        Advance_Search advSearch = new Advance_Search(driver);

        String sqlQuery = "selectaccountidfromaccountwherecustomerid=(selectcustomeridfromcustomerwherecontactid=(selectcontactidfromcontactwherefirstname='"
                + tabledata.get("FirstName") + "'andlastname='" + tabledata.get("LastName") + "'))";

        String accNUm = DataBase_JDBC.executeSQLQuery(sqlQuery);

        advSearch.enterAccNum(accNUm);

        //advSearch.enterAccNum("45226383");
        Thread.sleep(5000);
        logger.log(LogStatus.INFO, "Entered acc num successfully");
        advSearch.clickSearchAccbtn();
        logger.log(LogStatus.INFO, "Click on search button successfully");

        Thread.sleep(8000);

        Cust_AccDetailsPage cust_accdetails = new Cust_AccDetailsPage(driver);
        String toatlDueNowAmtAfterMakePymt = cust_accdetails.getTotalDueNow();
        logger.log(LogStatus.PASS, "Total due now amount after making payment in customer dashbaord is:"
                + toatlDueNowAmtAfterMakePymt);

        Thread.sleep(1000);
        //String nextPymtDueAmtAftermakePymt=cust_accdetails.get_NextPymtDueAmount();
        //logger.log(LogStatus.PASS, "Next Payment due amount after making payment is:"+nextPymtDueAmtAftermakePymt);

        cust_accdetails.clk_Acc_ActivitiesTab();
        logger.log(LogStatus.INFO, "Click on Account activities tab successfully");
        Thread.sleep(10000);

        cust_accdetails.clk_CheckExpandLink();
        logger.log(LogStatus.INFO, "Clicked on expand button in first row");

        Thread.sleep(6000);

        cust_accdetails.clk_ReversePaymntLnk();
        logger.log(LogStatus.INFO, "Clicked on Reverse Payment link");

        Thread.sleep(8000);
        ReversePaymentPage ReversePayment = new ReversePaymentPage(driver);
        boolean rev = driver.findElement(By.xpath("//h3[contains(text(),'Reverse Payment')]")).isDisplayed();
        if (rev) {
            String scpath = Generic_Class.takeScreenShotPath();
            String image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.PASS, "Reverse Payment screen is displayed successfully");
            logger.log(LogStatus.INFO, "Reverse Payment screen is displayed successfully", image);
        } else {

            if (resultFlag.equals("pass"))
                resultFlag = "fail";

            String scpath = Generic_Class.takeScreenShotPath();
            String image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.FAIL, "Reverse Payment screen is not displayed ");
            logger.log(LogStatus.INFO, "Reverse Payment screen is not displayed ", image);

        }

        //ReversePayment.Clk_RdBtn_Yes();
        //logger.log(LogStatus.INFO, "Clicked on No radio button");

        ReversePayment.clickReason();
        logger.log(LogStatus.INFO, "Clicked on Reason drop down");

        //ReversePayment.SelectValueFromReasonList("Misapplied Payment");
        ReversePayment.SelectValueFromReasonListeason();

        logger.log(LogStatus.INFO, "Select value from Reason dropdown");

        ReversePayment.enter_Note(
                "PM received a Bad check from bank for a customer payment so reversing the payment");
        logger.log(LogStatus.INFO, "Entered note");

        ReversePayment.click_ReverseBtn();
        logger.log(LogStatus.INFO, "Clicked on Reverse button");

        Thread.sleep(6000);

        TransactionReversedPage trnspage = new TransactionReversedPage(driver);
        trnspage.enter_EmployeeId(tabledata.get("UserName"));
        logger.log(LogStatus.INFO, "Entered EmployeeID");

        Thread.sleep(3000);
        trnspage.click_OkBtn();
        logger.log(LogStatus.INFO, "Clicked on OK button");

        Thread.sleep(6000);
        if (cust_accdetails.isCustdbTitleDisplayed()) {

            logger.log(LogStatus.PASS, "customer Dashboard is displayed successfully");

        } else {

            if (resultFlag.equals("pass"))
                resultFlag = "fail";

            logger.log(LogStatus.FAIL, "customer Dashboard is not displayed ");

        }

        Thread.sleep(1000);
        String toatlDueNowAmtAfterReversePymt = cust_accdetails.getTotalDueNow();
        logger.log(LogStatus.PASS, "Total due now amount after reverse payment in customer dashbaord is:"
                + toatlDueNowAmtAfterReversePymt);

        Thread.sleep(1000);
        //String nextPymtDueAmtAfterReversePymt=cust_accdetails.get_NextPymtDueAmount();
        //logger.log(LogStatus.PASS, "Next Payment due amount after reverse payment is:"+nextPymtDueAmtAfterReversePymt);

        /*if(toatlDueNowAmtAfterReversePymt.equals(toatlDueNowAmtBeforeMakePymt)){
                
           String scpath=Generic_Class.takeScreenShotPath();
           String image=logger.addScreenCapture(scpath);
           logger.log(LogStatus.PASS, "Total due now amount before making and after reversing the payment is same and changes data are reflecting properly in Customer Dashboard sucessfully");
           logger.log(LogStatus.INFO, "Total due now amount before making and after reversing the payment is same and changes data are reflecting properly in Customer Dashboard sucessfully",image);
                
        }else{
                
           if(resultFlag.equals("pass"))
          resultFlag="fail";
                
           String scpath=Generic_Class.takeScreenShotPath();
           String image=logger.addScreenCapture(scpath);
           logger.log(LogStatus.FAIL, "Total due now amount before making and after reversing the payment is not same and changes data are not reflecting properly in Customer Dashboard ");
           logger.log(LogStatus.INFO, "Total due now amount before making and after reversing the payment is not same and changes data are not reflecting properly in Customer Dashboard ",image);
                
        }*/

    } catch (Exception ex) {
        ex.printStackTrace();
        resultFlag = "fail";
        Reporter.log("Exception ex: " + ex, true);
        logger.log(LogStatus.FAIL, "Test Script fail due to exception");
    }

}

From source file:Scenarios.Payments.MakePayment_WithInsurance.java

@Test(dataProvider = "getLoginData")
public void Leasing_LeaseWithInsurance(Hashtable<String, String> tabledata) throws Exception {

    if (!(tabledata.get("Runmode").equals("Y") && tabledata.get("Leasing").equals("Y"))) {
        resultFlag = "skip";
        logger.log(LogStatus.SKIP, "Leasing_LeaseWithInsurance is Skipped");
        throw new SkipException("Skipping the test Leasing_LeaseWithInsurance");
    }/*from  w w  w . j  av  a  2s  .com*/

    Reporter.log("Test Case Started", true);
    Thread.sleep(5000);

    try {
        logger = extent.startTest("Leasing_LeaseWithInsurance", "Lease with insurance");
        testcaseName = tabledata.get("TestCases");
        Reporter.log("Test case started: " + testcaseName, true);
        Thread.sleep(5000);
        JavascriptExecutor jse = (JavascriptExecutor) driver;
        LoginPage loginPage = new LoginPage(driver);
        logger.log(LogStatus.PASS, "creating object for the Login Page sucessfully ");
        Thread.sleep(2000);
        loginPage.enterUserName(tabledata.get("UserName"));
        Thread.sleep(2000);
        logger.log(LogStatus.PASS, "entered username sucessfully");
        Thread.sleep(2000);
        loginPage.enterPassword(tabledata.get("Password"));
        logger.log(LogStatus.PASS, "entered password sucessfully");
        Thread.sleep(2000);
        loginPage.clickLogin();
        logger.log(LogStatus.PASS, "clicked on login in button sucessfully");
        logger.log(LogStatus.PASS, "Login to Application  successfully");

        // =================Handling customer facing device========================
        Thread.sleep(5000);
        Dashboard_BifrostHostPopUp Bifrostpop = new Dashboard_BifrostHostPopUp(driver);
        logger.log(LogStatus.INFO, "PopUp window object is created successfully");
        String biforstNum = Bifrostpop.getBiforstNo();

        Reporter.log(biforstNum + "", true);

        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, "t");
        ArrayList<String> tabs = new ArrayList<String>(driver.getWindowHandles());
        Reporter.log(tabs.size() + "", true);
        driver.switchTo().window(tabs.get(1));
        driver.get(Generic_Class.getPropertyValue("CustomerScreenPath"));

        List<WebElement> biforstSystem = driver.findElements(
                By.xpath("//div[@class='scrollable-area']//span[@class='bifrost-label vertical-center']"));
        for (WebElement ele : biforstSystem) {
            if (biforstNum.equalsIgnoreCase(ele.getText().trim())) {
                Reporter.log(ele.getText() + "", true);
                ele.click();
                break;
            }
        }

        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        Thread.sleep(5000);
        driver.switchTo().window(tabs.get(0));
        Thread.sleep(5000);
        driver.findElement(By.xpath(
                "//div[@id='cfsConnectionDialog']//div[@class='after-connected padding-top']//p/input[@class='psbutton-low-priority']"))
                .click();
        Thread.sleep(5000);
        // =================================================================================
        Thread.sleep(3000);
        PM_Homepage pmhomepage = new PM_Homepage(driver);
        logger.log(LogStatus.PASS, "creating object for the PM home page sucessfully");
        if (pmhomepage.get_WlkInCustText().trim().contains("Walk-In Customer")) {

            String scpath = Generic_Class.takeScreenShotPath();
            String image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.PASS, "Walk in customer window displayed sucessfully");
            logger.log(LogStatus.INFO, "Walk in customer window displayed sucessfully", image);

        } else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";

            String scpath = Generic_Class.takeScreenShotPath();
            String image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.FAIL, "Walk in customer window is not displayed");
            logger.log(LogStatus.INFO, "Walk in customer window is not displayed", image);

        }
        if (pmhomepage.isFindAndLeaseButtonDisplayed()) {
            logger.log(LogStatus.PASS,
                    "Find and Lease button displayed sucessfully on Walk in customer window");
        } else {

            logger.log(LogStatus.FAIL,
                    "Find and Lease button is not displayed sucessfully on Walk in customer window");
        }

        if (pmhomepage.isFindAnExtReservationTextFieldDisplayed()) {

            logger.log(LogStatus.PASS,
                    "Or Find an Existing Reservation text field is dispalyed sucessfully on Walk in customer window");
        } else {

            logger.log(LogStatus.FAIL,
                    "Or Find an Existing Reservation text field is not dispalyed sucessfully on Walk in customer window");
        }

        if (pmhomepage.isFindReservationDispalyed()) {

            logger.log(LogStatus.PASS,
                    "Find reservation button is dispalyed sucessfully on Walk in customer window");
        } else {

            logger.log(LogStatus.FAIL,
                    "Find reservation button is not dispalyed sucessfully on Walk in customer window");
        }
        pmhomepage.clk_findAndLeaseSpace();
        logger.log(LogStatus.INFO, "Click on Find And Lease Space Link successfully");

        Thread.sleep(4000);
        StandardStoragePage stdStorage = new StandardStoragePage(driver);
        logger.log(LogStatus.PASS, "Creating object for the Standard stroage page sucessfully");
        Thread.sleep(1000);
        if (stdStorage.isSelected_yesradiobutton()) {

            logger.log(LogStatus.PASS,
                    "New Customer Radio button selected by default when WALK-INS: FIND A SPACE page is launched sucessfully");

        } else {

            logger.log(LogStatus.FAIL,
                    "New Customer Radio button is not selected by default when WALK-INS: FIND A SPACE page is launched sucessfully");
        }

        stdStorage.Clk_ChkBx_AvlSpace();
        logger.log(LogStatus.PASS,
                "Clicked on available bold space size  checkbox in StandardStorage sucessfully");

        stdStorage.click_Search();
        logger.log(LogStatus.INFO, "Click on search button successfully");

        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");

        // =====================Fetching space number and based on that clicking the radio button========================
        Thread.sleep(10000);
        List<WebElement> norows = driver
                .findElements(By.xpath("//form[@id='frmReserveUnits']//div//table/tbody/tr"));
        String space = null;
        logger.log(LogStatus.INFO, "Total number of avaiable sizes count is------>:" + norows.size());
        if (norows.size() > 0) {
            Thread.sleep(5000);

            space = driver.findElement(By.xpath("//form[@id='frmReserveUnits']//div//table/tbody/tr[1]/td[4]"))
                    .getText();

            Reporter.log("space number is:" + space, true);
        } else {

            logger.log(LogStatus.FAIL,
                    "Application is not populating any data/space details with selected size dimension");
            throw new Exception("Application is not populating any data/space details");

        }
        Thread.sleep(2000);
        WebElement RdBtn_Space = driver.findElement(By.xpath(
                "//td[@class='grid-cell-space'][text()='" + space + "']/../td/input[@name='selectedIds']"));
        logger.log(LogStatus.PASS,
                "check the radio button based on the space and click on the  reservation button");
        Thread.sleep(5000);
        jse.executeScript("arguments[0].scrollIntoView()", RdBtn_Space);
        jse.executeScript("arguments[0].click();", RdBtn_Space);

        logger.log(LogStatus.PASS, "Clicked on check box of a space in this location:-------> " + space);
        Reporter.log("Clicked on check box of a space in this location: " + space, true);
        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");
        Thread.sleep(3000);
        SpaceDashboard_ThisLoc thisloc = new SpaceDashboard_ThisLoc(driver);
        logger.log(LogStatus.PASS, "creating object for the This location page sucessfully");
        thisloc.click_Rent();
        logger.log(LogStatus.PASS, "clicked on the rent button sucessfully");
        Thread.sleep(5000);

        Leasing_ConfirmSpace confirmSpace = new Leasing_ConfirmSpace(driver);
        Thread.sleep(5000);
        confirmSpace.clk_ConfirmwtCust();

        logger.log(LogStatus.PASS, "Clicked on Confirm with Customer button");
        Reporter.log("Clicked on Confirm with Customer button", true);

        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        Thread.sleep(5000);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.PASS, "Switched to Customer Screen");
        Reporter.log("Switched to Customer Screen", true);
        Thread.sleep(9000);
        String monthlyRent = driver
                .findElement(By.xpath("//table[@class='spaces']/tbody//tr//td[@class='monthly-rent']"))
                .getText();

        driver.findElement(
                By.xpath("//div[@class='footer-row clearfix-container']/button[@id='confirmButton']")).click();
        logger.log(LogStatus.PASS, "Clicked on Confirm button in customer screen");
        Reporter.log("Clicked on Confirm button in customer screen", true);

        Thread.sleep(8000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        driver.switchTo().window(tabs.get(0));
        logger.log(LogStatus.PASS, "Switching back to screen");
        Reporter.log("Switching back to screen", true);

        // Filling contact information

        Leasing_ContactInfoPage contactinfo = new Leasing_ContactInfoPage(driver);
        Thread.sleep(5000);
        String FN = "AUT" + Generic_Class.get_RandmString();
        contactinfo.txt_Fname(FN);
        contactinfo.txt_Lname(tabledata.get("LastName"));
        contactinfo.clickContact_State();
        List<WebElement> allstates = driver.findElements(
                By.xpath("//ul[@id='ContactForm_Identification_StateTypeID_listbox']/li[@class='k-item']"));

        // Identify the WebElement which will appear after scrolling down

        for (WebElement state : allstates) {
            Thread.sleep(2000);
            if (tabledata.get("StateCode").equalsIgnoreCase(state.getText())) {
                state.click();
                break;
            }
        }

        // contactinfo.select_State(tabledata.get("StateCode"));
        contactinfo.txt_Number(tabledata.get("DrivingLicenseNum"));
        contactinfo.txt_street1(tabledata.get("Street"));
        contactinfo.txt_city(tabledata.get("City"));

        contactinfo.select_State2address();
        List<WebElement> allstatesadd = driver
                .findElements(By.xpath("//ul[@id='lesseeinfo-address-statecode_listbox']/li[@class='k-item']"));

        for (WebElement state : allstatesadd) {
            Thread.sleep(2000);
            if (tabledata.get("StateCode").equalsIgnoreCase(state.getText())) {
                state.click();
                break;
            }
        }

        // contactinfo.select_State2(tabledata.get("State"));
        Thread.sleep(3000);
        contactinfo.txt_Zipcode(tabledata.get("Zipcode"));
        contactinfo.select_phoneType1();
        Thread.sleep(3000);

        driver.findElement(
                By.xpath("//ul[@class='k-list k-reset ps-container ps-active-y']/li[contains(text(),'"
                        + tabledata.get("PhoneType") + " ')]"))
                .click();
        Thread.sleep(2000);
        contactinfo.txt_AreaCode(tabledata.get("Areacode"));
        Thread.sleep(2000);
        contactinfo.txt_Exchg(tabledata.get("Exchange"));
        Thread.sleep(2000);
        contactinfo.txt_lineNumber(tabledata.get("LineNumber"));
        Thread.sleep(2000);
        contactinfo.txt_email(tabledata.get("Email"));
        Thread.sleep(2000);
        contactinfo.click_CustLookUp();

        Thread.sleep(15000);
        // Click on New Customer button on Choose an Account PopUp
        driver.findElement(By.linkText("Create New Customer")).click();

        Thread.sleep(8000);
        contactinfo.clk_ActiveDutyMilitaryNoRadioBtn(driver);

        // Click on Verify button
        Thread.sleep(5000);
        driver.findElement(By.partialLinkText("Verify")).click();
        logger.log(LogStatus.INFO, "cliked on the Verify button button ");

        Thread.sleep(9000);
        driver.findElement(By.id("confirmWithCustomerButton")).click();

        Thread.sleep(5000);
        // Click on Confirm with Cust button

        logger.log(LogStatus.INFO, "clicking on Confirm with cust button successfully");

        // Navigating to Customer screen
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        Thread.sleep(8000);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully");

        Thread.sleep(6000);
        driver.findElement(By.id("confirmButton")).click();
        logger.log(LogStatus.INFO, "clicking on Confirm button successfully");

        Thread.sleep(5000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        driver.switchTo().window(tabs.get(0));
        logger.log(LogStatus.INFO, "Switch to Main page successfully");

        // Entering Emergency Contact details
        Thread.sleep(5000);
        Leasing_EmergencyConatctsPage emergCon = new Leasing_EmergencyConatctsPage(driver);
        Thread.sleep(2000);

        emergCon.clickAuthorizedfor_radio();
        Thread.sleep(2000);
        emergCon.click_custDeclines_chkBox();

        emergCon.clickconfirmWithCust();
        Thread.sleep(4000);

        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        Thread.sleep(8000);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully");

        Thread.sleep(8000);
        driver.findElement(By.id("confirmButton")).click();
        logger.log(LogStatus.INFO, "clicking on Confirm button successfully");

        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        Thread.sleep(2000);
        driver.switchTo().window(tabs.get(0));
        logger.log(LogStatus.INFO, "Switch to Main page successfully");

        Leasing_AuthorizedAccessContactsPage autContact = new Leasing_AuthorizedAccessContactsPage(driver);

        Thread.sleep(8000);
        autContact.clickSavenProceed();

        Thread.sleep(8000);
        Leasing_EligiblePromotionsPage eligpromo = new Leasing_EligiblePromotionsPage(driver);

        logger.log(LogStatus.PASS, "Validating Monthly rent and Promotions in Eligible Promotion Page");

        eligpromo.clickSavenProceed();

        Thread.sleep(8000);

        Leasing_LeaseQuestionairePage leaseQues = new Leasing_LeaseQuestionairePage(driver);

        leaseQues.clickStorageContent();

        Thread.sleep(5000);

        List<WebElement> allstorage = driver.findElements(By.xpath(
                "//ul[@id='LeaseQuestionnaireUnits_0__RentalUnitContentsTypeID_listbox']//li[@class='k-item']"));

        for (WebElement storage : allstorage) {
            if (tabledata.get("StorageContent").equalsIgnoreCase(storage.getText())) {
                storage.click();
                break;
            }
        }

        // Insurance is ON

        Thread.sleep(5000);
        if (leaseQues.isInsuranceYesRadioBtnDisplayed()) {
            String scpath = Generic_Class.takeScreenShotPath();
            String image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.PASS, "Add insurance option available in the page");
            logger.log(LogStatus.INFO, "Add insurance option available in the page", image);

        } else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";

            String scpath = Generic_Class.takeScreenShotPath();
            String image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.FAIL, "Add insurance option is not there in the page");
            logger.log(LogStatus.INFO, "Add insurance option is not there in the page", image);

        }
        Thread.sleep(3000);
        leaseQues.clickAddInsuranceYes();
        logger.log(LogStatus.PASS, "Selecting Insurance yes Radio button to add insurnace");
        Thread.sleep(1000);
        leaseQues.clickCoverageList();
        Thread.sleep(5000);

        driver.findElement(By.xpath("//ul[@id='LeaseQuestionnaireUnits_0__InsuranceSelection_listbox']/li[2]"))
                .click();

        Thread.sleep(5000);

        leaseQues.clickAccessZone();
        Thread.sleep(2000);

        driver.findElement(
                By.xpath("//ul[@id='LeaseQuestionnaireUnits_0__GateControllerTimeZoneID_listbox']//li[2]"))
                .click();

        Thread.sleep(5000);
        leaseQues.clickKeypadZone();
        Thread.sleep(2000);
        driver.findElement(
                By.xpath("//li[contains(@id,'KeypadZone_option_selected')]/following-sibling::li[1]")).click();

        Thread.sleep(5000);
        leaseQues.clickConfirmCust();

        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        Thread.sleep(8000);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully");

        Thread.sleep(6000);
        driver.findElement(By.id("confirmButton")).click();
        logger.log(LogStatus.INFO, "clicking on Confirm button successfully");

        Thread.sleep(12000);
        List<WebElement> allCheckbox = driver.findElements(
                By.xpath("//section[@class='term-group term-group--active']//input[@type='checkbox']"));

        for (WebElement checkbox : allCheckbox) {
            checkbox.click();
        }
        Thread.sleep(5000);
        driver.findElement(By.id("confirmButton")).click();

        Thread.sleep(3000);
        WebElement signature = driver.findElement(
                By.xpath("//div[@class='sig sigWrapper']/canvas[@class='pad js-signature-canvas']"));
        Actions actionBuilder = new Actions(driver);
        Action drawAction = actionBuilder.moveToElement(signature, 660, 96).click().clickAndHold(signature)
                .moveByOffset(120, 120).moveByOffset(60, 70).moveByOffset(-140, -140).release(signature)
                .build();
        drawAction.perform();

        Thread.sleep(4000);
        driver.findElement(By.id("confirmButton")).click();
        Thread.sleep(5000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        Thread.sleep(6000);
        driver.switchTo().window(tabs.get(0));

        Leasing_ReviewNApprovePage review = new Leasing_ReviewNApprovePage(driver);

        Thread.sleep(8000);
        review.clickApprove_btn();

        Thread.sleep(8000);
        review.clickSaveproceed_btn();

        Leasing_RentalFeePage rentalfee = new Leasing_RentalFeePage(driver);

        Thread.sleep(15000);
        logger.log(LogStatus.PASS, "Validating Monthly rent and Promotions in Eligible Promotion Page");

        rentalfee.clickConfirmCust_btn();
        Thread.sleep(8000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully");

        Thread.sleep(6000);
        driver.findElement(By.id("confirmButton")).click();
        logger.log(LogStatus.INFO, "clicking on Confirm button successfully");

        Thread.sleep(5000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        driver.switchTo().window(tabs.get(0));
        logger.log(LogStatus.INFO, "Switch to Main page successfully");
        Thread.sleep(8000);
        Leasing_PaymentMethodsPage payment = new Leasing_PaymentMethodsPage(driver);
        logger.log(LogStatus.PASS, "creating object for the Login Page sucessfully ");
        Thread.sleep(2000);

        String screen = Generic_Class.takeScreenShotPath();
        String imga = logger.addScreenCapture(screen);
        logger.log(LogStatus.PASS, "Payment page is dispalyed sucessfully ");
        logger.log(LogStatus.INFO, "Payment page is dispalyed sucessfully", imga);
        String MonthlyRentDueNowAmount = payment.get_MonthlyRentDueNowAmt();
        logger.log(LogStatus.PASS,
                "Monthly Rent Due Now amount in payment page is------>:" + MonthlyRentDueNowAmount);

        String PromotionDueNowAmount = payment.get_PromotionDueNowAmt();
        logger.log(LogStatus.PASS,
                "Promotion  Due Now amount in payment page is------>:" + PromotionDueNowAmount);

        String InsuranceNowAmount = payment.get_InsuranceDueNowAmt();
        logger.log(LogStatus.PASS, "Insurance  Due Now amount in payment page is------>:" + InsuranceNowAmount);

        String AdministrativeDueNowAmount = payment.get_AdministrativeDueNowAmt();
        logger.log(LogStatus.PASS,
                "Administrative  Due Now amount in payment page is------>:" + AdministrativeDueNowAmount);

        String PayThroughDueNowAmount = payment.get_PaythroughDueNowAmt();
        logger.log(LogStatus.PASS,
                "PayThrough  Due Now amount in payment page is------>:" + PayThroughDueNowAmount);

        String MerchandiseAmount = payment.get_MerchandiseAmt();
        logger.log(LogStatus.PASS, "MerchandiseAmount  amount in payment page is------>:" + MerchandiseAmount);

        String TotalRemaingBalanceAmt = payment.get_TotalRemaingBalanceAmt();
        logger.log(LogStatus.PASS,
                "Total Remaing Balance Amount  in payment page is------>:" + TotalRemaingBalanceAmt);

        double MonthlyRentamt = payment.getDoubleAmount(MonthlyRentDueNowAmount);
        double Promotionamt = payment.getDoubleAmount(PromotionDueNowAmount);
        double Insuranceamt = payment.getDoubleAmount(InsuranceNowAmount);
        double Administrativeamt = payment.getDoubleAmount(AdministrativeDueNowAmount);
        double Apythroughamt = payment.getDoubleAmount(PayThroughDueNowAmount);
        double Merchandiseamt = payment.getDoubleAmount(MerchandiseAmount);

        double TotalAmount = MonthlyRentamt + Promotionamt + Insuranceamt + Administrativeamt + Apythroughamt
                + Merchandiseamt;
        double TotalRemUiVal = payment.getDoubleAmount(TotalRemaingBalanceAmt);

        Double db1 = new Double(TotalAmount);
        Double db2 = new Double(TotalRemUiVal);
        if (db1.intValue() == db2.intValue()) {

            String sc = Generic_Class.takeScreenShotPath();
            String im = logger.addScreenCapture(sc);
            logger.log(LogStatus.PASS, "Sumantion of all due amount and Total remaing amount are equal");
            logger.log(LogStatus.INFO, "Sumantion of all due amount and Total remaing amount are equal", im);
        } else {
            String scp = Generic_Class.takeScreenShotPath();
            String ima = logger.addScreenCapture(scp);
            logger.log(LogStatus.FAIL, "Sumantion of all due is amount and Total remaing amount are not equal");
            logger.log(LogStatus.INFO, "Sumantion of all due is amount and Total remaing amount are not equal",
                    ima);
        }

        Thread.sleep(3000);
        payment.selectPaymentMethod("Cash", driver);
        logger.log(LogStatus.PASS, "selecting cash option from the dropdown");

        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");
        Thread.sleep(3000);
        payment.enter_CashAmount(TotalRemaingBalanceAmt);
        logger.log(LogStatus.PASS, "entered total balance amount to pay");
        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");
        Thread.sleep(3000);
        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");
        payment.clickApply_btn();
        logger.log(LogStatus.PASS, "clicked on the apply button");
        Thread.sleep(3000);
        payment.clk_ConfirmWthCustBtn();
        logger.log(LogStatus.PASS, "clicked on the ConfirmWthCustBtn button");
        Thread.sleep(8000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully");

        Thread.sleep(6000);
        driver.findElement(By.id("confirmButton")).click();
        logger.log(LogStatus.INFO, "clicking on Confirm button successfully");

        Thread.sleep(5000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        driver.switchTo().window(tabs.get(0));
        logger.log(LogStatus.INFO, "Switch to Main page successfully");
        Thread.sleep(5000);

        payment.clickSubmit_btn();
        logger.log(LogStatus.PASS, "clicked on the submit button in payment page");
        Thread.sleep(3000);

        TransactionCompletePopup popup = new TransactionCompletePopup(driver);

        String path = Generic_Class.takeScreenShotPath();
        String ima = logger.addScreenCapture(path);
        logger.log(LogStatus.PASS, "TransactionCompletePopup  dispalyed sucessfully");
        logger.log(LogStatus.INFO, "TransactionCompletePopup dispalyed sucessfully", ima);

        popup.enterEmpNum(tabledata.get("UserName"));
        logger.log(LogStatus.PASS, "entered the employee id");
        Thread.sleep(3000);
        popup.clickOk_btn();
        logger.log(LogStatus.PASS, "clicked on the ok button");
        Thread.sleep(3000);
        driver.findElement(By.xpath("//div[@class='k-widget k-window']//a[contains(text(),'No')]")).click();

        Thread.sleep(8000);

        if (pmhomepage.isexistingCustomerModelDisplayed()) {
            String pa = Generic_Class.takeScreenShotPath();
            String img1 = logger.addScreenCapture(pa);
            logger.log(LogStatus.PASS, "PM DashBoard dispalyed sucessfully");
            logger.log(LogStatus.INFO, "PM DashBoard dispalyed sucessfully", img1);
        } else {
            String scp = Generic_Class.takeScreenShotPath();
            String imag = logger.addScreenCapture(scp);
            logger.log(LogStatus.FAIL, "PM DashBoard dispalyed  is not displayed");
            logger.log(LogStatus.INFO, "PM DashBoard dispalyed  is not displayed", imag);
        }

        Thread.sleep(2000);
        pmhomepage.clk_AdvSearchLnk();
        logger.log(LogStatus.PASS, "clicked on the submit button");

        Thread.sleep(6000);

        Advance_Search advSearch = new Advance_Search(driver);

        String sqlQuery = "selectaccountidfromaccountwherecustomerid=(selectcustomeridfromcustomerwherecontactid=(selectcontactidfromcontactwherefirstname='"
                + FN + "'andlastname='" + tabledata.get("LastName") + "'))";

        String accNUm = DataBase_JDBC.executeSQLQuery(sqlQuery);
        Thread.sleep(6000);
        logger.log(LogStatus.PASS, "fetched account number from databse and account number is:" + accNUm);

        advSearch.enterAccNum(accNUm);
        logger.log(LogStatus.PASS, "entered account number");

        Thread.sleep(5000);

        advSearch.clickSearchAccbtn();
        logger.log(LogStatus.PASS, "clicked on the search button in advance search page");

        Cust_AccDetailsPage cust = new Cust_AccDetailsPage(driver);
        Thread.sleep(8000);
        if (cust.isCustdbTitleDisplayed()) {

            String sap = Generic_Class.takeScreenShotPath();
            String mag = logger.addScreenCapture(sap);
            logger.log(LogStatus.PASS, "customer Dashboard is displayed successfully");
            logger.log(LogStatus.INFO, "customer Dashboard is displayed successfully", mag);
        } else {

            if (resultFlag.equals("pass"))
                resultFlag = "fail";

            String scan = Generic_Class.takeScreenShotPath();
            String mg = logger.addScreenCapture(scan);
            logger.log(LogStatus.FAIL, "customer Dashboard is not displayed ");
            logger.log(LogStatus.INFO, "customer Dashboard is not displayed ", mg);
        }

        Thread.sleep(1000);
        String totalDueNowAmount = cust.getTotalDue();
        logger.log(LogStatus.PASS, "Total due now amount  in customer dashbaord is---> :" + totalDueNowAmount);

        Double db3 = new Double(payment.getDoubleAmount(totalDueNowAmount));

        if (db3.intValue() == 0) {

            String sap = Generic_Class.takeScreenShotPath();
            String mag = logger.addScreenCapture(sap);
            logger.log(LogStatus.PASS,
                    "Payment done  successfully and changes reflecting in customer dash board");
            logger.log(LogStatus.INFO,
                    "Payment done  successfully and changes reflecting in customer dash board", mag);
        } else {

            if (resultFlag.equals("pass"))
                resultFlag = "fail";

            String scan = Generic_Class.takeScreenShotPath();
            String mg = logger.addScreenCapture(scan);
            logger.log(LogStatus.FAIL, "Payment not done successfully ");
            logger.log(LogStatus.INFO, "Payment not done successfully ", mg);
        }

        Thread.sleep(1000);

        // Verify Total Due Now is available

        if (cust.getTotalDueNowTxt().contains("Total Due Now")) {
            Thread.sleep(2000);
            String scp = Generic_Class.takeScreenShotPath();

            String img = logger.addScreenCapture(scp);
            logger.log(LogStatus.PASS,
                    "Total Due Now is displayed successfully" + cust.getCustDashboardTitle());
            logger.log(LogStatus.PASS, "Total Due Now is displayed successfully", img);
        }

        else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";

            String scp = Generic_Class.takeScreenShotPath();

            String im = logger.addScreenCapture(scp);
            logger.log(LogStatus.FAIL, "Total Due Now is not displayed successfully");
            logger.log(LogStatus.FAIL, "Total Due Now is not displayed successfully", im);
        }

        // Verify Next Due is available

        if (cust.getNextPaymentDueTxt().contains("Next Payment Due")) {
            Thread.sleep(2000);
            String scp = Generic_Class.takeScreenShotPath();

            String img = logger.addScreenCapture(scp);
            logger.log(LogStatus.PASS,
                    "Next Payment Due is displayed successfully" + cust.getCustDashboardTitle());
            logger.log(LogStatus.PASS, "Next Payment Due is displayed successfully", img);
        }

        else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";
            String sc = Generic_Class.takeScreenShotPath();

            String im = logger.addScreenCapture(sc);
            logger.log(LogStatus.FAIL, "Next Payment Due is not displayed successfully");
            logger.log(LogStatus.FAIL, "Next Payment Due is not displayed successfully", im);
        }

        // Verify Make Payment is available
        if (cust.getMakePaymentTxt().contains("Make Payment")) {
            Thread.sleep(4000);
            String sc = Generic_Class.takeScreenShotPath();

            String im = logger.addScreenCapture(sc);
            logger.log(LogStatus.PASS, "Make Payment is displayed successfully" + cust.getCustDashboardTitle());
            logger.log(LogStatus.PASS, "Make Payment is displayed successfully", im);
        }

        else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";
            String sc = Generic_Class.takeScreenShotPath();

            String im = logger.addScreenCapture(sc);
            logger.log(LogStatus.FAIL, "Make Payment is not displayed successfully");
            logger.log(LogStatus.FAIL, "Make Payment is not displayed successfully", im);
        }

        // Verify Manage AutoPay is available

        if (cust.getManageAutoPayTxt().contains("Manage AutoPay")) {
            Thread.sleep(2000);
            String st = Generic_Class.takeScreenShotPath();

            String im = logger.addScreenCapture(st);
            logger.log(LogStatus.PASS,
                    "Manage AutoPay is displayed successfully" + cust.getCustDashboardTitle());
            logger.log(LogStatus.PASS, "Manage AutoPay is displayed successfully", im);
        }

        else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";
            String st = Generic_Class.takeScreenShotPath();

            String im = logger.addScreenCapture(st);
            logger.log(LogStatus.FAIL, "Manage AutoPay is not displayed successfully");
            logger.log(LogStatus.FAIL, "Manage AutoPay is not displayed successfully", im);
        }

        // Verify Create Note is available

        if (cust.getCreateNoteTxt().contains("Create Note")) {
            Thread.sleep(2000);
            String sc = Generic_Class.takeScreenShotPath();

            String im = logger.addScreenCapture(sc);
            logger.log(LogStatus.PASS, "Create Note is displayed successfully" + cust.getCustDashboardTitle());
            logger.log(LogStatus.PASS, "Create Note is displayed successfully", im);
        }

        else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";
            String sc = Generic_Class.takeScreenShotPath();

            String im = logger.addScreenCapture(sc);
            logger.log(LogStatus.FAIL, "Create Note is not displayed successfully");
            logger.log(LogStatus.FAIL, "Create Note is not displayed successfully", im);
        }

        // Verify Important Information is available

        if (cust.getImportantInformationTxt().contains("Important Information")) {
            Thread.sleep(2000);
            String sch = Generic_Class.takeScreenShotPath();

            String ie = logger.addScreenCapture(sch);
            logger.log(LogStatus.PASS,
                    "Important Information is displayed successfully" + cust.getCustDashboardTitle());
            logger.log(LogStatus.PASS, "Important Information is displayed successfully", ie);
        }

        else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";
            String sch = Generic_Class.takeScreenShotPath();

            String imge = logger.addScreenCapture(sch);
            logger.log(LogStatus.FAIL, "Important Information is not displayed successfully");
            logger.log(LogStatus.FAIL, "Important Information is not displayed successfully", imge);
        }

        // Verify Customer Info Tab is available
        if (cust.getCustomerInfoTabTxt().contains("Customer Info")) {
            Thread.sleep(2000);
            String sch = Generic_Class.takeScreenShotPath();

            String ie = logger.addScreenCapture(sch);
            logger.log(LogStatus.PASS,
                    "Customer Info tab displayed successfully" + cust.getCustomerInfoTabTxt());
            logger.log(LogStatus.PASS, "Customer Info tab displayed successfully", ie);
        }

        else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";
            String scr = Generic_Class.takeScreenShotPath();

            String im = logger.addScreenCapture(scr);
            logger.log(LogStatus.FAIL, "Customer Info tab not  displayed successfully");
            logger.log(LogStatus.FAIL, "Customer Info tab not displayed successfully", im);
        }

        // Verify Space Details tab is available
        if (cust.getSpaceDetailsTabTxt().contains("Space Details")) {
            Thread.sleep(2000);
            String scp = Generic_Class.takeScreenShotPath();

            String im = logger.addScreenCapture(scp);
            logger.log(LogStatus.PASS,
                    " Space Details tab displayed successfully" + cust.getSpaceDetailsTabTxt());
            logger.log(LogStatus.PASS, " Space Details tab displayed successfully", im);
        }

        else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";
            String sr = Generic_Class.takeScreenShotPath();

            String im = logger.addScreenCapture(sr);
            logger.log(LogStatus.FAIL, "Space Details tab not  displayed successfully");
            logger.log(LogStatus.FAIL, "Space Details  tab not displayed successfully", im);
        }

        // Verify Account Activities tab is available
        if (cust.getAccountActivitiesTabTxt().contains("Account Activities")) {
            Thread.sleep(2000);
            String scp = Generic_Class.takeScreenShotPath();

            String im = logger.addScreenCapture(scp);
            logger.log(LogStatus.PASS,
                    " Account Activitiestab displayed successfully" + cust.getAccountActivitiesTabTxt());
            logger.log(LogStatus.PASS, " Account Activities tab displayed successfully", im);
        }

        else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";
            String sc = Generic_Class.takeScreenShotPath();

            String im = logger.addScreenCapture(sc);
            logger.log(LogStatus.FAIL, "Account Activities tab not  displayed successfully");
            logger.log(LogStatus.FAIL, "Account Activities tab not displayed successfully", im);
        }

        // Verify Documents tab is available

        if (cust.getDocumentsTabTxt().contains("Documents")) {
            Thread.sleep(2000);
            String sc = Generic_Class.takeScreenShotPath();

            String im = logger.addScreenCapture(sc);
            logger.log(LogStatus.PASS, "  Documents tab displayed successfully" + cust.getDocumentsTabTxt());
            logger.log(LogStatus.PASS, " Documents tab displayed successfully", im);
        }

        else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";
            String sc = Generic_Class.takeScreenShotPath();
            String im = logger.addScreenCapture(sc);
            logger.log(LogStatus.FAIL, "Documents tab not  displayed successfully");
            logger.log(LogStatus.FAIL, "Documents tab not displayed successfully", im);
        }

        if (cust.getCustSpaceNum().trim().contains(space)) {
            logger.log(LogStatus.PASS,
                    "Application is displaying correct space number in the customer dashboard");
        } else {

            logger.log(LogStatus.PASS,
                    "Application is not displaying correct space number in the customer dashboard");
        }

        if (cust.getEmailid(tabledata.get("Email"))) {

            logger.log(LogStatus.PASS, "Application is displaying correct email id in the customer info tab");
        } else {

            logger.log(LogStatus.FAIL,
                    "Application is not displaying correct email id in the customer info tab");
        }

    } catch (Exception e) {
        resultFlag = "fail";
        String scpath = Generic_Class.takeScreenShotPath();
        String image = logger.addScreenCapture(scpath);
        logger.log(LogStatus.FAIL, "PM Dash board page is not displayed", image);
        e.printStackTrace();
    }

}

From source file:Scenarios.Payments.MakePayment_WithoutInsurance.java

@Test(dataProvider = "getLoginData")
public void Leasing_LeaseWithInsurance(Hashtable<String, String> tabledata) throws Exception {

    if (!(tabledata.get("Runmode").equals("Y") && tabledata.get("Leasing").equals("Y"))) {
        resultFlag = "skip";
        logger.log(LogStatus.SKIP, "Leasing_LeaseWithInsurance is Skipped");
        throw new SkipException("Skipping the test Leasing_LeaseWithInsurance");
    }/*from  ww  w .  ja  va2  s .c  om*/

    Reporter.log("Test Case Started", true);
    Thread.sleep(5000);

    try {
        logger = extent.startTest("Leasing_LeaseWithInsurance", "Lease with insurance");
        testcaseName = tabledata.get("TestCases");
        Reporter.log("Test case started: " + testcaseName, true);
        Thread.sleep(5000);
        JavascriptExecutor jse = (JavascriptExecutor) driver;
        LoginPage loginPage = new LoginPage(driver);
        logger.log(LogStatus.PASS, "creating object for the Login Page sucessfully ");
        Thread.sleep(2000);
        loginPage.enterUserName(tabledata.get("UserName"));
        Thread.sleep(2000);
        logger.log(LogStatus.PASS, "entered username sucessfully");
        Thread.sleep(2000);
        loginPage.enterPassword(tabledata.get("Password"));
        logger.log(LogStatus.PASS, "entered password sucessfully");
        Thread.sleep(2000);
        loginPage.clickLogin();
        logger.log(LogStatus.PASS, "clicked on login in button sucessfully");
        logger.log(LogStatus.PASS, "Login to Application  successfully");

        // =================Handling customer facing device========================
        Thread.sleep(5000);
        Dashboard_BifrostHostPopUp Bifrostpop = new Dashboard_BifrostHostPopUp(driver);
        logger.log(LogStatus.INFO, "PopUp window object is created successfully");
        String biforstNum = Bifrostpop.getBiforstNo();

        Reporter.log(biforstNum + "", true);

        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, "t");
        ArrayList<String> tabs = new ArrayList<String>(driver.getWindowHandles());
        Reporter.log(tabs.size() + "", true);
        driver.switchTo().window(tabs.get(1));
        driver.get(Generic_Class.getPropertyValue("CustomerScreenPath"));

        List<WebElement> biforstSystem = driver.findElements(
                By.xpath("//div[@class='scrollable-area']//span[@class='bifrost-label vertical-center']"));
        for (WebElement ele : biforstSystem) {
            if (biforstNum.equalsIgnoreCase(ele.getText().trim())) {
                Reporter.log(ele.getText() + "", true);
                ele.click();
                break;
            }
        }

        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        Thread.sleep(5000);
        driver.switchTo().window(tabs.get(0));
        Thread.sleep(5000);
        driver.findElement(By.xpath(
                "//div[@id='cfsConnectionDialog']//div[@class='after-connected padding-top']//p/input[@class='psbutton-low-priority']"))
                .click();
        Thread.sleep(5000);
        // =================================================================================
        Thread.sleep(3000);
        PM_Homepage pmhomepage = new PM_Homepage(driver);
        logger.log(LogStatus.PASS, "creating object for the PM home page sucessfully");
        if (pmhomepage.get_WlkInCustText().trim().contains("Walk-In Customer")) {

            String scpath = Generic_Class.takeScreenShotPath();
            String image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.PASS, "Walk in customer window displayed sucessfully");
            logger.log(LogStatus.INFO, "Walk in customer window displayed sucessfully", image);

        } else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";

            String scpath = Generic_Class.takeScreenShotPath();
            String image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.FAIL, "Walk in customer window is not displayed");
            logger.log(LogStatus.INFO, "Walk in customer window is not displayed", image);

        }
        if (pmhomepage.isFindAndLeaseButtonDisplayed()) {
            logger.log(LogStatus.PASS,
                    "Find and Lease button displayed sucessfully on Walk in customer window");
        } else {

            logger.log(LogStatus.FAIL,
                    "Find and Lease button is not displayed sucessfully on Walk in customer window");
        }

        if (pmhomepage.isFindAnExtReservationTextFieldDisplayed()) {

            logger.log(LogStatus.PASS,
                    "Or Find an Existing Reservation text field is dispalyed sucessfully on Walk in customer window");
        } else {

            logger.log(LogStatus.FAIL,
                    "Or Find an Existing Reservation text field is not dispalyed sucessfully on Walk in customer window");
        }

        if (pmhomepage.isFindReservationDispalyed()) {

            logger.log(LogStatus.PASS,
                    "Find reservation button is dispalyed sucessfully on Walk in customer window");
        } else {

            logger.log(LogStatus.FAIL,
                    "Find reservation button is not dispalyed sucessfully on Walk in customer window");
        }
        pmhomepage.clk_findAndLeaseSpace();
        logger.log(LogStatus.INFO, "Click on Find And Lease Space Link successfully");

        Thread.sleep(4000);
        StandardStoragePage stdStorage = new StandardStoragePage(driver);
        logger.log(LogStatus.PASS, "Creating object for the Standard stroage page sucessfully");
        Thread.sleep(1000);
        if (stdStorage.isSelected_yesradiobutton()) {

            logger.log(LogStatus.PASS,
                    "New Customer Radio button selected by default when WALK-INS: FIND A SPACE page is launched sucessfully");

        } else {

            logger.log(LogStatus.FAIL,
                    "New Customer Radio button is not selected by default when WALK-INS: FIND A SPACE page is launched sucessfully");
        }

        stdStorage.Clk_ChkBx_AvlSpace();
        logger.log(LogStatus.PASS,
                "Clicked on available bold space size  checkbox in StandardStorage sucessfully");

        stdStorage.click_Search();
        logger.log(LogStatus.INFO, "Click on search button successfully");

        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");

        // =====================Fetching space number and based on that clicking the radio button========================
        Thread.sleep(10000);
        List<WebElement> norows = driver
                .findElements(By.xpath("//form[@id='frmReserveUnits']//div//table/tbody/tr"));
        String space = null;
        logger.log(LogStatus.INFO, "Total number of avaiable sizes count is------>:" + norows.size());
        if (norows.size() > 0) {
            Thread.sleep(5000);

            space = driver.findElement(By.xpath("//form[@id='frmReserveUnits']//div//table/tbody/tr[1]/td[4]"))
                    .getText();

            Reporter.log("space number is:" + space, true);
        } else {

            logger.log(LogStatus.FAIL,
                    "Application is not populating any data/space details with selected size dimension");
            throw new Exception("Application is not populating any data/space details");

        }
        Thread.sleep(2000);
        WebElement RdBtn_Space = driver.findElement(By.xpath(
                "//td[@class='grid-cell-space'][text()='" + space + "']/../td/input[@name='selectedIds']"));
        logger.log(LogStatus.PASS,
                "check the radio button based on the space and click on the  reservation button");
        Thread.sleep(5000);
        jse.executeScript("arguments[0].scrollIntoView()", RdBtn_Space);
        jse.executeScript("arguments[0].click();", RdBtn_Space);

        logger.log(LogStatus.PASS, "Clicked on check box of a space in this location:-------> " + space);
        Reporter.log("Clicked on check box of a space in this location: " + space, true);
        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");
        Thread.sleep(3000);
        SpaceDashboard_ThisLoc thisloc = new SpaceDashboard_ThisLoc(driver);
        logger.log(LogStatus.PASS, "creating object for the This location page sucessfully");
        thisloc.click_Rent();
        logger.log(LogStatus.PASS, "clicked on the rent button sucessfully");
        Thread.sleep(5000);

        Leasing_ConfirmSpace confirmSpace = new Leasing_ConfirmSpace(driver);
        Thread.sleep(5000);
        confirmSpace.clk_ConfirmwtCust();

        logger.log(LogStatus.PASS, "Clicked on Confirm with Customer button");
        Reporter.log("Clicked on Confirm with Customer button", true);

        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        Thread.sleep(5000);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.PASS, "Switched to Customer Screen");
        Reporter.log("Switched to Customer Screen", true);
        Thread.sleep(9000);
        String monthlyRent = driver
                .findElement(By.xpath("//table[@class='spaces']/tbody//tr//td[@class='monthly-rent']"))
                .getText();

        driver.findElement(
                By.xpath("//div[@class='footer-row clearfix-container']/button[@id='confirmButton']")).click();
        logger.log(LogStatus.PASS, "Clicked on Confirm button in customer screen");
        Reporter.log("Clicked on Confirm button in customer screen", true);

        Thread.sleep(8000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        driver.switchTo().window(tabs.get(0));
        logger.log(LogStatus.PASS, "Switching back to screen");
        Reporter.log("Switching back to screen", true);

        // Filling contact information

        Leasing_ContactInfoPage contactinfo = new Leasing_ContactInfoPage(driver);
        Thread.sleep(5000);
        String FN = "AUT" + Generic_Class.get_RandmString();
        contactinfo.txt_Fname(FN);
        contactinfo.txt_Lname(tabledata.get("LastName"));
        contactinfo.clickContact_State();
        List<WebElement> allstates = driver.findElements(
                By.xpath("//ul[@id='ContactForm_Identification_StateTypeID_listbox']/li[@class='k-item']"));

        // Identify the WebElement which will appear after scrolling down

        for (WebElement state : allstates) {
            Thread.sleep(2000);
            if (tabledata.get("StateCode").equalsIgnoreCase(state.getText())) {
                state.click();
                break;
            }
        }

        // contactinfo.select_State(tabledata.get("StateCode"));
        contactinfo.txt_Number(tabledata.get("DrivingLicenseNum"));
        contactinfo.txt_street1(tabledata.get("Street"));
        contactinfo.txt_city(tabledata.get("City"));

        contactinfo.select_State2address();
        List<WebElement> allstatesadd = driver
                .findElements(By.xpath("//ul[@id='lesseeinfo-address-statecode_listbox']/li[@class='k-item']"));

        for (WebElement state : allstatesadd) {
            Thread.sleep(2000);
            if (tabledata.get("StateCode").equalsIgnoreCase(state.getText())) {
                state.click();
                break;
            }
        }

        // contactinfo.select_State2(tabledata.get("State"));
        Thread.sleep(3000);
        contactinfo.txt_Zipcode(tabledata.get("Zipcode"));
        contactinfo.select_phoneType1();
        Thread.sleep(3000);

        driver.findElement(
                By.xpath("//ul[@class='k-list k-reset ps-container ps-active-y']/li[contains(text(),'"
                        + tabledata.get("PhoneType") + " ')]"))
                .click();
        Thread.sleep(2000);
        contactinfo.txt_AreaCode(tabledata.get("Areacode"));
        Thread.sleep(2000);
        contactinfo.txt_Exchg(tabledata.get("Exchange"));
        Thread.sleep(2000);
        contactinfo.txt_lineNumber(tabledata.get("LineNumber"));
        Thread.sleep(2000);
        contactinfo.txt_email(tabledata.get("Email"));
        Thread.sleep(2000);
        contactinfo.click_CustLookUp();

        Thread.sleep(15000);
        // Click on New Customer button on Choose an Account PopUp
        driver.findElement(By.linkText("Create New Customer")).click();

        Thread.sleep(8000);
        contactinfo.clk_ActiveDutyMilitaryNoRadioBtn(driver);

        // Click on Verify button
        Thread.sleep(5000);
        driver.findElement(By.partialLinkText("Verify")).click();
        logger.log(LogStatus.INFO, "cliked on the Verify button button ");

        Thread.sleep(9000);
        driver.findElement(By.id("confirmWithCustomerButton")).click();

        Thread.sleep(5000);
        // Click on Confirm with Cust button

        logger.log(LogStatus.INFO, "clicking on Confirm with cust button successfully");

        // Navigating to Customer screen
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        Thread.sleep(8000);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully");

        Thread.sleep(6000);
        driver.findElement(By.id("confirmButton")).click();
        logger.log(LogStatus.INFO, "clicking on Confirm button successfully");

        Thread.sleep(5000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        driver.switchTo().window(tabs.get(0));
        logger.log(LogStatus.INFO, "Switch to Main page successfully");

        // Entering Emergency Contact details
        Thread.sleep(5000);
        Leasing_EmergencyConatctsPage emergCon = new Leasing_EmergencyConatctsPage(driver);
        Thread.sleep(2000);

        emergCon.clickAuthorizedfor_radio();
        Thread.sleep(2000);
        emergCon.click_custDeclines_chkBox();

        emergCon.clickconfirmWithCust();
        Thread.sleep(4000);

        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        Thread.sleep(8000);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully");

        Thread.sleep(8000);
        driver.findElement(By.id("confirmButton")).click();
        logger.log(LogStatus.INFO, "clicking on Confirm button successfully");

        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        Thread.sleep(2000);
        driver.switchTo().window(tabs.get(0));
        logger.log(LogStatus.INFO, "Switch to Main page successfully");

        Leasing_AuthorizedAccessContactsPage autContact = new Leasing_AuthorizedAccessContactsPage(driver);

        Thread.sleep(8000);
        autContact.clickSavenProceed();

        Thread.sleep(8000);
        Leasing_EligiblePromotionsPage eligpromo = new Leasing_EligiblePromotionsPage(driver);

        logger.log(LogStatus.PASS, "Validating Monthly rent and Promotions in Eligible Promotion Page");

        eligpromo.clickSavenProceed();

        Thread.sleep(8000);

        Leasing_LeaseQuestionairePage leaseQues = new Leasing_LeaseQuestionairePage(driver);

        leaseQues.clickStorageContent();

        Thread.sleep(5000);

        List<WebElement> allstorage = driver.findElements(By.xpath(
                "//ul[@id='LeaseQuestionnaireUnits_0__RentalUnitContentsTypeID_listbox']//li[@class='k-item']"));

        for (WebElement storage : allstorage) {
            if (tabledata.get("StorageContent").equalsIgnoreCase(storage.getText())) {
                storage.click();
                break;
            }
        }

        // Insurance is OFF

        Thread.sleep(5000);
        if (leaseQues.isInsuranceYesRadioBtnDisplayed()) {
            String scpath = Generic_Class.takeScreenShotPath();
            String image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.PASS, "Add insurance option available in the page");
            logger.log(LogStatus.INFO, "Add insurance option available in the page", image);

        } else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";

            String scpath = Generic_Class.takeScreenShotPath();
            String image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.FAIL, "Add insurance option is not there in the page");
            logger.log(LogStatus.INFO, "Add insurance option is not there in the page", image);

        }
        Thread.sleep(3000);
        leaseQues.clickAddInsuranceNo();
        logger.log(LogStatus.PASS, "Selecting Insurance yes Radio button to add insurnace");
        Thread.sleep(1000);

        leaseQues.clickAccessZone();
        Thread.sleep(2000);

        driver.findElement(
                By.xpath("//ul[@id='LeaseQuestionnaireUnits_0__GateControllerTimeZoneID_listbox']//li[2]"))
                .click();

        Thread.sleep(5000);
        leaseQues.clickKeypadZone();
        Thread.sleep(2000);
        driver.findElement(
                By.xpath("//li[contains(@id,'KeypadZone_option_selected')]/following-sibling::li[1]")).click();

        Thread.sleep(5000);
        leaseQues.clickConfirmCust();

        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        Thread.sleep(8000);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully");

        Thread.sleep(6000);
        driver.findElement(By.id("confirmButton")).click();
        logger.log(LogStatus.INFO, "clicking on Confirm button successfully");

        Thread.sleep(12000);
        List<WebElement> allCheckbox = driver.findElements(
                By.xpath("//section[@class='term-group term-group--active']//input[@type='checkbox']"));

        for (WebElement checkbox : allCheckbox) {
            checkbox.click();
        }
        Thread.sleep(5000);
        driver.findElement(By.id("confirmButton")).click();

        Thread.sleep(3000);
        WebElement signature = driver.findElement(
                By.xpath("//div[@class='sig sigWrapper']/canvas[@class='pad js-signature-canvas']"));
        Actions actionBuilder = new Actions(driver);
        Action drawAction = actionBuilder.moveToElement(signature, 660, 96).click().clickAndHold(signature)
                .moveByOffset(120, 120).moveByOffset(60, 70).moveByOffset(-140, -140).release(signature)
                .build();
        drawAction.perform();

        Thread.sleep(4000);
        driver.findElement(By.id("confirmButton")).click();
        Thread.sleep(5000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        Thread.sleep(6000);
        driver.switchTo().window(tabs.get(0));

        Leasing_ReviewNApprovePage review = new Leasing_ReviewNApprovePage(driver);

        Thread.sleep(8000);
        review.clickApprove_btn();

        Thread.sleep(8000);
        review.clickSaveproceed_btn();

        Leasing_RentalFeePage rentalfee = new Leasing_RentalFeePage(driver);

        Thread.sleep(15000);
        logger.log(LogStatus.PASS, "Validating Monthly rent and Promotions in Eligible Promotion Page");

        rentalfee.clickConfirmCust_btn();
        Thread.sleep(8000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully");

        Thread.sleep(6000);
        driver.findElement(By.id("confirmButton")).click();
        logger.log(LogStatus.INFO, "clicking on Confirm button successfully");

        Thread.sleep(5000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        driver.switchTo().window(tabs.get(0));
        logger.log(LogStatus.INFO, "Switch to Main page successfully");
        Thread.sleep(8000);
        Leasing_PaymentMethodsPage payment = new Leasing_PaymentMethodsPage(driver);
        logger.log(LogStatus.PASS, "creating object for the Login Page sucessfully ");
        Thread.sleep(2000);

        String screen = Generic_Class.takeScreenShotPath();
        String imga = logger.addScreenCapture(screen);
        logger.log(LogStatus.PASS, "Payment page is dispalyed sucessfully ");
        logger.log(LogStatus.INFO, "Payment page is dispalyed sucessfully", imga);
        String MonthlyRentDueNowAmount = payment.get_MonthlyRentDueNowAmt();
        logger.log(LogStatus.PASS,
                "Monthly Rent Due Now amount in payment page is------>:" + MonthlyRentDueNowAmount);

        String PromotionDueNowAmount = payment.get_PromotionDueNowAmt();
        logger.log(LogStatus.PASS,
                "Promotion  Due Now amount in payment page is------>:" + PromotionDueNowAmount);

        String InsuranceNowAmount = payment.get_InsuranceDueNowAmt();
        logger.log(LogStatus.PASS, "Insurance  Due Now amount in payment page is------>:" + InsuranceNowAmount);

        String AdministrativeDueNowAmount = payment.get_AdministrativeDueNowAmt();
        logger.log(LogStatus.PASS,
                "Administrative  Due Now amount in payment page is------>:" + AdministrativeDueNowAmount);

        String PayThroughDueNowAmount = payment.get_PaythroughDueNowAmt();
        logger.log(LogStatus.PASS,
                "PayThrough  Due Now amount in payment page is------>:" + PayThroughDueNowAmount);

        String MerchandiseAmount = payment.get_MerchandiseAmt();
        logger.log(LogStatus.PASS, "MerchandiseAmount  amount in payment page is------>:" + MerchandiseAmount);

        String TotalRemaingBalanceAmt = payment.get_TotalRemaingBalanceAmt();
        logger.log(LogStatus.PASS,
                "Total Remaing Balance Amount  in payment page is------>:" + TotalRemaingBalanceAmt);

        double MonthlyRentamt = payment.getDoubleAmount(MonthlyRentDueNowAmount);
        double Promotionamt = payment.getDoubleAmount(PromotionDueNowAmount);
        double Insuranceamt = payment.getDoubleAmount(InsuranceNowAmount);
        double Administrativeamt = payment.getDoubleAmount(AdministrativeDueNowAmount);
        double Apythroughamt = payment.getDoubleAmount(PayThroughDueNowAmount);
        double Merchandiseamt = payment.getDoubleAmount(MerchandiseAmount);

        double TotalAmount = MonthlyRentamt + Promotionamt + Insuranceamt + Administrativeamt + Apythroughamt
                + Merchandiseamt;
        double TotalRemUiVal = payment.getDoubleAmount(TotalRemaingBalanceAmt);

        Double db1 = new Double(TotalAmount);
        Double db2 = new Double(TotalRemUiVal);
        if (db1.intValue() == db2.intValue()) {

            String sc = Generic_Class.takeScreenShotPath();
            String im = logger.addScreenCapture(sc);
            logger.log(LogStatus.PASS, "Sumantion of all due amount and Total remaing amount are equal");
            logger.log(LogStatus.INFO, "Sumantion of all due amount and Total remaing amount are equal", im);
        } else {
            String scp = Generic_Class.takeScreenShotPath();
            String ima = logger.addScreenCapture(scp);
            logger.log(LogStatus.FAIL, "Sumantion of all due is amount and Total remaing amount are not equal");
            logger.log(LogStatus.INFO, "Sumantion of all due is amount and Total remaing amount are not equal",
                    ima);
        }

        Thread.sleep(3000);
        payment.selectPaymentMethod("Cash", driver);
        logger.log(LogStatus.PASS, "selecting cash option from the dropdown");

        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");
        Thread.sleep(3000);
        payment.enter_CashAmount(TotalRemaingBalanceAmt);
        logger.log(LogStatus.PASS, "entered total balance amount to pay");
        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");
        Thread.sleep(3000);
        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");
        payment.clickApply_btn();
        logger.log(LogStatus.PASS, "clicked on the apply button");
        Thread.sleep(3000);
        payment.clk_ConfirmWthCustBtn();
        logger.log(LogStatus.PASS, "clicked on the ConfirmWthCustBtn button");
        Thread.sleep(8000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully");

        Thread.sleep(6000);
        driver.findElement(By.id("confirmButton")).click();
        logger.log(LogStatus.INFO, "clicking on Confirm button successfully");

        Thread.sleep(5000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        driver.switchTo().window(tabs.get(0));
        logger.log(LogStatus.INFO, "Switch to Main page successfully");
        Thread.sleep(5000);

        payment.clickSubmit_btn();
        logger.log(LogStatus.PASS, "clicked on the submit button in payment page");
        Thread.sleep(3000);

        TransactionCompletePopup popup = new TransactionCompletePopup(driver);

        String path = Generic_Class.takeScreenShotPath();
        String ima = logger.addScreenCapture(path);
        logger.log(LogStatus.PASS, "TransactionCompletePopup  dispalyed sucessfully");
        logger.log(LogStatus.INFO, "TransactionCompletePopup dispalyed sucessfully", ima);

        popup.enterEmpNum(tabledata.get("UserName"));
        logger.log(LogStatus.PASS, "entered the employee id");
        Thread.sleep(3000);
        popup.clickOk_btn();
        logger.log(LogStatus.PASS, "clicked on the ok button");
        Thread.sleep(3000);
        driver.findElement(By.xpath("//div[@class='k-widget k-window']//a[contains(text(),'No')]")).click();

        Thread.sleep(8000);

        if (pmhomepage.isexistingCustomerModelDisplayed()) {
            String pa = Generic_Class.takeScreenShotPath();
            String img1 = logger.addScreenCapture(pa);
            logger.log(LogStatus.PASS, "PM DashBoard dispalyed sucessfully");
            logger.log(LogStatus.INFO, "PM DashBoard dispalyed sucessfully", img1);
        } else {
            String scp = Generic_Class.takeScreenShotPath();
            String imag = logger.addScreenCapture(scp);
            logger.log(LogStatus.FAIL, "PM DashBoard dispalyed  is not displayed");
            logger.log(LogStatus.INFO, "PM DashBoard dispalyed  is not displayed", imag);
        }

        Thread.sleep(2000);
        pmhomepage.clk_AdvSearchLnk();
        logger.log(LogStatus.PASS, "clicked on the submit button");

        Thread.sleep(6000);

        Advance_Search advSearch = new Advance_Search(driver);

        String sqlQuery = "selectaccountidfromaccountwherecustomerid=(selectcustomeridfromcustomerwherecontactid=(selectcontactidfromcontactwherefirstname='"
                + FN + "'andlastname='" + tabledata.get("LastName") + "'))";

        String accNUm = DataBase_JDBC.executeSQLQuery(sqlQuery);
        Thread.sleep(6000);
        logger.log(LogStatus.PASS, "fetched account number from databse and account number is:" + accNUm);

        advSearch.enterAccNum(accNUm);
        logger.log(LogStatus.PASS, "entered account number");

        Thread.sleep(5000);

        advSearch.clickSearchAccbtn();
        logger.log(LogStatus.PASS, "clicked on the search button in advance search page");

        Cust_AccDetailsPage cust = new Cust_AccDetailsPage(driver);
        Thread.sleep(8000);
        if (cust.isCustdbTitleDisplayed()) {

            String sap = Generic_Class.takeScreenShotPath();
            String mag = logger.addScreenCapture(sap);
            logger.log(LogStatus.PASS, "customer Dashboard is displayed successfully");
            logger.log(LogStatus.INFO, "customer Dashboard is displayed successfully", mag);
        } else {

            if (resultFlag.equals("pass"))
                resultFlag = "fail";

            String scan = Generic_Class.takeScreenShotPath();
            String mg = logger.addScreenCapture(scan);
            logger.log(LogStatus.FAIL, "customer Dashboard is not displayed ");
            logger.log(LogStatus.INFO, "customer Dashboard is not displayed ", mg);
        }

        Thread.sleep(1000);
        String totalDueNowAmount = cust.getTotalDue();
        logger.log(LogStatus.PASS, "Total due now amount  in customer dashbaord is---> :" + totalDueNowAmount);

        Double db3 = new Double(payment.getDoubleAmount(totalDueNowAmount));

        if (db3.intValue() == 0) {

            String sap = Generic_Class.takeScreenShotPath();
            String mag = logger.addScreenCapture(sap);
            logger.log(LogStatus.PASS,
                    "Payment done  successfully and changes reflecting in customer dash board");
            logger.log(LogStatus.INFO,
                    "Payment done  successfully and changes reflecting in customer dash board", mag);
        } else {

            if (resultFlag.equals("pass"))
                resultFlag = "fail";

            String scan = Generic_Class.takeScreenShotPath();
            String mg = logger.addScreenCapture(scan);
            logger.log(LogStatus.FAIL, "Payment not done successfully ");
            logger.log(LogStatus.INFO, "Payment not done successfully ", mg);
        }

        Thread.sleep(1000);

        // Verify Total Due Now is available

        if (cust.getTotalDueNowTxt().contains("Total Due Now")) {
            Thread.sleep(2000);
            String scp = Generic_Class.takeScreenShotPath();

            String img = logger.addScreenCapture(scp);
            logger.log(LogStatus.PASS,
                    "Total Due Now is displayed successfully" + cust.getCustDashboardTitle());
            logger.log(LogStatus.PASS, "Total Due Now is displayed successfully", img);
        }

        else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";

            String scp = Generic_Class.takeScreenShotPath();

            String im = logger.addScreenCapture(scp);
            logger.log(LogStatus.FAIL, "Total Due Now is not displayed successfully");
            logger.log(LogStatus.FAIL, "Total Due Now is not displayed successfully", im);
        }

        // Verify Next Due is available

        if (cust.getNextPaymentDueTxt().contains("Next Payment Due")) {
            Thread.sleep(2000);
            String scp = Generic_Class.takeScreenShotPath();

            String img = logger.addScreenCapture(scp);
            logger.log(LogStatus.PASS,
                    "Next Payment Due is displayed successfully" + cust.getCustDashboardTitle());
            logger.log(LogStatus.PASS, "Next Payment Due is displayed successfully", img);
        }

        else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";
            String sc = Generic_Class.takeScreenShotPath();

            String im = logger.addScreenCapture(sc);
            logger.log(LogStatus.FAIL, "Next Payment Due is not displayed successfully");
            logger.log(LogStatus.FAIL, "Next Payment Due is not displayed successfully", im);
        }

        // Verify Make Payment is available
        if (cust.getMakePaymentTxt().contains("Make Payment")) {
            Thread.sleep(4000);
            String sc = Generic_Class.takeScreenShotPath();

            String im = logger.addScreenCapture(sc);
            logger.log(LogStatus.PASS, "Make Payment is displayed successfully" + cust.getCustDashboardTitle());
            logger.log(LogStatus.PASS, "Make Payment is displayed successfully", im);
        }

        else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";
            String sc = Generic_Class.takeScreenShotPath();

            String im = logger.addScreenCapture(sc);
            logger.log(LogStatus.FAIL, "Make Payment is not displayed successfully");
            logger.log(LogStatus.FAIL, "Make Payment is not displayed successfully", im);
        }

        // Verify Manage AutoPay is available

        if (cust.getManageAutoPayTxt().contains("Manage AutoPay")) {
            Thread.sleep(2000);
            String st = Generic_Class.takeScreenShotPath();

            String im = logger.addScreenCapture(st);
            logger.log(LogStatus.PASS,
                    "Manage AutoPay is displayed successfully" + cust.getCustDashboardTitle());
            logger.log(LogStatus.PASS, "Manage AutoPay is displayed successfully", im);
        }

        else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";
            String st = Generic_Class.takeScreenShotPath();

            String im = logger.addScreenCapture(st);
            logger.log(LogStatus.FAIL, "Manage AutoPay is not displayed successfully");
            logger.log(LogStatus.FAIL, "Manage AutoPay is not displayed successfully", im);
        }

        // Verify Create Note is available

        if (cust.getCreateNoteTxt().contains("Create Note")) {
            Thread.sleep(2000);
            String sc = Generic_Class.takeScreenShotPath();

            String im = logger.addScreenCapture(sc);
            logger.log(LogStatus.PASS, "Create Note is displayed successfully" + cust.getCustDashboardTitle());
            logger.log(LogStatus.PASS, "Create Note is displayed successfully", im);
        }

        else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";
            String sc = Generic_Class.takeScreenShotPath();

            String im = logger.addScreenCapture(sc);
            logger.log(LogStatus.FAIL, "Create Note is not displayed successfully");
            logger.log(LogStatus.FAIL, "Create Note is not displayed successfully", im);
        }

        // Verify Important Information is available

        if (cust.getImportantInformationTxt().contains("Important Information")) {
            Thread.sleep(2000);
            String sch = Generic_Class.takeScreenShotPath();

            String ie = logger.addScreenCapture(sch);
            logger.log(LogStatus.PASS,
                    "Important Information is displayed successfully" + cust.getCustDashboardTitle());
            logger.log(LogStatus.PASS, "Important Information is displayed successfully", ie);
        }

        else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";
            String sch = Generic_Class.takeScreenShotPath();

            String imge = logger.addScreenCapture(sch);
            logger.log(LogStatus.FAIL, "Important Information is not displayed successfully");
            logger.log(LogStatus.FAIL, "Important Information is not displayed successfully", imge);
        }

        // Verify Customer Info Tab is available
        if (cust.getCustomerInfoTabTxt().contains("Customer Info")) {
            Thread.sleep(2000);
            String sch = Generic_Class.takeScreenShotPath();

            String ie = logger.addScreenCapture(sch);
            logger.log(LogStatus.PASS,
                    "Customer Info tab displayed successfully" + cust.getCustomerInfoTabTxt());
            logger.log(LogStatus.PASS, "Customer Info tab displayed successfully", ie);
        }

        else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";
            String scr = Generic_Class.takeScreenShotPath();

            String im = logger.addScreenCapture(scr);
            logger.log(LogStatus.FAIL, "Customer Info tab not  displayed successfully");
            logger.log(LogStatus.FAIL, "Customer Info tab not displayed successfully", im);
        }

        // Verify Space Details tab is available
        if (cust.getSpaceDetailsTabTxt().contains("Space Details")) {
            Thread.sleep(2000);
            String scp = Generic_Class.takeScreenShotPath();

            String im = logger.addScreenCapture(scp);
            logger.log(LogStatus.PASS,
                    " Space Details tab displayed successfully" + cust.getSpaceDetailsTabTxt());
            logger.log(LogStatus.PASS, " Space Details tab displayed successfully", im);
        }

        else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";
            String sr = Generic_Class.takeScreenShotPath();

            String im = logger.addScreenCapture(sr);
            logger.log(LogStatus.FAIL, "Space Details tab not  displayed successfully");
            logger.log(LogStatus.FAIL, "Space Details  tab not displayed successfully", im);
        }

        // Verify Account Activities tab is available
        if (cust.getAccountActivitiesTabTxt().contains("Account Activities")) {
            Thread.sleep(2000);
            String scp = Generic_Class.takeScreenShotPath();

            String im = logger.addScreenCapture(scp);
            logger.log(LogStatus.PASS,
                    " Account Activitiestab displayed successfully" + cust.getAccountActivitiesTabTxt());
            logger.log(LogStatus.PASS, " Account Activities tab displayed successfully", im);
        }

        else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";
            String sc = Generic_Class.takeScreenShotPath();

            String im = logger.addScreenCapture(sc);
            logger.log(LogStatus.FAIL, "Account Activities tab not  displayed successfully");
            logger.log(LogStatus.FAIL, "Account Activities tab not displayed successfully", im);
        }

        // Verify Documents tab is available

        if (cust.getDocumentsTabTxt().contains("Documents")) {
            Thread.sleep(2000);
            String sc = Generic_Class.takeScreenShotPath();

            String im = logger.addScreenCapture(sc);
            logger.log(LogStatus.PASS, "  Documents tab displayed successfully" + cust.getDocumentsTabTxt());
            logger.log(LogStatus.PASS, " Documents tab displayed successfully", im);
        }

        else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";
            String sc = Generic_Class.takeScreenShotPath();
            String im = logger.addScreenCapture(sc);
            logger.log(LogStatus.FAIL, "Documents tab not  displayed successfully");
            logger.log(LogStatus.FAIL, "Documents tab not displayed successfully", im);
        }

        if (cust.getCustSpaceNum().trim().contains(space)) {
            logger.log(LogStatus.PASS,
                    "Application is displaying correct space number in the customer dashboard");
        } else {

            logger.log(LogStatus.PASS,
                    "Application is not displaying correct space number in the customer dashboard");
        }

        if (cust.getEmailid(tabledata.get("Email"))) {

            logger.log(LogStatus.PASS, "Application is displaying correct email id in the customer info tab");
        } else {

            logger.log(LogStatus.FAIL,
                    "Application is not displaying correct email id in the customer info tab");
        }

    } catch (Exception e) {
        resultFlag = "fail";
        String scpath = Generic_Class.takeScreenShotPath();
        String image = logger.addScreenCapture(scpath);
        logger.log(LogStatus.FAIL, "PM Dash board page is not displayed", image);
        e.printStackTrace();
    }

}

From source file:Scenarios.Payments.Payments_NewIndCustSingleSpace_CashAnniversary.java

@Test(dataProvider = "getLoginData")
public void Payments_NewIndCustSingleSpace_CashAnniversary(Hashtable<String, String> tabledata)
        throws Exception {

    if (!(tabledata.get("Runmode").equals("Y") && tabledata.get("Payments").equals("Y"))) {
        resultFlag = "skip";
        logger.log(LogStatus.SKIP, "Payments_NewIndCustSingleSpace_CashAnniversary is Skipped");
        throw new SkipException("Skipping the test Payments_NewIndCustSingleSpace_CashAnniversary");
    }//from w ww  .  j a  v  a2  s  .c  o m

    Reporter.log("Test Case Started", true);
    Thread.sleep(5000);

    try {

        logger = extent.startTest("Payments_NewIndCustSingleSpace_CashAnniversary",
                "New individual customer make payment using cash anniversary pay");
        testcaseName = tabledata.get("TestCases");
        Reporter.log("Test case started: " + testcaseName, true);
        Thread.sleep(5000);
        JavascriptExecutor jse = (JavascriptExecutor) driver;
        LoginPage loginPage = new LoginPage(driver);
        logger.log(LogStatus.PASS, "creating object for the Login Page sucessfully ");
        Thread.sleep(2000);
        loginPage.enterUserName(tabledata.get("UserName"));
        Thread.sleep(2000);
        logger.log(LogStatus.PASS, "entered username sucessfully");
        Thread.sleep(2000);
        loginPage.enterPassword(tabledata.get("Password"));
        logger.log(LogStatus.PASS, "entered password sucessfully");
        Thread.sleep(2000);
        loginPage.clickLogin();
        logger.log(LogStatus.PASS, "clicked on login in button sucessfully");
        logger.log(LogStatus.PASS, "Login to Application  successfully");

        //=================Handling customer facing device========================
        Thread.sleep(5000);
        Dashboard_BifrostHostPopUp Bifrostpop = new Dashboard_BifrostHostPopUp(driver);
        logger.log(LogStatus.INFO, "PopUp window object is created successfully");
        String biforstNum = Bifrostpop.getBiforstNo();

        Reporter.log(biforstNum + "", true);

        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, "t");
        ArrayList<String> tabs = new ArrayList<String>(driver.getWindowHandles());
        Reporter.log(tabs.size() + "", true);
        driver.switchTo().window(tabs.get(1));
        driver.get(Generic_Class.getPropertyValue("CustomerScreenPath"));

        List<WebElement> biforstSystem = driver.findElements(
                By.xpath("//div[@class='scrollable-area']//span[@class='bifrost-label vertical-center']"));
        for (WebElement ele : biforstSystem) {
            if (biforstNum.equalsIgnoreCase(ele.getText().trim())) {
                Reporter.log(ele.getText() + "", true);
                ele.click();
                break;
            }
        }

        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        Thread.sleep(5000);
        driver.switchTo().window(tabs.get(0));
        Thread.sleep(5000);
        driver.findElement(By.xpath(
                "//div[@id='cfsConnectionDialog']//div[@class='after-connected padding-top']//p/input[@class='psbutton-low-priority']"))
                .click();
        Thread.sleep(5000);
        // =================================================================================

        Thread.sleep(3000);
        PM_Homepage pmhomepage = new PM_Homepage(driver);
        logger.log(LogStatus.PASS, "creating object for the PM home page sucessfully");

        Thread.sleep(3000);
        if (pmhomepage.isexistingCustomerModelDisplayed()) {
            String scpath = Generic_Class.takeScreenShotPath();
            String image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.PASS, "PM DashBoard dispalyed sucessfully");
            logger.log(LogStatus.INFO, "PM DashBoard dispalyed sucessfully", image);
        } else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";
            String scpath = Generic_Class.takeScreenShotPath();
            String image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.FAIL, "PM DashBoard dispalyed  is not displayed");
            logger.log(LogStatus.INFO, "PM DashBoard dispalyed  is not displayed", image);
        }

        pmhomepage.clk_findAndLeaseSpace();
        logger.log(LogStatus.INFO, "Click on Find And Lease Space Link successfully");

        Thread.sleep(4000);
        StandardStoragePage stdStorage = new StandardStoragePage(driver);
        logger.log(LogStatus.PASS, "Creating object for the Standard stroage page sucessfully");
        Thread.sleep(1000);
        if (stdStorage.isSelected_yesradiobutton()) {

            logger.log(LogStatus.PASS,
                    "New Customer Radio button selected by default when WALK-INS: FIND A SPACE page is launched sucessfully");

        } else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";

            logger.log(LogStatus.FAIL,
                    "New Customer Radio button is not selected by default when WALK-INS: FIND A SPACE page is launched sucessfully");
        }

        stdStorage.Clk_ChkBx_AvlSpace();
        logger.log(LogStatus.PASS,
                "Clicked on available bold space size  checkbox in StandardStorage sucessfully");

        stdStorage.click_Search();
        logger.log(LogStatus.INFO, "Click on search button successfully");

        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");

        // =====================Fetching space number and based on that clicking the radio button========================
        Thread.sleep(10000);
        List<WebElement> norows = driver
                .findElements(By.xpath("//form[@id='frmReserveUnits']//div//table/tbody/tr"));
        String space = null;
        logger.log(LogStatus.INFO, "Total number of avaiable sizes count is------>:" + norows.size());
        if (norows.size() > 0) {
            Thread.sleep(5000);

            space = driver.findElement(By.xpath("//form[@id='frmReserveUnits']//div//table/tbody/tr[1]/td[4]"))
                    .getText();

            Reporter.log("space number is:" + space, true);
        } else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";

            logger.log(LogStatus.FAIL,
                    "Application is not populating any data/space details with selected size dimension");
            throw new Exception("Application is not populating any data/space details");

        }
        Thread.sleep(2000);
        WebElement RdBtn_Space = driver.findElement(By.xpath(
                "//td[@class='grid-cell-space'][text()='" + space + "']/../td/input[@name='selectedIds']"));
        logger.log(LogStatus.PASS,
                "check the radio button based on the space and click on the  reservation button");
        Thread.sleep(5000);
        jse.executeScript("arguments[0].scrollIntoView()", RdBtn_Space);
        jse.executeScript("arguments[0].click();", RdBtn_Space);

        logger.log(LogStatus.PASS, "Clicked on check box of a space in this location:-------> " + space);
        Reporter.log("Clicked on check box of a space in this location: " + space, true);
        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");
        Thread.sleep(3000);
        SpaceDashboard_ThisLoc thisloc = new SpaceDashboard_ThisLoc(driver);
        logger.log(LogStatus.PASS, "creating object for the This location page sucessfully");
        thisloc.click_Rent();
        logger.log(LogStatus.PASS, "clicked on the rent button sucessfully");
        Thread.sleep(5000);

        Leasing_ConfirmSpace confirmSpace = new Leasing_ConfirmSpace(driver);
        Thread.sleep(5000);
        confirmSpace.clk_ConfirmwtCust();

        logger.log(LogStatus.PASS, "Clicked on Confirm with Customer button");
        Reporter.log("Clicked on Confirm with Customer button", true);

        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        Thread.sleep(5000);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.PASS, "Switched to Customer Screen");
        Reporter.log("Switched to Customer Screen", true);
        Thread.sleep(9000);
        driver.findElement(
                By.xpath("//div[@class='footer-row clearfix-container']/button[@id='confirmButton']")).click();
        logger.log(LogStatus.PASS, "Clicked on Confirm button in customer screen");
        Reporter.log("Clicked on Confirm button in customer screen", true);

        Thread.sleep(8000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        driver.switchTo().window(tabs.get(0));
        logger.log(LogStatus.PASS, "Switching back to screen");
        Reporter.log("Switching back to screen", true);

        // Filling contact information

        Leasing_ContactInfoPage contactinfo = new Leasing_ContactInfoPage(driver);
        Thread.sleep(5000);
        String FN = "AUT" + Generic_Class.get_RandmString();
        contactinfo.txt_Fname(FN);
        contactinfo.txt_Lname(tabledata.get("LastName"));
        contactinfo.clickContact_State();
        List<WebElement> allstates = driver.findElements(
                By.xpath("//ul[@id='ContactForm_Identification_StateTypeID_listbox']/li[@class='k-item']"));

        // Identify the WebElement which will appear after scrolling down

        for (WebElement state : allstates) {
            Thread.sleep(2000);
            if (tabledata.get("StateCode").equalsIgnoreCase(state.getText())) {
                state.click();
                break;
            }
        }

        // contactinfo.select_State(tabledata.get("StateCode"));
        contactinfo.txt_Number(tabledata.get("DrivingLicenseNum"));
        contactinfo.txt_street1(tabledata.get("Street"));
        contactinfo.txt_city(tabledata.get("City"));

        contactinfo.select_State2address();
        List<WebElement> allstatesadd = driver
                .findElements(By.xpath("//ul[@id='lesseeinfo-address-statecode_listbox']/li[@class='k-item']"));

        for (WebElement state : allstatesadd) {
            Thread.sleep(2000);
            if (tabledata.get("StateCode").equalsIgnoreCase(state.getText())) {
                state.click();
                break;
            }
        }

        // contactinfo.select_State2(tabledata.get("State"));
        Thread.sleep(3000);
        contactinfo.txt_Zipcode(tabledata.get("Zipcode"));
        contactinfo.select_phoneType1();
        Thread.sleep(3000);

        driver.findElement(
                By.xpath("//ul[@class='k-list k-reset ps-container ps-active-y']/li[contains(text(),'"
                        + tabledata.get("PhoneType") + " ')]"))
                .click();
        Thread.sleep(2000);
        contactinfo.txt_AreaCode(tabledata.get("Areacode"));
        Thread.sleep(2000);
        contactinfo.txt_Exchg(tabledata.get("Exchange"));
        Thread.sleep(2000);
        contactinfo.txt_lineNumber(tabledata.get("LineNumber"));
        Thread.sleep(2000);
        contactinfo.txt_email(tabledata.get("Email"));
        Thread.sleep(2000);
        contactinfo.click_CustLookUp();

        Thread.sleep(15000);
        // Click on New Customer button on Choose an Account PopUp
        driver.findElement(By.linkText("Create New Customer")).click();

        Thread.sleep(8000);
        contactinfo.clk_ActiveDutyMilitaryNoRadioBtn(driver);

        // Click on Verify button
        Thread.sleep(5000);
        driver.findElement(By.partialLinkText("Verify")).click();
        logger.log(LogStatus.INFO, "cliked on the Verify button button ");

        Thread.sleep(9000);
        driver.findElement(By.id("confirmWithCustomerButton")).click();

        Thread.sleep(5000);
        // Click on Confirm with Cust button

        logger.log(LogStatus.INFO, "clicking on Confirm with cust button successfully");

        // Navigating to Customer screen
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        Thread.sleep(8000);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully");

        Thread.sleep(6000);
        driver.findElement(By.id("confirmButton")).click();
        logger.log(LogStatus.INFO, "clicking on Confirm button successfully");

        Thread.sleep(5000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        driver.switchTo().window(tabs.get(0));
        logger.log(LogStatus.INFO, "Switch to Main page successfully");

        // Entering Emergency Contact details
        Thread.sleep(5000);
        Leasing_EmergencyConatctsPage emergCon = new Leasing_EmergencyConatctsPage(driver);
        Thread.sleep(2000);

        emergCon.clickAuthorizedfor_radio();
        Thread.sleep(2000);
        emergCon.click_custDeclines_chkBox();

        emergCon.clickconfirmWithCust();
        Thread.sleep(4000);

        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        Thread.sleep(8000);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully");

        Thread.sleep(8000);
        driver.findElement(By.id("confirmButton")).click();
        logger.log(LogStatus.INFO, "clicking on Confirm button successfully");

        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        Thread.sleep(2000);
        driver.switchTo().window(tabs.get(0));
        logger.log(LogStatus.INFO, "Switch to Main page successfully");

        Leasing_AuthorizedAccessContactsPage autContact = new Leasing_AuthorizedAccessContactsPage(driver);

        Thread.sleep(8000);
        autContact.clickSavenProceed();

        Thread.sleep(8000);
        Leasing_EligiblePromotionsPage eligpromo = new Leasing_EligiblePromotionsPage(driver);

        logger.log(LogStatus.PASS, "Validating Monthly rent and Promotions in Eligible Promotion Page");

        eligpromo.clickSavenProceed();

        Thread.sleep(8000);

        Leasing_LeaseQuestionairePage leaseQues = new Leasing_LeaseQuestionairePage(driver);

        leaseQues.clickStorageContent();

        Thread.sleep(5000);

        List<WebElement> allstorage = driver.findElements(By.xpath(
                "//ul[@id='LeaseQuestionnaireUnits_0__RentalUnitContentsTypeID_listbox']//li[@class='k-item']"));

        for (WebElement storage : allstorage) {
            if (tabledata.get("StorageContent").equalsIgnoreCase(storage.getText())) {
                storage.click();
                break;
            }
        }

        // Insurance is ON

        Thread.sleep(5000);
        leaseQues.clickAddInsuranceYes();

        Thread.sleep(1000);
        leaseQues.clickCoverageList();
        Thread.sleep(5000);

        driver.findElement(By.xpath("//ul[@id='LeaseQuestionnaireUnits_0__InsuranceSelection_listbox']/li[2]"))
                .click();

        Thread.sleep(5000);

        leaseQues.clickAccessZone();
        Thread.sleep(2000);

        driver.findElement(
                By.xpath("//ul[@id='LeaseQuestionnaireUnits_0__GateControllerTimeZoneID_listbox']//li[2]"))
                .click();

        Thread.sleep(5000);
        leaseQues.clickKeypadZone();
        Thread.sleep(2000);
        driver.findElement(
                By.xpath("//li[contains(@id,'KeypadZone_option_selected')]/following-sibling::li[1]")).click();

        Thread.sleep(5000);
        leaseQues.clickConfirmCust();

        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        Thread.sleep(8000);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully");

        Thread.sleep(6000);
        driver.findElement(By.id("confirmButton")).click();
        logger.log(LogStatus.INFO, "clicking on Confirm button successfully");

        Thread.sleep(12000);
        List<WebElement> allCheckbox = driver.findElements(
                By.xpath("//section[@class='term-group term-group--active']//input[@type='checkbox']"));

        for (WebElement checkbox : allCheckbox) {
            checkbox.click();
        }
        Thread.sleep(5000);
        driver.findElement(By.id("confirmButton")).click();

        Thread.sleep(3000);
        WebElement signature = driver.findElement(
                By.xpath("//div[@class='sig sigWrapper']/canvas[@class='pad js-signature-canvas']"));
        Actions actionBuilder = new Actions(driver);
        Action drawAction = actionBuilder.moveToElement(signature, 660, 96).click().clickAndHold(signature)
                .moveByOffset(120, 120).moveByOffset(60, 70).moveByOffset(-140, -140).release(signature)
                .build();
        drawAction.perform();

        Thread.sleep(4000);
        driver.findElement(By.id("confirmButton")).click();
        Thread.sleep(5000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        Thread.sleep(6000);
        driver.switchTo().window(tabs.get(0));

        Leasing_ReviewNApprovePage review = new Leasing_ReviewNApprovePage(driver);

        Thread.sleep(8000);
        review.clickApprove_btn();

        Thread.sleep(8000);
        review.clickSaveproceed_btn();

        Leasing_RentalFeePage rentalfee = new Leasing_RentalFeePage(driver);

        Thread.sleep(15000);
        logger.log(LogStatus.PASS, "Validating Monthly rent and Promotions in Eligible Promotion Page");

        rentalfee.clickConfirmCust_btn();
        Thread.sleep(8000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully");

        Thread.sleep(6000);
        driver.findElement(By.id("confirmButton")).click();
        logger.log(LogStatus.INFO, "clicking on Confirm button successfully");

        Thread.sleep(5000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        driver.switchTo().window(tabs.get(0));
        logger.log(LogStatus.INFO, "Switch to Main page successfully");
        Thread.sleep(8000);
        Leasing_PaymentMethodsPage payment = new Leasing_PaymentMethodsPage(driver);
        logger.log(LogStatus.PASS, "creating object for the Login Page sucessfully ");
        Thread.sleep(2000);

        String scpath = Generic_Class.takeScreenShotPath();
        String image = logger.addScreenCapture(scpath);
        logger.log(LogStatus.PASS, "Payment page is dispalyed sucessfully ");
        logger.log(LogStatus.INFO, "Payment page is dispalyed sucessfully", image);

        payment.clk_PayThroughdropdwn();
        logger.log(LogStatus.INFO, "Clicked on payment clk_PayThroughdropdwn dropdown ");
        Thread.sleep(2000);

        // Anniversary payment option in dropdown
        int numberOfPixelsToDragTheScrollbarDown1 = 120;

        Actions dragger1 = new Actions(driver);
        WebElement draggablePartOfScrollbar1 = driver.findElement(By.xpath(
                "//ul[@class='k-list k-reset ps-container ps-active-y']//div[@class='ps-scrollbar-y-rail']//div[@class='ps-scrollbar-y']"));
        Thread.sleep(3000);
        List<WebElement> dates1 = driver
                .findElements(By.xpath("//div[@class='k-animation-container']//ul//li"));
        Thread.sleep(3000);
        dragger1.moveToElement(draggablePartOfScrollbar1).clickAndHold()
                .moveByOffset(0, numberOfPixelsToDragTheScrollbarDown1).release().build().perform();
        Thread.sleep(3000);
        driver.findElement(By.xpath("//div[@class='k-animation-container']//ul//li[13]")).click();

        Thread.sleep(4000);
        driver.findElement(By.xpath("//span[text()='Add/Edit Cart']")).click();
        logger.log(LogStatus.INFO, "Clicked on payment Add Merchandise link ");
        Thread.sleep(3000);
        driver.findElement(By.xpath(
                "//div[div[div[div[text()='Lock Disc']]]]//input[@class='product-quantity webchamp-textbox']"))
                .sendKeys("1");
        logger.log(LogStatus.INFO, "entering number of quantity in the textbox ");
        Thread.sleep(3000);
        driver.findElement(By.id("MerchandiseWindow-AddToCart")).click();
        logger.log(LogStatus.INFO, "Clicked on payment Add to cart link ");
        Thread.sleep(4000);
        driver.findElement(By.xpath("//a[text()='Close']")).click();
        logger.log(LogStatus.INFO, "clicked on the close button in the merchadise window ");
        Thread.sleep(5000);
        String MonthlyRentDueNowAmount = payment.get_MonthlyRentDueNowAmt();
        logger.log(LogStatus.PASS,
                "Monthly Rent Due Now amount in payment page is------>:" + MonthlyRentDueNowAmount);

        String PromotionDueNowAmount = payment.get_PromotionDueNowAmt();
        logger.log(LogStatus.PASS,
                "Promotion  Due Now amount in payment page is------>:" + PromotionDueNowAmount);

        String InsuranceNowAmount = payment.get_InsuranceDueNowAmt();
        logger.log(LogStatus.PASS, "Insurance  Due Now amount in payment page is------>:" + InsuranceNowAmount);

        String AdministrativeDueNowAmount = payment.get_AdministrativeDueNowAmt();
        logger.log(LogStatus.PASS,
                "Administrative  Due Now amount in payment page is------>:" + AdministrativeDueNowAmount);

        String PayThroughDueNowAmount = payment.get_PaythroughDueNowAmt();
        logger.log(LogStatus.PASS,
                "PayThrough  Due Now amount in payment page is------>:" + PayThroughDueNowAmount);

        String MerchandiseAmount = payment.get_MerchandiseAmt();
        logger.log(LogStatus.PASS, "MerchandiseAmount  amount in payment page is------>:" + MerchandiseAmount);

        String SalexTaxAmount = payment.get_SalesTaxAmt();
        logger.log(LogStatus.PASS, "SalexTax Amount  in payment page is------>:" + SalexTaxAmount);

        String TotalRemaingBalanceAmt = payment.get_TotalRemaingBalanceAmt();
        logger.log(LogStatus.PASS,
                "Total Remaing Balance Amount  in payment page is------>:" + TotalRemaingBalanceAmt);

        double MonthlyRentamt = payment.getDoubleAmount(MonthlyRentDueNowAmount);
        double Promotionamt = payment.getDoubleAmount(PromotionDueNowAmount);
        double Insuranceamt = payment.getDoubleAmount(InsuranceNowAmount);
        double Administrativeamt = payment.getDoubleAmount(AdministrativeDueNowAmount);
        double Apythroughamt = payment.getDoubleAmount(PayThroughDueNowAmount);
        double Merchandiseamt = payment.getDoubleAmount(MerchandiseAmount);
        double SalexTaxamt = payment.getDoubleAmount(SalexTaxAmount);

        double TotalAmount = MonthlyRentamt + Promotionamt + Insuranceamt + Administrativeamt + Apythroughamt
                + Merchandiseamt + SalexTaxamt;
        double TotalRemUiVal = payment.getDoubleAmount(TotalRemaingBalanceAmt);

        Double db1 = new Double(TotalAmount);
        Double db2 = new Double(TotalRemUiVal);
        if (db1.intValue() == db2.intValue()) {

            String sc = Generic_Class.takeScreenShotPath();
            String im = logger.addScreenCapture(sc);
            logger.log(LogStatus.PASS, "Sumantion of all due amount and Total remaing amount are equal");
            logger.log(LogStatus.INFO, "Sumantion of all due amount and Total remaing amount are equal", im);
        } else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";
            String scp = Generic_Class.takeScreenShotPath();
            String ima = logger.addScreenCapture(scp);
            logger.log(LogStatus.FAIL, "Sumantion of all due is amount and Total remaing amount are not equal");
            logger.log(LogStatus.INFO, "Sumantion of all due is amount and Total remaing amount are not equal",
                    ima);
        }

        Thread.sleep(3000);
        payment.selectPaymentMethod("Cash", driver);
        logger.log(LogStatus.PASS, "selecting cash option from the dropdown");

        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");
        Thread.sleep(3000);
        payment.enter_CashAmount(TotalRemaingBalanceAmt);
        logger.log(LogStatus.PASS, "entered total balance amount to pay");
        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");
        Thread.sleep(3000);
        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");
        payment.clickApply_btn();
        logger.log(LogStatus.PASS, "clicked on the apply button");
        Thread.sleep(3000);
        payment.clk_ConfirmWthCustBtn();
        logger.log(LogStatus.PASS, "clicked on the ConfirmWthCustBtn button");
        Thread.sleep(8000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully");

        Thread.sleep(6000);
        driver.findElement(By.id("confirmButton")).click();
        logger.log(LogStatus.INFO, "clicking on Confirm button successfully");

        Thread.sleep(5000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        driver.switchTo().window(tabs.get(0));
        logger.log(LogStatus.INFO, "Switch to Main page successfully");
        Thread.sleep(5000);

        payment.clickSubmit_btn();
        logger.log(LogStatus.PASS, "clicked on the submit button in payment page");
        Thread.sleep(3000);

        TransactionCompletePopup popup = new TransactionCompletePopup(driver);

        String path = Generic_Class.takeScreenShotPath();
        String ima = logger.addScreenCapture(path);
        logger.log(LogStatus.PASS, "TransactionCompletePopup  dispalyed sucessfully");
        logger.log(LogStatus.INFO, "TransactionCompletePopup dispalyed sucessfully", ima);

        popup.enterEmpNum(tabledata.get("UserName"));
        logger.log(LogStatus.PASS, "entered the employee id");
        Thread.sleep(3000);
        popup.clickOk_btn();
        logger.log(LogStatus.PASS, "clicked on the ok button");
        Thread.sleep(3000);
        driver.findElement(By.xpath("//div[@class='k-widget k-window']//a[contains(text(),'No')]")).click();

        Thread.sleep(8000);

        if (pmhomepage.isexistingCustomerModelDisplayed()) {
            String pa = Generic_Class.takeScreenShotPath();
            String img1 = logger.addScreenCapture(pa);
            logger.log(LogStatus.PASS, "PM DashBoard dispalyed sucessfully");
            logger.log(LogStatus.INFO, "PM DashBoard dispalyed sucessfully", img1);
        } else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";
            String scp = Generic_Class.takeScreenShotPath();
            String imag = logger.addScreenCapture(scp);
            logger.log(LogStatus.FAIL, "PM DashBoard dispalyed  is not displayed");
            logger.log(LogStatus.INFO, "PM DashBoard dispalyed  is not displayed", imag);
        }

        Thread.sleep(2000);
        pmhomepage.clk_AdvSearchLnk();
        logger.log(LogStatus.PASS, "clicked on the submit button");

        Thread.sleep(6000);

        Advance_Search advSearch = new Advance_Search(driver);

        String sqlQuery = "selectaccountidfromaccountwherecustomerid=(selectcustomeridfromcustomerwherecontactid=(selectcontactidfromcontactwherefirstname='"
                + FN + "'andlastname='" + tabledata.get("LastName") + "'))";

        String accNUm = DataBase_JDBC.executeSQLQuery(sqlQuery);
        Thread.sleep(6000);
        logger.log(LogStatus.PASS, "fetched account number from databse and account number is:" + accNUm);

        advSearch.enterAccNum(accNUm);
        logger.log(LogStatus.PASS, "entered account number");

        Thread.sleep(5000);

        advSearch.clickSearchAccbtn();
        logger.log(LogStatus.PASS, "clicked on the search button in advance search page");

        Cust_AccDetailsPage cust = new Cust_AccDetailsPage(driver);
        Thread.sleep(8000);
        if (cust.isCustdbTitleDisplayed()) {

            String sap = Generic_Class.takeScreenShotPath();
            String mag = logger.addScreenCapture(sap);
            logger.log(LogStatus.PASS, "customer Dashboard is displayed successfully");
            logger.log(LogStatus.INFO, "customer Dashboard is displayed successfully", mag);
        } else {

            if (resultFlag.equals("pass"))
                resultFlag = "fail";

            String scan = Generic_Class.takeScreenShotPath();
            String mg = logger.addScreenCapture(scan);
            logger.log(LogStatus.FAIL, "customer Dashboard is not displayed ");
            logger.log(LogStatus.INFO, "customer Dashboard is not displayed ", mg);
        }

        Thread.sleep(1000);
        String totalDueNowAmount = cust.getTotalDue();
        logger.log(LogStatus.PASS, "Total due now amount  in customer dashbaord is---> :" + totalDueNowAmount);

        Double db3 = new Double(payment.getDoubleAmount(totalDueNowAmount));

        if (db3.intValue() == 0) {

            String sap = Generic_Class.takeScreenShotPath();
            String mag = logger.addScreenCapture(sap);
            logger.log(LogStatus.PASS,
                    "Payment done  successfully and changes reflecting in customer dash board");
            logger.log(LogStatus.INFO,
                    "Payment done  successfully and changes reflecting in customer dash board", mag);
        } else {

            if (resultFlag.equals("pass"))
                resultFlag = "fail";

            String scan = Generic_Class.takeScreenShotPath();
            String mg = logger.addScreenCapture(scan);
            logger.log(LogStatus.FAIL, "Payment not done successfully ");
            logger.log(LogStatus.INFO, "Payment not done successfully ", mg);
        }

        Thread.sleep(1000);

        cust.click_AccountActivities();
        ;
        logger.log(LogStatus.INFO, "Clicked on Account Activities tab in customer dashboard screen");

        Thread.sleep(9000);

        WebElement ele = driver.findElement(By.xpath("//td[contains(text(),'Cash')]/preceding-sibling::td/a"));
        ele.click();
        logger.log(LogStatus.INFO, "Clicked on expand button in first row based on the payment type");

        Thread.sleep(6000);

        cust.clk_ReversePaymntLnk();
        logger.log(LogStatus.INFO, "Clicked on Reverse Payment link");

        Thread.sleep(8000);
        ReversePayment ReversePayment = new ReversePayment(driver);
        boolean rev = driver.findElement(By.xpath("//h3[contains(text(),'Reverse Payment')]")).isDisplayed();
        if (rev) {
            String scp = Generic_Class.takeScreenShotPath();
            String img = logger.addScreenCapture(scp);
            logger.log(LogStatus.PASS, "Reverse Payment screen is displayed successfully");
            logger.log(LogStatus.INFO, "Reverse Payment screen is displayed successfully", img);
        } else {

            if (resultFlag.equals("pass"))
                resultFlag = "fail";

            String sc = Generic_Class.takeScreenShotPath();
            String im = logger.addScreenCapture(sc);
            logger.log(LogStatus.FAIL, "Reverse Payment screen is not displayed ");
            logger.log(LogStatus.INFO, "Reverse Payment screen is not displayed ", im);

        }

        Thread.sleep(3000);
        ReversePayment.Clk_RdBtn_Yes();
        logger.log(LogStatus.INFO, "clicked on the yes rdio button in reverse payment sucessfully");

        ReversePayment.Clk_ReasonDrpDwn();
        logger.log(LogStatus.INFO, "Clicked on Reason drop down");

        ReversePayment.SelectValueFromReasonList("Misapplied Payment");
        logger.log(LogStatus.INFO, "Select value from Reason dropdown");

        ReversePayment
                .enterNote("PM received a Bad money from bank for a customer payment so reversing the payment");
        logger.log(LogStatus.INFO, "Entered reason for reverse payment note");

        ReversePayment.clk_ConfirmWithCustomerBtn();
        logger.log(LogStatus.INFO,
                "clicked on the confirm with customer button in reverse payment page sucessfully");

        Thread.sleep(6000);
        driver.switchTo().window(tabs.get(1));
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully");
        Thread.sleep(6000);

        boolean revheader = driver
                .findElement(By.xpath("//h2[contains(text(),'Transaction Reversed. Thank you!')]"))
                .isDisplayed();

        if (revheader) {

            String scr = Generic_Class.takeScreenShotPath();
            String ime = logger.addScreenCapture(scr);
            logger.log(LogStatus.PASS, "Transaction Reversed Thank you! screen is displayed successfully");
            logger.log(LogStatus.INFO, "Transaction Reversed Thank you! screen is displayed successfully", ime);

        } else {

            if (resultFlag.equals("pass"))
                resultFlag = "fail";

            String screen = Generic_Class.takeScreenShotPath();
            String imag = logger.addScreenCapture(screen);
            logger.log(LogStatus.FAIL, "Transaction Reversed Thank you! screen is not displayed ");
            logger.log(LogStatus.INFO, "Transaction Reversed Thank you! screen is not displayed ", imag);

        }

        WebElement signatures = driver
                .findElement(By.xpath("//div[@class='signature-area']/canvas[@class='signature-pad']"));
        Actions actionBuilders = new Actions(driver);
        Action drawActions = actionBuilders.moveToElement(signatures, 660, 96).click().clickAndHold(signatures)
                .moveByOffset(120, 120).moveByOffset(60, 70).moveByOffset(-140, -140).release(signatures)
                .build();
        drawActions.perform();
        Thread.sleep(6000);
        driver.findElement(By.xpath("//button[text()='Accept']")).click();
        logger.log(LogStatus.INFO, "Cust Signature and click on Accept button successfully");
        logger.log(LogStatus.PASS, "reverse Payment made using cash");

        Thread.sleep(6000);
        driver.switchTo().window(tabs.get(0));
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        logger.log(LogStatus.INFO, "Switch to Main page successfully");

        Thread.sleep(6000);
        ReversePayment.clk_ApproveBtn();
        logger.log(LogStatus.INFO, "clicked on the approve button in reverse payment sucessfully");
        Thread.sleep(2000);
        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");
        Thread.sleep(4000);
        ReversePayment.Clk_RevBtn();
        logger.log(LogStatus.INFO, "Clicked on Reverse button");

        Thread.sleep(6000);

        TransactionReversedPage trnspage = new TransactionReversedPage(driver);
        Thread.sleep(4000);
        trnspage.chk_RefundCashToCustCheckBox();
        logger.log(LogStatus.INFO,
                "clicked on the I have given refunded cash to the customer check box in  Transaction Reversed sucessfully");

        Thread.sleep(4000);
        trnspage.enter_EmployeeId(tabledata.get("UserName"));
        logger.log(LogStatus.INFO, "Entered EmployeeID");

        Thread.sleep(3000);
        trnspage.click_OkBtn();
        logger.log(LogStatus.INFO, "Clicked on OK button");

        Thread.sleep(8000);
        if (cust.isCustdbTitleDisplayed()) {

            logger.log(LogStatus.PASS, "customer Dashboard is displayed successfully");

        } else {

            if (resultFlag.equals("pass"))
                resultFlag = "fail";

            logger.log(LogStatus.FAIL, "customer Dashboard is not displayed ");

        }

        Thread.sleep(1000);
        String toatlDueNowAmtAfterReversePymt = cust.getTotalDue().substring(1).replace(",", "");
        logger.log(LogStatus.PASS, "Total due now amount after reverse payment in customer dashbaord is:"
                + toatlDueNowAmtAfterReversePymt);

        Double dbl_toatlDueNowAmtAfterReversePymt = Double.parseDouble(toatlDueNowAmtAfterReversePymt);

        Double dbl_toatlDueNowAmtBeforeReversePayment = Double.parseDouble(totalDueNowAmount);

        if (dbl_toatlDueNowAmtAfterReversePymt != dbl_toatlDueNowAmtBeforeReversePayment) {

            String sh = Generic_Class.takeScreenShotPath();
            String ie = logger.addScreenCapture(sh);
            logger.log(LogStatus.PASS,
                    "Reverse payment is done sucessful total due amount and changes are reflecting in UI properly");
            logger.log(LogStatus.INFO,
                    "Reverse payment is done sucessful total due amount and changes are reflecting in UI properly",
                    ie);

        } else {

            if (resultFlag.equals("pass"))
                resultFlag = "fail";

            String st = Generic_Class.takeScreenShotPath();
            String ig = logger.addScreenCapture(st);
            logger.log(LogStatus.FAIL,
                    "Reverse payment is not done sucessful total due amount and changes are not reflecting in UI properly");
            logger.log(LogStatus.INFO,
                    "Reverse payment is not done sucessful total due amount and changes are not reflecting in UI properly",
                    ig);

        }

    } catch (Exception e) {
        resultFlag = "fail";
        String scpath = Generic_Class.takeScreenShotPath();
        String image = logger.addScreenCapture(scpath);
        logger.log(LogStatus.FAIL, "PM Dash board page is not displayed", image);
        e.printStackTrace();
    }

}

From source file:Scenarios.Payments.Payments_NewIndCustSingleSpace_Cash_AP.java

@Test(dataProvider = "getLoginData")
public void Payments_NewIndCustSingleSpace_Cash_AP(Hashtable<String, String> tabledata) throws Exception {

    if (!(tabledata.get("Runmode").equals("Y") && tabledata.get("Payments").equals("Y"))) {
        resultFlag = "skip";
        logger.log(LogStatus.SKIP, "Payments_NewIndCustSingleSpace_Cash_AP is Skipped");
        throw new SkipException("Skipping the test Payments_NewIndCustSingleSpace_Cash_AP");
    }/*ww w. j  ava2  s .co  m*/

    Reporter.log("Test Case Started", true);
    Thread.sleep(5000);

    try {

        logger = extent.startTest("Payments_NewIndCustSingleSpace_Cash_AP",
                "New individual customer make payment using cash advance pay");
        testcaseName = tabledata.get("TestCases");
        Reporter.log("Test case started: " + testcaseName, true);
        Thread.sleep(5000);
        JavascriptExecutor jse = (JavascriptExecutor) driver;
        LoginPage loginPage = new LoginPage(driver);
        logger.log(LogStatus.PASS, "creating object for the Login Page sucessfully ");
        Thread.sleep(2000);
        loginPage.enterUserName(tabledata.get("UserName"));
        Thread.sleep(2000);
        logger.log(LogStatus.PASS, "entered username sucessfully");
        Thread.sleep(2000);
        loginPage.enterPassword(tabledata.get("Password"));
        logger.log(LogStatus.PASS, "entered password sucessfully");
        Thread.sleep(2000);
        loginPage.clickLogin();
        logger.log(LogStatus.PASS, "clicked on login in button sucessfully");
        logger.log(LogStatus.PASS, "Login to Application  successfully");

        // =================Handling customer facing device========================
        Thread.sleep(5000);
        Dashboard_BifrostHostPopUp Bifrostpop = new Dashboard_BifrostHostPopUp(driver);
        logger.log(LogStatus.INFO, "PopUp window object is created successfully");
        String biforstNum = Bifrostpop.getBiforstNo();

        Reporter.log(biforstNum + "", true);

        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, "t");
        ArrayList<String> tabs = new ArrayList<String>(driver.getWindowHandles());
        Reporter.log(tabs.size() + "", true);
        driver.switchTo().window(tabs.get(1));
        driver.get(Generic_Class.getPropertyValue("CustomerScreenPath"));

        List<WebElement> biforstSystem = driver.findElements(
                By.xpath("//div[@class='scrollable-area']//span[@class='bifrost-label vertical-center']"));
        for (WebElement ele : biforstSystem) {
            if (biforstNum.equalsIgnoreCase(ele.getText().trim())) {
                Reporter.log(ele.getText() + "", true);
                ele.click();
                break;
            }
        }

        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        Thread.sleep(5000);
        driver.switchTo().window(tabs.get(0));
        Thread.sleep(5000);
        driver.findElement(By.xpath(
                "//div[@id='cfsConnectionDialog']//div[@class='after-connected padding-top']//p/input[@class='psbutton-low-priority']"))
                .click();
        Thread.sleep(5000);
        // =================================================================================

        Thread.sleep(3000);
        PM_Homepage pmhomepage = new PM_Homepage(driver);
        logger.log(LogStatus.PASS, "creating object for the PM home page sucessfully");

        Thread.sleep(3000);
        if (pmhomepage.isexistingCustomerModelDisplayed()) {
            String scpath = Generic_Class.takeScreenShotPath();
            String image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.PASS, "PM DashBoard dispalyed sucessfully");
            logger.log(LogStatus.INFO, "PM DashBoard dispalyed sucessfully", image);
        } else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";
            String scpath = Generic_Class.takeScreenShotPath();
            String image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.FAIL, "PM DashBoard dispalyed  is not displayed");
            logger.log(LogStatus.INFO, "PM DashBoard dispalyed  is not displayed", image);
        }

        pmhomepage.clk_findAndLeaseSpace();
        logger.log(LogStatus.INFO, "Click on Find And Lease Space Link successfully");

        Thread.sleep(4000);
        StandardStoragePage stdStorage = new StandardStoragePage(driver);
        logger.log(LogStatus.PASS, "Creating object for the Standard stroage page sucessfully");
        Thread.sleep(1000);
        if (stdStorage.isSelected_yesradiobutton()) {

            logger.log(LogStatus.PASS,
                    "New Customer Radio button selected by default when WALK-INS: FIND A SPACE page is launched sucessfully");

        } else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";

            logger.log(LogStatus.FAIL,
                    "New Customer Radio button is not selected by default when WALK-INS: FIND A SPACE page is launched sucessfully");
        }

        stdStorage.Clk_ChkBx_AvlSpace();
        logger.log(LogStatus.PASS,
                "Clicked on available bold space size  checkbox in StandardStorage sucessfully");

        stdStorage.click_Search();
        logger.log(LogStatus.INFO, "Click on search button successfully");

        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");

        // =====================Fetching space number and based on that clicking the radio button========================
        Thread.sleep(10000);
        List<WebElement> norows = driver
                .findElements(By.xpath("//form[@id='frmReserveUnits']//div//table/tbody/tr"));
        String space = null;
        logger.log(LogStatus.INFO, "Total number of avaiable sizes count is------>:" + norows.size());
        if (norows.size() > 0) {
            Thread.sleep(5000);

            space = driver.findElement(By.xpath("//form[@id='frmReserveUnits']//div//table/tbody/tr[1]/td[4]"))
                    .getText();

            Reporter.log("space number is:" + space, true);
        } else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";

            logger.log(LogStatus.FAIL,
                    "Application is not populating any data/space details with selected size dimension");
            throw new Exception("Application is not populating any data/space details");

        }
        Thread.sleep(2000);
        WebElement RdBtn_Space = driver.findElement(By.xpath(
                "//td[@class='grid-cell-space'][text()='" + space + "']/../td/input[@name='selectedIds']"));
        logger.log(LogStatus.PASS,
                "check the radio button based on the space and click on the  reservation button");
        Thread.sleep(5000);
        jse.executeScript("arguments[0].scrollIntoView()", RdBtn_Space);
        jse.executeScript("arguments[0].click();", RdBtn_Space);

        logger.log(LogStatus.PASS, "Clicked on check box of a space in this location:-------> " + space);
        Reporter.log("Clicked on check box of a space in this location: " + space, true);
        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");
        Thread.sleep(3000);
        SpaceDashboard_ThisLoc thisloc = new SpaceDashboard_ThisLoc(driver);
        logger.log(LogStatus.PASS, "creating object for the This location page sucessfully");
        thisloc.click_Rent();
        logger.log(LogStatus.PASS, "clicked on the rent button sucessfully");
        Thread.sleep(5000);

        Leasing_ConfirmSpace confirmSpace = new Leasing_ConfirmSpace(driver);
        Thread.sleep(5000);
        confirmSpace.clk_ConfirmwtCust();

        logger.log(LogStatus.PASS, "Clicked on Confirm with Customer button");
        Reporter.log("Clicked on Confirm with Customer button", true);

        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        Thread.sleep(5000);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.PASS, "Switched to Customer Screen");
        Reporter.log("Switched to Customer Screen", true);
        Thread.sleep(9000);
        driver.findElement(
                By.xpath("//div[@class='footer-row clearfix-container']/button[@id='confirmButton']")).click();
        logger.log(LogStatus.PASS, "Clicked on Confirm button in customer screen");
        Reporter.log("Clicked on Confirm button in customer screen", true);

        Thread.sleep(8000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        driver.switchTo().window(tabs.get(0));
        logger.log(LogStatus.PASS, "Switching back to screen");
        Reporter.log("Switching back to screen", true);

        // Filling contact information

        Leasing_ContactInfoPage contactinfo = new Leasing_ContactInfoPage(driver);
        Thread.sleep(5000);
        String FN = "AUT" + Generic_Class.get_RandmString();
        contactinfo.txt_Fname(FN);
        contactinfo.txt_Lname(tabledata.get("LastName"));
        contactinfo.clickContact_State();
        List<WebElement> allstates = driver.findElements(
                By.xpath("//ul[@id='ContactForm_Identification_StateTypeID_listbox']/li[@class='k-item']"));

        // Identify the WebElement which will appear after scrolling down

        for (WebElement state : allstates) {
            Thread.sleep(2000);
            if (tabledata.get("StateCode").equalsIgnoreCase(state.getText())) {
                state.click();
                break;
            }
        }

        // contactinfo.select_State(tabledata.get("StateCode"));
        contactinfo.txt_Number(tabledata.get("DrivingLicenseNum"));
        contactinfo.txt_street1(tabledata.get("Street"));
        contactinfo.txt_city(tabledata.get("City"));

        contactinfo.select_State2address();
        List<WebElement> allstatesadd = driver
                .findElements(By.xpath("//ul[@id='lesseeinfo-address-statecode_listbox']/li[@class='k-item']"));

        for (WebElement state : allstatesadd) {
            Thread.sleep(2000);
            if (tabledata.get("StateCode").equalsIgnoreCase(state.getText())) {
                state.click();
                break;
            }
        }

        // contactinfo.select_State2(tabledata.get("State"));
        Thread.sleep(3000);
        contactinfo.txt_Zipcode(tabledata.get("Zipcode"));
        contactinfo.select_phoneType1();
        Thread.sleep(3000);

        driver.findElement(
                By.xpath("//ul[@class='k-list k-reset ps-container ps-active-y']/li[contains(text(),'"
                        + tabledata.get("PhoneType") + " ')]"))
                .click();
        Thread.sleep(2000);
        contactinfo.txt_AreaCode(tabledata.get("Areacode"));
        Thread.sleep(2000);
        contactinfo.txt_Exchg(tabledata.get("Exchange"));
        Thread.sleep(2000);
        contactinfo.txt_lineNumber(tabledata.get("LineNumber"));
        Thread.sleep(2000);
        contactinfo.txt_email(tabledata.get("Email"));
        Thread.sleep(2000);
        contactinfo.click_CustLookUp();

        Thread.sleep(15000);
        // Click on New Customer button on Choose an Account PopUp
        driver.findElement(By.linkText("Create New Customer")).click();

        Thread.sleep(8000);
        contactinfo.clk_ActiveDutyMilitaryNoRadioBtn(driver);

        // Click on Verify button
        Thread.sleep(5000);
        driver.findElement(By.partialLinkText("Verify")).click();
        logger.log(LogStatus.INFO, "cliked on the Verify button button ");

        Thread.sleep(9000);
        driver.findElement(By.id("confirmWithCustomerButton")).click();

        Thread.sleep(5000);
        // Click on Confirm with Cust button

        logger.log(LogStatus.INFO, "clicking on Confirm with cust button successfully");

        // Navigating to Customer screen
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        Thread.sleep(8000);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully");

        Thread.sleep(6000);
        driver.findElement(By.id("confirmButton")).click();
        logger.log(LogStatus.INFO, "clicking on Confirm button successfully");

        Thread.sleep(5000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        driver.switchTo().window(tabs.get(0));
        logger.log(LogStatus.INFO, "Switch to Main page successfully");

        // Entering Emergency Contact details
        Thread.sleep(5000);
        Leasing_EmergencyConatctsPage emergCon = new Leasing_EmergencyConatctsPage(driver);
        Thread.sleep(2000);

        emergCon.clickAuthorizedfor_radio();
        Thread.sleep(2000);
        emergCon.click_custDeclines_chkBox();

        emergCon.clickconfirmWithCust();
        Thread.sleep(4000);

        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        Thread.sleep(8000);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully");

        Thread.sleep(8000);
        driver.findElement(By.id("confirmButton")).click();
        logger.log(LogStatus.INFO, "clicking on Confirm button successfully");

        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        Thread.sleep(2000);
        driver.switchTo().window(tabs.get(0));
        logger.log(LogStatus.INFO, "Switch to Main page successfully");

        Leasing_AuthorizedAccessContactsPage autContact = new Leasing_AuthorizedAccessContactsPage(driver);

        Thread.sleep(8000);
        autContact.clickSavenProceed();

        Thread.sleep(8000);
        Leasing_EligiblePromotionsPage eligpromo = new Leasing_EligiblePromotionsPage(driver);

        logger.log(LogStatus.PASS, "Validating Monthly rent and Promotions in Eligible Promotion Page");

        eligpromo.clickSavenProceed();

        Thread.sleep(8000);

        Leasing_LeaseQuestionairePage leaseQues = new Leasing_LeaseQuestionairePage(driver);

        leaseQues.clickStorageContent();

        Thread.sleep(5000);

        List<WebElement> allstorage = driver.findElements(By.xpath(
                "//ul[@id='LeaseQuestionnaireUnits_0__RentalUnitContentsTypeID_listbox']//li[@class='k-item']"));

        for (WebElement storage : allstorage) {
            if (tabledata.get("StorageContent").equalsIgnoreCase(storage.getText())) {
                storage.click();
                break;
            }
        }

        // Insurance is ON

        Thread.sleep(5000);
        leaseQues.clickAddInsuranceYes();

        Thread.sleep(1000);
        leaseQues.clickCoverageList();
        Thread.sleep(5000);

        driver.findElement(By.xpath("//ul[@id='LeaseQuestionnaireUnits_0__InsuranceSelection_listbox']/li[2]"))
                .click();

        Thread.sleep(5000);

        leaseQues.clickAccessZone();
        Thread.sleep(2000);

        driver.findElement(
                By.xpath("//ul[@id='LeaseQuestionnaireUnits_0__GateControllerTimeZoneID_listbox']//li[2]"))
                .click();

        Thread.sleep(5000);
        leaseQues.clickKeypadZone();
        Thread.sleep(2000);
        driver.findElement(
                By.xpath("//li[contains(@id,'KeypadZone_option_selected')]/following-sibling::li[1]")).click();

        Thread.sleep(5000);
        leaseQues.clickConfirmCust();

        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        Thread.sleep(8000);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully");

        Thread.sleep(6000);
        driver.findElement(By.id("confirmButton")).click();
        logger.log(LogStatus.INFO, "clicking on Confirm button successfully");

        Thread.sleep(12000);
        List<WebElement> allCheckbox = driver.findElements(
                By.xpath("//section[@class='term-group term-group--active']//input[@type='checkbox']"));

        for (WebElement checkbox : allCheckbox) {
            checkbox.click();
        }
        Thread.sleep(5000);
        driver.findElement(By.id("confirmButton")).click();

        Thread.sleep(3000);
        WebElement signature = driver.findElement(
                By.xpath("//div[@class='sig sigWrapper']/canvas[@class='pad js-signature-canvas']"));
        Actions actionBuilder = new Actions(driver);
        Action drawAction = actionBuilder.moveToElement(signature, 660, 96).click().clickAndHold(signature)
                .moveByOffset(120, 120).moveByOffset(60, 70).moveByOffset(-140, -140).release(signature)
                .build();
        drawAction.perform();

        Thread.sleep(4000);
        driver.findElement(By.id("confirmButton")).click();
        Thread.sleep(5000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        Thread.sleep(6000);
        driver.switchTo().window(tabs.get(0));

        Leasing_ReviewNApprovePage review = new Leasing_ReviewNApprovePage(driver);

        Thread.sleep(8000);
        review.clickApprove_btn();

        Thread.sleep(8000);
        review.clickSaveproceed_btn();

        Leasing_RentalFeePage rentalfee = new Leasing_RentalFeePage(driver);

        Thread.sleep(15000);
        logger.log(LogStatus.PASS, "Validating Monthly rent and Promotions in Eligible Promotion Page");

        rentalfee.clickConfirmCust_btn();
        Thread.sleep(8000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully");

        Thread.sleep(6000);
        driver.findElement(By.id("confirmButton")).click();
        logger.log(LogStatus.INFO, "clicking on Confirm button successfully");

        Thread.sleep(5000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        driver.switchTo().window(tabs.get(0));
        logger.log(LogStatus.INFO, "Switch to Main page successfully");
        Thread.sleep(8000);
        Leasing_PaymentMethodsPage payment = new Leasing_PaymentMethodsPage(driver);
        logger.log(LogStatus.PASS, "creating object for the Login Page sucessfully ");
        Thread.sleep(2000);

        String scpath = Generic_Class.takeScreenShotPath();
        String image = logger.addScreenCapture(scpath);
        logger.log(LogStatus.PASS, "Payment page is dispalyed sucessfully ");
        logger.log(LogStatus.INFO, "Payment page is dispalyed sucessfully", image);

        payment.clk_PayThroughdropdwn();
        logger.log(LogStatus.INFO, "Clicked on payment clk_PayThroughdropdwn dropdown ");
        Thread.sleep(2000);

        // Advance payment option in dropdown
        Thread.sleep(3000);
        driver.findElement(By.xpath("//div[@class='k-animation-container']//ul//li[3]")).click();

        Thread.sleep(4000);
        driver.findElement(By.xpath("//span[text()='Add/Edit Cart']")).click();
        logger.log(LogStatus.INFO, "Clicked on payment Add Merchandise link ");
        Thread.sleep(3000);
        driver.findElement(By.xpath(
                "//div[div[div[div[text()='Lock Disc']]]]//input[@class='product-quantity webchamp-textbox']"))
                .sendKeys("1");
        logger.log(LogStatus.INFO, "entering number of quantity in the textbox ");
        Thread.sleep(3000);
        driver.findElement(By.id("MerchandiseWindow-AddToCart")).click();
        logger.log(LogStatus.INFO, "Clicked on payment Add to cart link ");
        Thread.sleep(4000);
        driver.findElement(By.xpath("//a[text()='Close']")).click();
        logger.log(LogStatus.INFO, "clicked on the close button in the merchadise window ");
        Thread.sleep(5000);
        String MonthlyRentDueNowAmount = payment.get_MonthlyRentDueNowAmt();
        logger.log(LogStatus.PASS,
                "Monthly Rent Due Now amount in payment page is------>:" + MonthlyRentDueNowAmount);

        String PromotionDueNowAmount = payment.get_PromotionDueNowAmt();
        logger.log(LogStatus.PASS,
                "Promotion  Due Now amount in payment page is------>:" + PromotionDueNowAmount);

        String InsuranceNowAmount = payment.get_InsuranceDueNowAmt();
        logger.log(LogStatus.PASS, "Insurance  Due Now amount in payment page is------>:" + InsuranceNowAmount);

        String AdministrativeDueNowAmount = payment.get_AdministrativeDueNowAmt();
        logger.log(LogStatus.PASS,
                "Administrative  Due Now amount in payment page is------>:" + AdministrativeDueNowAmount);

        String PayThroughDueNowAmount = payment.get_PaythroughDueNowAmt();
        logger.log(LogStatus.PASS,
                "PayThrough  Due Now amount in payment page is------>:" + PayThroughDueNowAmount);

        String MerchandiseAmount = payment.get_MerchandiseAmt();
        logger.log(LogStatus.PASS, "MerchandiseAmount  amount in payment page is------>:" + MerchandiseAmount);

        String SalexTaxAmount = payment.get_SalesTaxAmt();
        logger.log(LogStatus.PASS, "SalexTax Amount  in payment page is------>:" + SalexTaxAmount);

        String TotalRemaingBalanceAmt = payment.get_TotalRemaingBalanceAmt();
        logger.log(LogStatus.PASS,
                "Total Remaing Balance Amount  in payment page is------>:" + TotalRemaingBalanceAmt);

        double MonthlyRentamt = payment.getDoubleAmount(MonthlyRentDueNowAmount);
        double Promotionamt = payment.getDoubleAmount(PromotionDueNowAmount);
        double Insuranceamt = payment.getDoubleAmount(InsuranceNowAmount);
        double Administrativeamt = payment.getDoubleAmount(AdministrativeDueNowAmount);
        double Apythroughamt = payment.getDoubleAmount(PayThroughDueNowAmount);
        double Merchandiseamt = payment.getDoubleAmount(MerchandiseAmount);
        double SalexTaxamt = payment.getDoubleAmount(SalexTaxAmount);

        double TotalAmount = MonthlyRentamt + Promotionamt + Insuranceamt + Administrativeamt + Apythroughamt
                + Merchandiseamt + SalexTaxamt;
        double TotalRemUiVal = payment.getDoubleAmount(TotalRemaingBalanceAmt);

        Double db1 = new Double(TotalAmount);
        Double db2 = new Double(TotalRemUiVal);
        if (db1.intValue() == db2.intValue()) {

            String sc = Generic_Class.takeScreenShotPath();
            String im = logger.addScreenCapture(sc);
            logger.log(LogStatus.PASS, "Sumantion of all due amount and Total remaing amount are equal");
            logger.log(LogStatus.INFO, "Sumantion of all due amount and Total remaing amount are equal", im);
        } else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";
            String scp = Generic_Class.takeScreenShotPath();
            String ima = logger.addScreenCapture(scp);
            logger.log(LogStatus.FAIL, "Sumantion of all due is amount and Total remaing amount are not equal");
            logger.log(LogStatus.INFO, "Sumantion of all due is amount and Total remaing amount are not equal",
                    ima);
        }

        Thread.sleep(3000);
        payment.selectPaymentMethod("Cash", driver);
        logger.log(LogStatus.PASS, "selecting cash option from the dropdown");

        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");
        Thread.sleep(3000);
        payment.enter_CashAmount(TotalRemaingBalanceAmt);
        logger.log(LogStatus.PASS, "entered total balance amount to pay");
        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");
        Thread.sleep(3000);
        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");
        payment.clickApply_btn();
        logger.log(LogStatus.PASS, "clicked on the apply button");
        Thread.sleep(3000);
        payment.clk_ConfirmWthCustBtn();
        logger.log(LogStatus.PASS, "clicked on the ConfirmWthCustBtn button");
        Thread.sleep(8000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully");

        Thread.sleep(6000);
        driver.findElement(By.id("confirmButton")).click();
        logger.log(LogStatus.INFO, "clicking on Confirm button successfully");

        Thread.sleep(5000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        driver.switchTo().window(tabs.get(0));
        logger.log(LogStatus.INFO, "Switch to Main page successfully");
        Thread.sleep(5000);

        payment.clickSubmit_btn();
        logger.log(LogStatus.PASS, "clicked on the submit button in payment page");
        Thread.sleep(3000);

        TransactionCompletePopup popup = new TransactionCompletePopup(driver);

        String path = Generic_Class.takeScreenShotPath();
        String ima = logger.addScreenCapture(path);
        logger.log(LogStatus.PASS, "TransactionCompletePopup  dispalyed sucessfully");
        logger.log(LogStatus.INFO, "TransactionCompletePopup dispalyed sucessfully", ima);

        popup.enterEmpNum(tabledata.get("UserName"));
        logger.log(LogStatus.PASS, "entered the employee id");
        Thread.sleep(3000);
        popup.clickOk_btn();
        logger.log(LogStatus.PASS, "clicked on the ok button");
        Thread.sleep(3000);
        driver.findElement(By.xpath("//div[@class='k-widget k-window']//a[contains(text(),'No')]")).click();

        Thread.sleep(8000);

        if (pmhomepage.isexistingCustomerModelDisplayed()) {
            String pa = Generic_Class.takeScreenShotPath();
            String img1 = logger.addScreenCapture(pa);
            logger.log(LogStatus.PASS, "PM DashBoard dispalyed sucessfully");
            logger.log(LogStatus.INFO, "PM DashBoard dispalyed sucessfully", img1);
        } else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";
            String scp = Generic_Class.takeScreenShotPath();
            String imag = logger.addScreenCapture(scp);
            logger.log(LogStatus.FAIL, "PM DashBoard dispalyed  is not displayed");
            logger.log(LogStatus.INFO, "PM DashBoard dispalyed  is not displayed", imag);
        }

        Thread.sleep(2000);
        pmhomepage.clk_AdvSearchLnk();
        logger.log(LogStatus.PASS, "clicked on the submit button");

        Thread.sleep(6000);

        Advance_Search advSearch = new Advance_Search(driver);

        String sqlQuery = "selectaccountidfromaccountwherecustomerid=(selectcustomeridfromcustomerwherecontactid=(selectcontactidfromcontactwherefirstname='"
                + FN + "'andlastname='" + tabledata.get("LastName") + "'))";

        String accNUm = DataBase_JDBC.executeSQLQuery(sqlQuery);
        Thread.sleep(6000);
        logger.log(LogStatus.PASS, "fetched account number from databse and account number is:" + accNUm);

        advSearch.enterAccNum(accNUm);
        logger.log(LogStatus.PASS, "entered account number");

        Thread.sleep(5000);

        advSearch.clickSearchAccbtn();
        logger.log(LogStatus.PASS, "clicked on the search button in advance search page");

        Cust_AccDetailsPage cust = new Cust_AccDetailsPage(driver);
        Thread.sleep(8000);
        if (cust.isCustdbTitleDisplayed()) {

            String sap = Generic_Class.takeScreenShotPath();
            String mag = logger.addScreenCapture(sap);
            logger.log(LogStatus.PASS, "customer Dashboard is displayed successfully");
            logger.log(LogStatus.INFO, "customer Dashboard is displayed successfully", mag);
        } else {

            if (resultFlag.equals("pass"))
                resultFlag = "fail";

            String scan = Generic_Class.takeScreenShotPath();
            String mg = logger.addScreenCapture(scan);
            logger.log(LogStatus.FAIL, "customer Dashboard is not displayed ");
            logger.log(LogStatus.INFO, "customer Dashboard is not displayed ", mg);
        }

        Thread.sleep(1000);
        String totalDueNowAmount = cust.getTotalDue();
        logger.log(LogStatus.PASS, "Total due now amount  in customer dashbaord is---> :" + totalDueNowAmount);

        Double db3 = new Double(payment.getDoubleAmount(totalDueNowAmount));

        if (db3.intValue() == 0) {

            String sap = Generic_Class.takeScreenShotPath();
            String mag = logger.addScreenCapture(sap);
            logger.log(LogStatus.PASS,
                    "Payment done  successfully and changes reflecting in customer dash board");
            logger.log(LogStatus.INFO,
                    "Payment done  successfully and changes reflecting in customer dash board", mag);
        } else {

            if (resultFlag.equals("pass"))
                resultFlag = "fail";

            String scan = Generic_Class.takeScreenShotPath();
            String mg = logger.addScreenCapture(scan);
            logger.log(LogStatus.FAIL, "Payment not done successfully ");
            logger.log(LogStatus.INFO, "Payment not done successfully ", mg);
        }

        Thread.sleep(1000);

        cust.click_AccountActivities();
        ;
        logger.log(LogStatus.INFO, "Clicked on Account Activities tab in customer dashboard screen");

        Thread.sleep(9000);

        WebElement ele = driver.findElement(By.xpath("//td[contains(text(),'Cash')]/preceding-sibling::td/a"));
        ele.click();
        logger.log(LogStatus.INFO, "Clicked on expand button in first row based on the payment type");

        Thread.sleep(6000);

        cust.clk_ReversePaymntLnk();
        logger.log(LogStatus.INFO, "Clicked on Reverse Payment link");

        Thread.sleep(8000);
        ReversePayment ReversePayment = new ReversePayment(driver);
        boolean rev = driver.findElement(By.xpath("//h3[contains(text(),'Reverse Payment')]")).isDisplayed();
        if (rev) {
            String scp = Generic_Class.takeScreenShotPath();
            String img = logger.addScreenCapture(scp);
            logger.log(LogStatus.PASS, "Reverse Payment screen is displayed successfully");
            logger.log(LogStatus.INFO, "Reverse Payment screen is displayed successfully", img);
        } else {

            if (resultFlag.equals("pass"))
                resultFlag = "fail";

            String sc = Generic_Class.takeScreenShotPath();
            String im = logger.addScreenCapture(sc);
            logger.log(LogStatus.FAIL, "Reverse Payment screen is not displayed ");
            logger.log(LogStatus.INFO, "Reverse Payment screen is not displayed ", im);

        }

        Thread.sleep(3000);
        ReversePayment.Clk_RdBtn_Yes();
        logger.log(LogStatus.INFO, "clicked on the yes rdio button in reverse payment sucessfully");

        ReversePayment.Clk_ReasonDrpDwn();
        logger.log(LogStatus.INFO, "Clicked on Reason drop down");

        ReversePayment.SelectValueFromReasonList("Misapplied Payment");
        logger.log(LogStatus.INFO, "Select value from Reason dropdown");

        ReversePayment
                .enterNote("PM received a Bad money from bank for a customer payment so reversing the payment");
        logger.log(LogStatus.INFO, "Entered reason for reverse payment note");

        ReversePayment.clk_ConfirmWithCustomerBtn();
        logger.log(LogStatus.INFO,
                "clicked on the confirm with customer button in reverse payment page sucessfully");

        Thread.sleep(6000);
        driver.switchTo().window(tabs.get(1));
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully");
        Thread.sleep(6000);

        boolean revheader = driver
                .findElement(By.xpath("//h2[contains(text(),'Transaction Reversed. Thank you!')]"))
                .isDisplayed();

        if (revheader) {

            String scr = Generic_Class.takeScreenShotPath();
            String ime = logger.addScreenCapture(scr);
            logger.log(LogStatus.PASS, "Transaction Reversed Thank you! screen is displayed successfully");
            logger.log(LogStatus.INFO, "Transaction Reversed Thank you! screen is displayed successfully", ime);

        } else {

            if (resultFlag.equals("pass"))
                resultFlag = "fail";

            String screen = Generic_Class.takeScreenShotPath();
            String imag = logger.addScreenCapture(screen);
            logger.log(LogStatus.FAIL, "Transaction Reversed Thank you! screen is not displayed ");
            logger.log(LogStatus.INFO, "Transaction Reversed Thank you! screen is not displayed ", imag);

        }

        WebElement signatures = driver
                .findElement(By.xpath("//div[@class='signature-area']/canvas[@class='signature-pad']"));
        Actions actionBuilders = new Actions(driver);
        Action drawActions = actionBuilders.moveToElement(signatures, 660, 96).click().clickAndHold(signatures)
                .moveByOffset(120, 120).moveByOffset(60, 70).moveByOffset(-140, -140).release(signatures)
                .build();
        drawActions.perform();
        Thread.sleep(6000);
        driver.findElement(By.xpath("//button[text()='Accept']")).click();
        logger.log(LogStatus.INFO, "Cust Signature and click on Accept button successfully");
        logger.log(LogStatus.PASS, "reverse Payment made using cash");

        Thread.sleep(6000);
        driver.switchTo().window(tabs.get(0));
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        logger.log(LogStatus.INFO, "Switch to Main page successfully");

        Thread.sleep(6000);
        ReversePayment.clk_ApproveBtn();
        logger.log(LogStatus.INFO, "clicked on the approve button in reverse payment sucessfully");
        Thread.sleep(2000);
        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");
        Thread.sleep(4000);
        ReversePayment.Clk_RevBtn();
        logger.log(LogStatus.INFO, "Clicked on Reverse button");

        Thread.sleep(6000);

        TransactionReversedPage trnspage = new TransactionReversedPage(driver);
        Thread.sleep(4000);
        trnspage.chk_RefundCashToCustCheckBox();
        logger.log(LogStatus.INFO,
                "clicked on the I have given refunded cash to the customer check box in  Transaction Reversed sucessfully");

        Thread.sleep(4000);
        trnspage.enter_EmployeeId(tabledata.get("UserName"));
        logger.log(LogStatus.INFO, "Entered EmployeeID");

        Thread.sleep(3000);
        trnspage.click_OkBtn();
        logger.log(LogStatus.INFO, "Clicked on OK button");

        Thread.sleep(8000);
        if (cust.isCustdbTitleDisplayed()) {

            logger.log(LogStatus.PASS, "customer Dashboard is displayed successfully");

        } else {

            if (resultFlag.equals("pass"))
                resultFlag = "fail";

            logger.log(LogStatus.FAIL, "customer Dashboard is not displayed ");

        }

        Thread.sleep(1000);
        String toatlDueNowAmtAfterReversePymt = cust.getTotalDue().substring(1).replace(",", "");
        logger.log(LogStatus.PASS, "Total due now amount after reverse payment in customer dashbaord is:"
                + toatlDueNowAmtAfterReversePymt);

        Double dbl_toatlDueNowAmtAfterReversePymt = Double.parseDouble(toatlDueNowAmtAfterReversePymt);

        Double dbl_toatlDueNowAmtBeforeReversePayment = Double.parseDouble(totalDueNowAmount);

        if (dbl_toatlDueNowAmtAfterReversePymt != dbl_toatlDueNowAmtBeforeReversePayment) {

            String sh = Generic_Class.takeScreenShotPath();
            String ie = logger.addScreenCapture(sh);
            logger.log(LogStatus.PASS,
                    "Reverse payment is done sucessful total due amount and changes are reflecting in UI properly");
            logger.log(LogStatus.INFO,
                    "Reverse payment is done sucessful total due amount and changes are reflecting in UI properly",
                    ie);

        } else {

            if (resultFlag.equals("pass"))
                resultFlag = "fail";

            String st = Generic_Class.takeScreenShotPath();
            String ig = logger.addScreenCapture(st);
            logger.log(LogStatus.FAIL,
                    "Reverse payment is not done sucessful total due amount and changes are not reflecting in UI properly");
            logger.log(LogStatus.INFO,
                    "Reverse payment is not done sucessful total due amount and changes are not reflecting in UI properly",
                    ig);

        }

    } catch (Exception e) {
        resultFlag = "fail";
        String scpath = Generic_Class.takeScreenShotPath();
        String image = logger.addScreenCapture(scpath);
        logger.log(LogStatus.FAIL, "PM Dash board page is not displayed", image);
        e.printStackTrace();
    }

}

From source file:Scenarios.Payments.Payments_NewIndCustSingleSpace_CheckAnniversary.java

@Test(dataProvider = "getLoginData")
public void Payments_NewIndCustSingleSpace_CheckAnniversary(Hashtable<String, String> tabledata)
        throws Exception {

    if (!(tabledata.get("Runmode").equals("Y") && tabledata.get("Payments").equals("Y"))) {
        resultFlag = "skip";
        logger.log(LogStatus.SKIP, "Payments_NewIndCustSingleSpace_CheckAnniversary is Skipped");
        throw new SkipException("Skipping the test Payments_NewIndCustSingleSpace_CheckAnniversary");
    }/*from   w w  w .  j  a  v a  2  s .  c o  m*/

    Reporter.log("Test Case Started", true);
    Thread.sleep(5000);

    try {

        logger = extent.startTest("Payments_NewIndCustSingleSpace_CheckAnniversary",
                "New individual customer make payment using Check anniversary pay");
        testcaseName = tabledata.get("TestCases");
        Reporter.log("Test case started: " + testcaseName, true);
        Thread.sleep(5000);
        JavascriptExecutor jse = (JavascriptExecutor) driver;
        LoginPage loginPage = new LoginPage(driver);
        logger.log(LogStatus.PASS, "creating object for the Login Page sucessfully ");
        Thread.sleep(2000);
        loginPage.enterUserName(tabledata.get("UserName"));
        Thread.sleep(2000);
        logger.log(LogStatus.PASS, "entered username sucessfully");
        Thread.sleep(2000);
        loginPage.enterPassword(tabledata.get("Password"));
        logger.log(LogStatus.PASS, "entered password sucessfully");
        Thread.sleep(2000);
        loginPage.clickLogin();
        logger.log(LogStatus.PASS, "clicked on login in button sucessfully");
        logger.log(LogStatus.PASS, "Login to Application  successfully");

        // =================Handling customer facing device========================
        Thread.sleep(5000);
        Dashboard_BifrostHostPopUp Bifrostpop = new Dashboard_BifrostHostPopUp(driver);
        logger.log(LogStatus.INFO, "PopUp window object is created successfully");
        String biforstNum = Bifrostpop.getBiforstNo();

        Reporter.log(biforstNum + "", true);

        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, "t");
        ArrayList<String> tabs = new ArrayList<String>(driver.getWindowHandles());
        Reporter.log(tabs.size() + "", true);
        driver.switchTo().window(tabs.get(1));
        driver.get(Generic_Class.getPropertyValue("CustomerScreenPath"));

        List<WebElement> biforstSystem = driver.findElements(
                By.xpath("//div[@class='scrollable-area']//span[@class='bifrost-label vertical-center']"));
        for (WebElement ele : biforstSystem) {
            if (biforstNum.equalsIgnoreCase(ele.getText().trim())) {
                Reporter.log(ele.getText() + "", true);
                ele.click();
                break;
            }
        }

        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        Thread.sleep(5000);
        driver.switchTo().window(tabs.get(0));
        Thread.sleep(5000);
        driver.findElement(By.xpath(
                "//div[@id='cfsConnectionDialog']//div[@class='after-connected padding-top']//p/input[@class='psbutton-low-priority']"))
                .click();
        Thread.sleep(5000);
        // =================================================================================

        Thread.sleep(3000);
        PM_Homepage pmhomepage = new PM_Homepage(driver);
        logger.log(LogStatus.PASS, "creating object for the PM home page sucessfully");

        Thread.sleep(3000);
        if (pmhomepage.isexistingCustomerModelDisplayed()) {
            String scpath = Generic_Class.takeScreenShotPath();
            String image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.PASS, "PM DashBoard dispalyed sucessfully");
            logger.log(LogStatus.INFO, "PM DashBoard dispalyed sucessfully", image);
        } else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";
            String scpath = Generic_Class.takeScreenShotPath();
            String image = logger.addScreenCapture(scpath);
            logger.log(LogStatus.FAIL, "PM DashBoard dispalyed  is not displayed");
            logger.log(LogStatus.INFO, "PM DashBoard dispalyed  is not displayed", image);
        }

        pmhomepage.clk_findAndLeaseSpace();
        logger.log(LogStatus.INFO, "Click on Find And Lease Space Link successfully");

        Thread.sleep(4000);
        StandardStoragePage stdStorage = new StandardStoragePage(driver);
        logger.log(LogStatus.PASS, "Creating object for the Standard stroage page sucessfully");
        Thread.sleep(1000);
        if (stdStorage.isSelected_yesradiobutton()) {

            logger.log(LogStatus.PASS,
                    "New Customer Radio button selected by default when WALK-INS: FIND A SPACE page is launched sucessfully");

        } else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";

            logger.log(LogStatus.FAIL,
                    "New Customer Radio button is not selected by default when WALK-INS: FIND A SPACE page is launched sucessfully");
        }

        stdStorage.Clk_ChkBx_AvlSpace();
        logger.log(LogStatus.PASS,
                "Clicked on available bold space size  checkbox in StandardStorage sucessfully");

        stdStorage.click_Search();
        logger.log(LogStatus.INFO, "Click on search button successfully");

        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");

        // =====================Fetching space number and based on that clicking the radio button========================
        Thread.sleep(10000);
        List<WebElement> norows = driver
                .findElements(By.xpath("//form[@id='frmReserveUnits']//div//table/tbody/tr"));
        String space = null;
        logger.log(LogStatus.INFO, "Total number of avaiable sizes count is------>:" + norows.size());
        if (norows.size() > 0) {
            Thread.sleep(5000);

            space = driver.findElement(By.xpath("//form[@id='frmReserveUnits']//div//table/tbody/tr[1]/td[4]"))
                    .getText();

            Reporter.log("space number is:" + space, true);
        } else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";

            logger.log(LogStatus.FAIL,
                    "Application is not populating any data/space details with selected size dimension");
            throw new Exception("Application is not populating any data/space details");

        }
        Thread.sleep(2000);
        WebElement RdBtn_Space = driver.findElement(By.xpath(
                "//td[@class='grid-cell-space'][text()='" + space + "']/../td/input[@name='selectedIds']"));
        logger.log(LogStatus.PASS,
                "check the radio button based on the space and click on the  reservation button");
        Thread.sleep(5000);
        jse.executeScript("arguments[0].scrollIntoView()", RdBtn_Space);
        jse.executeScript("arguments[0].click();", RdBtn_Space);

        logger.log(LogStatus.PASS, "Clicked on check box of a space in this location:-------> " + space);
        Reporter.log("Clicked on check box of a space in this location: " + space, true);
        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");
        Thread.sleep(3000);
        SpaceDashboard_ThisLoc thisloc = new SpaceDashboard_ThisLoc(driver);
        logger.log(LogStatus.PASS, "creating object for the This location page sucessfully");
        thisloc.click_Rent();
        logger.log(LogStatus.PASS, "clicked on the rent button sucessfully");
        Thread.sleep(5000);

        Leasing_ConfirmSpace confirmSpace = new Leasing_ConfirmSpace(driver);
        Thread.sleep(5000);
        confirmSpace.clk_ConfirmwtCust();

        logger.log(LogStatus.PASS, "Clicked on Confirm with Customer button");
        Reporter.log("Clicked on Confirm with Customer button", true);

        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        Thread.sleep(5000);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.PASS, "Switched to Customer Screen");
        Reporter.log("Switched to Customer Screen", true);
        Thread.sleep(9000);
        driver.findElement(
                By.xpath("//div[@class='footer-row clearfix-container']/button[@id='confirmButton']")).click();
        logger.log(LogStatus.PASS, "Clicked on Confirm button in customer screen");
        Reporter.log("Clicked on Confirm button in customer screen", true);

        Thread.sleep(8000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        driver.switchTo().window(tabs.get(0));
        logger.log(LogStatus.PASS, "Switching back to screen");
        Reporter.log("Switching back to screen", true);

        // Filling contact information

        Leasing_ContactInfoPage contactinfo = new Leasing_ContactInfoPage(driver);
        Thread.sleep(5000);
        String FN = "AUT" + Generic_Class.get_RandmString();
        contactinfo.txt_Fname(FN);
        contactinfo.txt_Lname(tabledata.get("LastName"));
        contactinfo.clickContact_State();
        List<WebElement> allstates = driver.findElements(
                By.xpath("//ul[@id='ContactForm_Identification_StateTypeID_listbox']/li[@class='k-item']"));

        // Identify the WebElement which will appear after scrolling down

        for (WebElement state : allstates) {
            Thread.sleep(2000);
            if (tabledata.get("StateCode").equalsIgnoreCase(state.getText())) {
                state.click();
                break;
            }
        }

        // contactinfo.select_State(tabledata.get("StateCode"));
        contactinfo.txt_Number(tabledata.get("DrivingLicenseNum"));
        contactinfo.txt_street1(tabledata.get("Street"));
        contactinfo.txt_city(tabledata.get("City"));

        contactinfo.select_State2address();
        List<WebElement> allstatesadd = driver
                .findElements(By.xpath("//ul[@id='lesseeinfo-address-statecode_listbox']/li[@class='k-item']"));

        for (WebElement state : allstatesadd) {
            Thread.sleep(2000);
            if (tabledata.get("StateCode").equalsIgnoreCase(state.getText())) {
                state.click();
                break;
            }
        }

        // contactinfo.select_State2(tabledata.get("State"));
        Thread.sleep(3000);
        contactinfo.txt_Zipcode(tabledata.get("Zipcode"));
        contactinfo.select_phoneType1();
        Thread.sleep(3000);

        driver.findElement(
                By.xpath("//ul[@class='k-list k-reset ps-container ps-active-y']/li[contains(text(),'"
                        + tabledata.get("PhoneType") + " ')]"))
                .click();
        Thread.sleep(2000);
        contactinfo.txt_AreaCode(tabledata.get("Areacode"));
        Thread.sleep(2000);
        contactinfo.txt_Exchg(tabledata.get("Exchange"));
        Thread.sleep(2000);
        contactinfo.txt_lineNumber(tabledata.get("LineNumber"));
        Thread.sleep(2000);
        contactinfo.txt_email(tabledata.get("Email"));
        Thread.sleep(2000);
        contactinfo.click_CustLookUp();

        Thread.sleep(15000);
        // Click on New Customer button on Choose an Account PopUp
        driver.findElement(By.linkText("Create New Customer")).click();

        Thread.sleep(8000);
        contactinfo.clk_ActiveDutyMilitaryNoRadioBtn(driver);

        // Click on Verify button
        Thread.sleep(5000);
        driver.findElement(By.partialLinkText("Verify")).click();
        logger.log(LogStatus.INFO, "cliked on the Verify button button ");

        Thread.sleep(9000);
        driver.findElement(By.id("confirmWithCustomerButton")).click();

        Thread.sleep(5000);
        // Click on Confirm with Cust button

        logger.log(LogStatus.INFO, "clicking on Confirm with cust button successfully");

        // Navigating to Customer screen
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        Thread.sleep(8000);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully");

        Thread.sleep(6000);
        driver.findElement(By.id("confirmButton")).click();
        logger.log(LogStatus.INFO, "clicking on Confirm button successfully");

        Thread.sleep(8000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        driver.switchTo().window(tabs.get(0));
        logger.log(LogStatus.PASS, "Switching back to screen");
        Reporter.log("Switching back to screen", true);

        // Entering Emergency Contact details
        Thread.sleep(5000);
        Leasing_EmergencyConatctsPage emergCon = new Leasing_EmergencyConatctsPage(driver);
        Thread.sleep(2000);

        emergCon.clickAuthorizedfor_radio();
        Thread.sleep(2000);
        emergCon.click_custDeclines_chkBox();

        emergCon.clickconfirmWithCust();
        Thread.sleep(4000);

        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        Thread.sleep(8000);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully");

        Thread.sleep(5000);
        driver.findElement(By.id("confirmButton")).click();
        logger.log(LogStatus.INFO, "clicking on Confirm button successfully");

        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        Thread.sleep(2000);
        driver.switchTo().window(tabs.get(0));
        logger.log(LogStatus.INFO, "Switch to Main page successfully");

        Leasing_AuthorizedAccessContactsPage autContact = new Leasing_AuthorizedAccessContactsPage(driver);

        Thread.sleep(8000);
        autContact.clickSavenProceed();

        Thread.sleep(8000);
        Leasing_EligiblePromotionsPage eligpromo = new Leasing_EligiblePromotionsPage(driver);

        logger.log(LogStatus.PASS, "Validating Monthly rent and Promotions in Eligible Promotion Page");

        eligpromo.clickSavenProceed();

        Thread.sleep(8000);

        Leasing_LeaseQuestionairePage leaseQues = new Leasing_LeaseQuestionairePage(driver);

        leaseQues.clickStorageContent();

        Thread.sleep(5000);

        List<WebElement> allstorage = driver.findElements(By.xpath(
                "//ul[@id='LeaseQuestionnaireUnits_0__RentalUnitContentsTypeID_listbox']//li[@class='k-item']"));

        for (WebElement storage : allstorage) {
            if (tabledata.get("StorageContent").equalsIgnoreCase(storage.getText())) {
                storage.click();
                break;
            }
        }

        // Insurance is ON

        Thread.sleep(5000);
        leaseQues.clickAddInsuranceYes();

        Thread.sleep(1000);
        leaseQues.clickCoverageList();
        Thread.sleep(5000);

        driver.findElement(By.xpath("//ul[@id='LeaseQuestionnaireUnits_0__InsuranceSelection_listbox']/li[2]"))
                .click();

        Thread.sleep(5000);

        leaseQues.clickAccessZone();
        Thread.sleep(2000);

        driver.findElement(
                By.xpath("//ul[@id='LeaseQuestionnaireUnits_0__GateControllerTimeZoneID_listbox']//li[2]"))
                .click();

        Thread.sleep(5000);
        leaseQues.clickKeypadZone();
        Thread.sleep(2000);
        driver.findElement(
                By.xpath("//li[contains(@id,'KeypadZone_option_selected')]/following-sibling::li[1]")).click();

        Thread.sleep(5000);
        leaseQues.clickConfirmCust();

        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        Thread.sleep(8000);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully");

        Thread.sleep(6000);
        driver.findElement(By.id("confirmButton")).click();
        logger.log(LogStatus.INFO, "clicking on Confirm button successfully");

        Thread.sleep(12000);
        List<WebElement> allCheckbox = driver.findElements(
                By.xpath("//section[@class='term-group term-group--active']//input[@type='checkbox']"));

        for (WebElement checkbox : allCheckbox) {
            checkbox.click();
        }
        Thread.sleep(5000);
        driver.findElement(By.id("confirmButton")).click();

        Thread.sleep(3000);
        WebElement signature = driver.findElement(
                By.xpath("//div[@class='sig sigWrapper']/canvas[@class='pad js-signature-canvas']"));
        Actions actionBuilder = new Actions(driver);
        Action drawAction = actionBuilder.moveToElement(signature, 660, 96).click().clickAndHold(signature)
                .moveByOffset(120, 120).moveByOffset(60, 70).moveByOffset(-140, -140).release(signature)
                .build();
        drawAction.perform();

        Thread.sleep(4000);
        driver.findElement(By.id("confirmButton")).click();
        Thread.sleep(5000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        Thread.sleep(6000);
        driver.switchTo().window(tabs.get(0));

        Leasing_ReviewNApprovePage review = new Leasing_ReviewNApprovePage(driver);

        Thread.sleep(8000);
        review.clickApprove_btn();

        Thread.sleep(8000);
        review.clickSaveproceed_btn();

        Leasing_RentalFeePage rentalfee = new Leasing_RentalFeePage(driver);

        Thread.sleep(15000);
        logger.log(LogStatus.PASS, "Validating Monthly rent and Promotions in Eligible Promotion Page");

        rentalfee.clickConfirmCust_btn();
        Thread.sleep(8000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully");

        Thread.sleep(6000);
        driver.findElement(By.id("confirmButton")).click();
        logger.log(LogStatus.INFO, "clicking on Confirm button successfully");

        Thread.sleep(5000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        driver.switchTo().window(tabs.get(0));
        logger.log(LogStatus.INFO, "Switch to Main page successfully");
        Thread.sleep(8000);
        Leasing_PaymentMethodsPage payment = new Leasing_PaymentMethodsPage(driver);
        logger.log(LogStatus.PASS, "creating object for the Login Page sucessfully ");
        Thread.sleep(2000);

        String scpath = Generic_Class.takeScreenShotPath();
        String image = logger.addScreenCapture(scpath);
        logger.log(LogStatus.PASS, "Payment page is dispalyed sucessfully ");
        logger.log(LogStatus.INFO, "Payment page is dispalyed sucessfully", image);

        payment.clk_PayThroughdropdwn();
        logger.log(LogStatus.INFO, "Clicked on payment clk_PayThroughdropdwn dropdown ");
        Thread.sleep(2000);

        // Anniversary payment option in dropdown
        int numberOfPixelsToDragTheScrollbarDown1 = 120;

        Actions dragger1 = new Actions(driver);
        WebElement draggablePartOfScrollbar1 = driver.findElement(By.xpath(
                "//ul[@class='k-list k-reset ps-container ps-active-y']//div[@class='ps-scrollbar-y-rail']//div[@class='ps-scrollbar-y']"));
        Thread.sleep(3000);
        List<WebElement> dates1 = driver
                .findElements(By.xpath("//div[@class='k-animation-container']//ul//li"));
        Thread.sleep(3000);
        dragger1.moveToElement(draggablePartOfScrollbar1).clickAndHold()
                .moveByOffset(0, numberOfPixelsToDragTheScrollbarDown1).release().build().perform();
        Thread.sleep(3000);
        driver.findElement(By.xpath("//div[@class='k-animation-container']//ul//li[13]")).click();

        Thread.sleep(4000);
        driver.findElement(By.xpath("//span[text()='Add/Edit Cart']")).click();
        logger.log(LogStatus.INFO, "Clicked on payment Add Merchandise link ");
        Thread.sleep(3000);
        driver.findElement(By.xpath(
                "//div[div[div[div[text()='Lock Disc']]]]//input[@class='product-quantity webchamp-textbox']"))
                .sendKeys("1");
        logger.log(LogStatus.INFO, "entering number of quantity in the textbox ");
        Thread.sleep(3000);
        driver.findElement(By.id("MerchandiseWindow-AddToCart")).click();
        logger.log(LogStatus.INFO, "Clicked on payment Add to cart link ");
        Thread.sleep(4000);
        driver.findElement(By.xpath("//a[text()='Close']")).click();
        logger.log(LogStatus.INFO, "clicked on the close button in the merchadise window ");
        Thread.sleep(5000);
        String MonthlyRentDueNowAmount = payment.get_MonthlyRentDueNowAmt();
        logger.log(LogStatus.PASS,
                "Monthly Rent Due Now amount in payment page is------>:" + MonthlyRentDueNowAmount);

        String PromotionDueNowAmount = payment.get_PromotionDueNowAmt();
        logger.log(LogStatus.PASS,
                "Promotion  Due Now amount in payment page is------>:" + PromotionDueNowAmount);

        String InsuranceNowAmount = payment.get_InsuranceDueNowAmt();
        logger.log(LogStatus.PASS, "Insurance  Due Now amount in payment page is------>:" + InsuranceNowAmount);

        String AdministrativeDueNowAmount = payment.get_AdministrativeDueNowAmt();
        logger.log(LogStatus.PASS,
                "Administrative  Due Now amount in payment page is------>:" + AdministrativeDueNowAmount);

        String PayThroughDueNowAmount = payment.get_PaythroughDueNowAmt();
        logger.log(LogStatus.PASS,
                "PayThrough  Due Now amount in payment page is------>:" + PayThroughDueNowAmount);

        String MerchandiseAmount = payment.get_MerchandiseAmt();
        logger.log(LogStatus.PASS, "MerchandiseAmount  amount in payment page is------>:" + MerchandiseAmount);

        String SalexTaxAmount = payment.get_SalesTaxAmt();
        logger.log(LogStatus.PASS, "SalexTax Amount  in payment page is------>:" + SalexTaxAmount);

        String TotalRemaingBalanceAmt = payment.get_TotalRemaingBalanceAmt();
        logger.log(LogStatus.PASS,
                "Total Remaing Balance Amount  in payment page is------>:" + TotalRemaingBalanceAmt);

        double MonthlyRentamt = payment.getDoubleAmount(MonthlyRentDueNowAmount);
        double Promotionamt = payment.getDoubleAmount(PromotionDueNowAmount);
        double Insuranceamt = payment.getDoubleAmount(InsuranceNowAmount);
        double Administrativeamt = payment.getDoubleAmount(AdministrativeDueNowAmount);
        double Apythroughamt = payment.getDoubleAmount(PayThroughDueNowAmount);
        double Merchandiseamt = payment.getDoubleAmount(MerchandiseAmount);
        double SalexTaxamt = payment.getDoubleAmount(SalexTaxAmount);

        double TotalAmount = MonthlyRentamt + Promotionamt + Insuranceamt + Administrativeamt + Apythroughamt
                + Merchandiseamt + SalexTaxamt;
        double TotalRemUiVal = payment.getDoubleAmount(TotalRemaingBalanceAmt);

        Double db1 = new Double(TotalAmount);
        Double db2 = new Double(TotalRemUiVal);
        if (db1.intValue() == db2.intValue()) {

            String sc = Generic_Class.takeScreenShotPath();
            String im = logger.addScreenCapture(sc);
            logger.log(LogStatus.PASS, "Sumantion of all due amount and Total remaing amount are equal");
            logger.log(LogStatus.INFO, "Sumantion of all due amount and Total remaing amount are equal", im);
        } else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";
            String scp = Generic_Class.takeScreenShotPath();
            String ima = logger.addScreenCapture(scp);
            logger.log(LogStatus.FAIL, "Sumantion of all due is amount and Total remaing amount are not equal");
            logger.log(LogStatus.INFO, "Sumantion of all due is amount and Total remaing amount are not equal",
                    ima);
        }

        Thread.sleep(4000);
        payment.selectPaymentMethod("Check", driver);
        logger.log(LogStatus.INFO, "Select the Check option from Payment dropdown successfully");

        Thread.sleep(3000);
        payment.clickmanualentry();
        logger.log(LogStatus.INFO, "Clicking on Manual entry button successfully");

        payment.Enter_routingNumber(tabledata.get("BankRoutingNum"));
        logger.log(LogStatus.INFO, "Entering routing Number successfully");

        payment.Enter_accountNumber(tabledata.get("CheckingAccNum"));
        logger.log(LogStatus.INFO, "Entering Account Number successfully");

        payment.Enter_checkNumber(tabledata.get("CheckNumber"));
        logger.log(LogStatus.INFO, "Entering Check Number successfully");
        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");
        Thread.sleep(2000);
        payment.Enter_checkAmount(TotalRemaingBalanceAmt);
        logger.log(LogStatus.INFO, "Entering Check amount successfully");

        Thread.sleep(3000);
        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");
        payment.clickApply_btn();
        logger.log(LogStatus.PASS, "clicked on the apply button");
        Thread.sleep(3000);
        payment.clk_ConfirmWthCustBtn();
        logger.log(LogStatus.PASS, "clicked on the ConfirmWthCustBtn button");
        Thread.sleep(8000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        driver.switchTo().window(tabs.get(1));
        logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully");

        Thread.sleep(6000);
        driver.findElement(By.id("confirmButton")).click();
        logger.log(LogStatus.INFO, "clicking on Confirm button successfully");

        Thread.sleep(5000);
        driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
        driver.switchTo().window(tabs.get(0));
        logger.log(LogStatus.INFO, "Switch to Main page successfully");
        Thread.sleep(5000);

        payment.clickSubmit_btn();
        logger.log(LogStatus.PASS, "clicked on the submit button in payment page");
        Thread.sleep(3000);

        TransactionCompletePopup popup = new TransactionCompletePopup(driver);

        String path = Generic_Class.takeScreenShotPath();
        String ima = logger.addScreenCapture(path);
        logger.log(LogStatus.PASS, "TransactionCompletePopup  dispalyed sucessfully");
        logger.log(LogStatus.INFO, "TransactionCompletePopup dispalyed sucessfully", ima);

        popup.enterEmpNum(tabledata.get("UserName"));
        logger.log(LogStatus.PASS, "entered the employee id");
        Thread.sleep(3000);
        popup.clickOk_btn();
        logger.log(LogStatus.PASS, "clicked on the ok button");
        Thread.sleep(3000);
        driver.findElement(By.xpath("//div[@class='k-widget k-window']//a[contains(text(),'No')]")).click();

        Thread.sleep(8000);

        if (pmhomepage.isexistingCustomerModelDisplayed()) {
            String pa = Generic_Class.takeScreenShotPath();
            String img1 = logger.addScreenCapture(pa);
            logger.log(LogStatus.PASS, "PM DashBoard dispalyed sucessfully");
            logger.log(LogStatus.INFO, "PM DashBoard dispalyed sucessfully", img1);
        } else {
            if (resultFlag.equals("pass"))
                resultFlag = "fail";
            String scp = Generic_Class.takeScreenShotPath();
            String imag = logger.addScreenCapture(scp);
            logger.log(LogStatus.FAIL, "PM DashBoard dispalyed  is not displayed");
            logger.log(LogStatus.INFO, "PM DashBoard dispalyed  is not displayed", imag);
        }

        Thread.sleep(2000);
        pmhomepage.clk_AdvSearchLnk();
        logger.log(LogStatus.PASS, "clicked on the submit button");

        Thread.sleep(6000);

        Advance_Search advSearch = new Advance_Search(driver);

        String sqlQuery = "selectaccountidfromaccountwherecustomerid=(selectcustomeridfromcustomerwherecontactid=(selectcontactidfromcontactwherefirstname='"
                + FN + "'andlastname='" + tabledata.get("LastName") + "'))";

        String accNUm = DataBase_JDBC.executeSQLQuery(sqlQuery);
        Thread.sleep(6000);
        logger.log(LogStatus.PASS, "fetched account number from databse and account number is:" + accNUm);

        advSearch.enterAccNum(accNUm);
        logger.log(LogStatus.PASS, "entered account number");

        Thread.sleep(5000);

        advSearch.clickSearchAccbtn();
        logger.log(LogStatus.PASS, "clicked on the search button in advance search page");

        Cust_AccDetailsPage cust = new Cust_AccDetailsPage(driver);
        Thread.sleep(8000);
        if (cust.isCustdbTitleDisplayed()) {

            String sap = Generic_Class.takeScreenShotPath();
            String mag = logger.addScreenCapture(sap);
            logger.log(LogStatus.PASS, "customer Dashboard is displayed successfully");
            logger.log(LogStatus.INFO, "customer Dashboard is displayed successfully", mag);
        } else {

            if (resultFlag.equals("pass"))
                resultFlag = "fail";

            String scan = Generic_Class.takeScreenShotPath();
            String mg = logger.addScreenCapture(scan);
            logger.log(LogStatus.FAIL, "customer Dashboard is not displayed ");
            logger.log(LogStatus.INFO, "customer Dashboard is not displayed ", mg);
        }

        Thread.sleep(1000);
        String totalDueNowAmount = cust.getTotalDue();
        logger.log(LogStatus.PASS, "Total due now amount  in customer dashbaord is---> :" + totalDueNowAmount);

        Double db3 = new Double(payment.getDoubleAmount(totalDueNowAmount));

        if (db3.intValue() == 0) {

            String sap = Generic_Class.takeScreenShotPath();
            String mag = logger.addScreenCapture(sap);
            logger.log(LogStatus.PASS,
                    "Payment done  successfully and changes reflecting in customer dash board");
            logger.log(LogStatus.INFO,
                    "Payment done  successfully and changes reflecting in customer dash board", mag);
        } else {

            if (resultFlag.equals("pass"))
                resultFlag = "fail";

            String scan = Generic_Class.takeScreenShotPath();
            String mg = logger.addScreenCapture(scan);
            logger.log(LogStatus.FAIL, "Payment not done successfully ");
            logger.log(LogStatus.INFO, "Payment not done successfully ", mg);
        }

        Thread.sleep(1000);

        cust.click_AccountActivities();
        ;
        logger.log(LogStatus.INFO, "Clicked on Account Activities tab in customer dashboard screen");

        Thread.sleep(9000);

        cust.clk_CheckExpandLink();
        logger.log(LogStatus.INFO, "Clicked on expand button in first row");

        Thread.sleep(6000);

        cust.clk_ReversePaymntLnk();
        logger.log(LogStatus.INFO, "Clicked on Reverse Payment link");

        Thread.sleep(8000);
        ReversePayment ReversePayment = new ReversePayment(driver);
        boolean rev = driver.findElement(By.xpath("//h3[contains(text(),'Reverse Payment')]")).isDisplayed();
        if (rev) {
            String sc = Generic_Class.takeScreenShotPath();
            String im = logger.addScreenCapture(sc);
            logger.log(LogStatus.PASS, "Reverse Payment screen is displayed successfully");
            logger.log(LogStatus.INFO, "Reverse Payment screen is displayed successfully", im);
        } else {

            if (resultFlag.equals("pass"))
                resultFlag = "fail";

            String sap = Generic_Class.takeScreenShotPath();
            String it = logger.addScreenCapture(sap);
            logger.log(LogStatus.FAIL, "Reverse Payment screen is not displayed ");
            logger.log(LogStatus.INFO, "Reverse Payment screen is not displayed ", it);

        }

        ReversePayment.Clk_ReasonDrpDwn();
        logger.log(LogStatus.INFO, "Clicked on Reason drop down");

        ReversePayment.SelectValueFromReasonList("Check Incorrect");

        logger.log(LogStatus.INFO, "Select value from Reason dropdown");

        ReversePayment
                .enterNote("PM received a Bad check from bank for a customer payment so reversing the payment");
        logger.log(LogStatus.INFO, "Entered note");

        ReversePayment.Clk_RevBtn();
        logger.log(LogStatus.INFO, "Clicked on Reverse button");

        Thread.sleep(6000);

        TransactionReversedPage trnspage = new TransactionReversedPage(driver);
        trnspage.enter_EmployeeId(tabledata.get("UserName"));
        logger.log(LogStatus.INFO, "Entered EmployeeID");

        Thread.sleep(3000);
        trnspage.click_OkBtn();
        logger.log(LogStatus.INFO, "Clicked on OK button");

        Thread.sleep(6000);
        if (cust.isCustdbTitleDisplayed()) {

            logger.log(LogStatus.PASS, "customer Dashboard is displayed successfully");

        } else {

            if (resultFlag.equals("pass"))
                resultFlag = "fail";

            logger.log(LogStatus.FAIL, "customer Dashboard is not displayed ");

        }

        Thread.sleep(1000);
        String toatlDueNowAmtAfterReversePymt = cust.getTotalDue().substring(1).replace(",", "");
        logger.log(LogStatus.PASS, "Total due now amount after reverse payment in customer dashbaord is:"
                + toatlDueNowAmtAfterReversePymt);

        Double dbl_toatlDueNowAmtAfterReversePymt = Double.parseDouble(toatlDueNowAmtAfterReversePymt);

        Double dbl_toatlDueNowAmtBeforeReversePayment = Double.parseDouble(totalDueNowAmount);

        if (dbl_toatlDueNowAmtAfterReversePymt != dbl_toatlDueNowAmtBeforeReversePayment) {

            String sh = Generic_Class.takeScreenShotPath();
            String ie = logger.addScreenCapture(sh);
            logger.log(LogStatus.PASS,
                    "Reverse payment is done sucessful total due amount and changes are reflecting in UI properly");
            logger.log(LogStatus.INFO,
                    "Reverse payment is done sucessful total due amount and changes are reflecting in UI properly",
                    ie);

        } else {

            if (resultFlag.equals("pass"))
                resultFlag = "fail";

            String st = Generic_Class.takeScreenShotPath();
            String ig = logger.addScreenCapture(st);
            logger.log(LogStatus.FAIL,
                    "Reverse payment is not done sucessful total due amount and changes are not reflecting in UI properly");
            logger.log(LogStatus.INFO,
                    "Reverse payment is not done sucessful total due amount and changes are not reflecting in UI properly",
                    ig);

        }

    } catch (Exception e) {
        resultFlag = "fail";
        String scpath = Generic_Class.takeScreenShotPath();
        String image = logger.addScreenCapture(scpath);
        logger.log(LogStatus.FAIL, "Page is not displayed", image);
        e.printStackTrace();
    }

}