Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I am unable to use Actions class in openFin Selenium + JAVA #5

Open
elusive666 opened this issue Nov 8, 2019 · 7 comments
Open

I am unable to use Actions class in openFin Selenium + JAVA #5

elusive666 opened this issue Nov 8, 2019 · 7 comments

Comments

@elusive666
Copy link

I am unable to use Actions class in openFin Selenium + JAVA, is this possible here??? -
OpenFin Version - 9.61.38.43
ChromeDriver Version - 2.33.506120
Chrome Version - 61.0.3163.100

Also to add the selenium native methods to click() do not work here

@weiteho
Copy link
Contributor

weiteho commented Nov 12, 2019

@elusive666 I tested it with OpenFin 9.61.38.43 and ChromeDriver 2.33.506120 with no issues. Would love to see the error you got.

@elusive666
Copy link
Author

Hi Anthony, I am not seeing any error; well getting an error will be great, the issues that i am facing is that the clicks via Actions Class are not working, just do not know what I am doing wrong, here

@weiteho
Copy link
Contributor

weiteho commented Nov 13, 2019

@elusive666 I created "selenium_actions" branch and changed part of the code to show my use of Actions class and clicks as well. Let me know if that doesn't work in your env. Or you can share your code then it will be easier for us to troubleshoot.

@elusive666
Copy link
Author

BaseTest.java - This is my driver for the test suite, do not think I am doing anything wrong here

`public class BaseTest {
private static ThreadLocal driver = new ThreadLocal();
String url, nodeUrl;
public JavascriptExecutor executor;
Properties prop = new Properties();
public WebDriverWait wait;
public static boolean bTC = true;
public static int intErrorCount = 0;
public static boolean mTC = true;

public static File propfile = new File(System.getProperty("user.dir") + File.separator+"src"+File.separator+"project.properties");
public static Map<String, Map<String, String>> mapWidgetData;
public static boolean bCreateMap = false;
FileInputStream fileInput;

{
    try {
        fileInput = new FileInputStream(propfile);
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    }
}


public WebDriver getDriver()
{
    return driver.get();
}

public static void killChromeandFriends() throws InterruptedException
{
    try
    {
        if(System.getProperty("os.name").contains("Windows"))
        {
            Runtime.getRuntime().exec("taskkill /F /IM chromedriver.exe");
            Runtime.getRuntime().exec("taskkill /F /IM chromedriver_OpenFin.exe");
            Runtime.getRuntime().exec("taskkill /F /IM chrome.exe");
            Runtime.getRuntime().exec("taskkill /F /IM OpenFinRVM.exe");
            Runtime.getRuntime().exec("taskkill /F /IM openfin.exe");
            Runtime.getRuntime().exec("taskkill /F /IM JPM.Desktop.Launcher.exe");
            Runtime.getRuntime().exec("taskkill /F /IM JPM.Desktop.Hub.exe");
        }
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }
    //Thread.sleep(3000);
}

@BeforeSuite(alwaysRun = true)
public void beforeSuite() throws InterruptedException {
    System.out.println("Before Suite*");
    killChromeandFriends();
}

@BeforeTest(alwaysRun = true)
public void beforeBaseTest()
{
    System.out.println("Before Test*");
    try
    {
        driver.set(startDashboard());
    }
    catch (MalformedURLException e)
    {
        e.printStackTrace();
    }
    wait = new WebDriverWait(getDriver(), 60);
    //Creating JavaScript Executor object for Selenium webDriver object
    executor = (JavascriptExecutor) getDriver();
}

@BeforeClass(alwaysRun = true)
public void setup()  {
    System.out.println("Before Class*");
    //Create a wait. All test classes use this.
    //Creating HashMap of the excel data Map<String, Map<String, String>>
    if (!bCreateMap) {
        System.out.println("Fetching all Test Data Once.....");
        mapWidgetData = ReadExcelSheetData.setMapData("WidgetData");
        if (!mapWidgetData.isEmpty()) {
            bCreateMap = true;
        }
    }
}

private WebDriver startDashboard() throws MalformedURLException
{
    try
    {
        prop.load(fileInput);
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }
    try
    {
        System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir") + File.separator + "SeleniumDriverLibs" + File.separator + "chromedriver_OpenFin.exe");
        String execPath = System.getProperty("user.dir") + File.separator +"OpenFin"+ File.separator +"RunOpenFin.bat";
        String execArgs = "--config="+System.getProperty("user.dir") + File.separator +"OpenFin"+ File.separator +"config.json";
        // create file named Cookies to store Login Information
        File file = new File("Cookies.data");
        try
        {
            if (file.isFile() && !file.isDirectory())
            {
                //do nothing and reuse old cookie <Cookies.data>
            }
            else
            {
                ChromeOptions options = new ChromeOptions();
                options.setBinary(execPath);
                options.addArguments(execArgs);
                options.addArguments("start-maximized");
                driver.set(new ChromeDriver(options));
                FileWriter fileWrite = new FileWriter(file);
                BufferedWriter Bwrite = new BufferedWriter(fileWrite);
                // loop for getting the cookie information
                for (Cookie ck : getDriver().manage().getCookies())
                {
                    Bwrite.write((ck.getName() + ";" + ck.getValue() + ";" + ck.getDomain() + ";" + ck.getPath() + ";" + ck.getExpiry() + ";" + ck.isSecure()));
                    Bwrite.newLine();
                }
                Bwrite.close();
                fileWrite.close();
                getDriver().close();
            }
        }
        catch (Exception ex)
        {
            ex.printStackTrace();
        }
        ChromeOptions options = new ChromeOptions();
        options.setBinary(execPath);
        options.addArguments(execArgs);
        options.addArguments("start-maximized");
        //options.setExperimentalOption("useAutomationExtension", false);
        driver.set(new ChromeDriver(options));
        Thread.sleep(10000);
        try
        {
            file = new File("Cookies.data");
            FileReader fileReader = new FileReader(file);
            BufferedReader Buffreader = new BufferedReader(fileReader);
            String strline;
            while ((strline = Buffreader.readLine()) != null) {
                StringTokenizer token = new StringTokenizer(strline, ";");
                while (token.hasMoreTokens()) {
                    String name = token.nextToken();
                    String value = token.nextToken();
                    String domain = token.nextToken();
                    String path = token.nextToken();
                    Date expiry = null;
                    String val;
                    if (!(val = token.nextToken()).equals("null")) {
                        SimpleDateFormat sdf = new SimpleDateFormat("E MMM dd HH:mm:ss z yyyy");
                        expiry = sdf.parse(val);
                    }
                    Boolean isSecure = new Boolean(token.nextToken()).booleanValue();
                    Cookie ck = new Cookie(name, value, domain, path, expiry, isSecure);
                    System.out.println(ck);
                    getDriver().manage().addCookie(ck); // This will add the stored cookie to your current session
                }
            }
        }
        catch (Exception ex)
        {
            ex.printStackTrace();
        }
        url = prop.getProperty("dashboardUrl");
        getDriver().navigate().to(url);
        switchWindow(getDriver(),"Spread Dashboard");
    }
    catch(Exception e)
    {
        System.out.println(e.getMessage());
    }
    return getDriver();
}

private static boolean switchWindow(WebDriver webDriver, String windowTitle) throws Exception
{
    boolean found = false;
    long start = System.currentTimeMillis();
    while (!found)
    {
        for (String name : webDriver.getWindowHandles())
        {
            try
            {
                webDriver.switchTo().window(name);
                System.out.println("Window name is "+webDriver.getTitle());
                if (webDriver.getTitle().equals(windowTitle))
                {
                    found = true;
                    break;
                }
            }
            catch (NoSuchWindowException wexp)
            {
                // some windows may get closed during Runtime startup
                // so may get this exception depending on timing
                System.out.println("Ignoring NoSuchWindowException " + name);
            }
        }
        Thread.sleep(1000);
        if ((System.currentTimeMillis() - start) > 5*1000)
        {
            break;
        }
    }
    if (!found)
    {
        System.out.println(windowTitle + " not found");
    }
    return found;
}

@AfterClass(alwaysRun = true)
public void teardown() throws FileNotFoundException, InterruptedException {
    CommonUtil commonutil = new CommonUtil();
    // Delete the Dashboard after execution
    commonutil.DeleteDashboard(getDriver());
    Thread.sleep(10000  );
    System.out.println("After Class*");
}

@AfterTest(alwaysRun = true)
public void afterBaseTest(){
    System.out.println("After Test*");
    //getDriver().close();
    //getDriver().quit();
}

@AfterSuite(alwaysRun = true)
public void afterSuite() throws InterruptedException {
    System.out.println("After Suite*");
    killChromeandFriends();
}

`

`public class CommonUtil extends BaseTest {

Logger logger = new Logger();
Properties prop = new Properties();
File propfile = new File(System.getProperty("user.dir") + File.separator + "src" + File.separator + "project.properties");
FileInputStream fileInput = new FileInputStream(propfile);

CommonUtil.java -This is the utilities file refer to OpenWidget() -
want to replace this with Actions class DragandDropby
executeJavascript(driver, "arguments[0].style.height = '1000px'", resizeable);
executeJavascript(driver, "arguments[0].style.width = '2200px'", resizeable);
public CommonUtil() throws FileNotFoundException {
}

//create new dashboard
public void CreateDashboard(WebDriver driver) throws FileNotFoundException {

    WebDriverWait wait = new WebDriverWait(driver, 50);
    WebElement plusSymbol = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[contains(@class, 'jpmuitk-icon-plus')]")));
   // Thread.sleep(5000);
    executeJSClick(driver, plusSymbol);
    WebElement addDashboard = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("add-dashboard")));
    executeJSClick(driver, addDashboard);
}

// Method to Open a Widget
public void OpenWidget(WebDriver driver, String WIDGET_NAME) throws InterruptedException {

    WebElement iconElement = driver.findElement(By.xpath("//*[contains(@class, 'jpmuitk-icon-grid-solid')]"));
    executeJSClick(driver, iconElement);
    Thread.sleep(1000);

    // locating webelements and entering an instrument
    WebElement txtWidgetSearch = driver.findElement(By.xpath("//input[@placeholder='Search Widget']"));
    txtWidgetSearch.sendKeys(WIDGET_NAME);
    WebElement widget = driver.findElement(By.xpath("//*[text()= \'" + WIDGET_NAME + "\']"));
    executeJSClick(driver, widget);
    txtWidgetSearch.sendKeys(Keys.ESCAPE);
    Thread.sleep(10000);
    //  ********************** Expand the Widget *****************************
    WebElement resizeable = driver.findElement(By.xpath("//*[text()= \'" + WIDGET_NAME + "\']//ancestor::div[contains(@class, 'react-grid-item')]"));
    executeJavascript(driver, "arguments[0].style.height = '1000px'", resizeable);
    executeJavascript(driver, "arguments[0].style.width = '2200px'", resizeable);
}

// Method to Validate Column Names in the Widget
public boolean ValidateColumnList(WebDriver driver, String FilterColumnName, String[] arr, boolean bTC) throws IOException, InterruptedException {

    if (FilterColumnName != null && !FilterColumnName.equals("")) {
        WebDriverWait wait = new WebDriverWait(driver, 30);
        WebElement objMenuButton = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//span[@class='ag-header-cell-text' and text()=\'" + FilterColumnName + "\']/parent::*/preceding-sibling::span[contains(@class,'ag-header-icon ag-header-cell-menu-button')]")));
        executeJSClick(driver, objMenuButton);

    } else {

        WebDriverWait wait = new WebDriverWait(driver, 30);
        WebElement objMenuButton = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//span[@class='ag-header-cell-text' and text()='Date']/parent::*/preceding-sibling::span[contains(@class,'ag-header-icon ag-header-cell-menu-button')]")));
        executeJSClick(driver, objMenuButton);
    }

    WebDriverWait wait = new WebDriverWait(driver, 30);
    WebElement objColumns = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//span[@class='ag-icon ag-icon-columns']")));
    executeJSClick(driver, objColumns);
    String str_ColNames = driver.findElement(By.xpath("//div[@class='ag-column-container']")).getAttribute("innerText");
    System.out.println(str_ColNames);
    //Escaping from Menu   //div[@class='ag-tab-header']/descendant::span[@class='ag-icon ag-icon-menu']
    WebElement objMenuButtonIn = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@class='ag-tab-header']/descendant::span[@class='ag-icon ag-icon-menu']")));
    executeJSClick(driver, objMenuButtonIn);
    executeJSClick(driver, objMenuButtonIn);
    Thread.sleep(1000);

    for (String s : arr) {

        if (str_ColNames.contains(s)) {
            bTC = logger.fngRaisePassLog("Column Name :" + s + " exist", bTC);
        } else {

            bTC = logger.fngRaiseErrorLog("Column Name :" + s + " does not exist", driver, false);
        }

    }

    return bTC;
}


// Method to Validate if the Widget has any data
public boolean WidgetDataExist(WebDriver driver, String WIDGET_NAME, boolean bTC) throws IOException {
    WebDriverWait wait = new WebDriverWait(driver, 30);
    WebElement objGrid = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[contains(text(),\'" + WIDGET_NAME + "\')]/ancestor-or-self::div[@class='react-grid-item react-draggable cssTransforms react-resizable']/descendant::div[@class='ag-body-viewport ag-layout-normal']")));
    List<WebElement> rows = objGrid.findElements(By.xpath("./div[contains(@class, 'ag-body-container ag-layout-normal')]/descendant::div[@role='row']"));
    int numofChildren = rows.size();
    if (numofChildren > 0) {
        bTC = logger.fngRaisePassLog(+numofChildren + " number of rows available in " + WIDGET_NAME + " Widget", bTC);
    } else {
        bTC = logger.fngRaiseErrorLog("No data is available in " + WIDGET_NAME + " Widget", driver, false);
    }
    return bTC;
}


// Method to Highlight an Object
public void highlighterMethod(WebDriver driver, WebElement element) {
    JavascriptExecutor js = (JavascriptExecutor) driver;
    js.executeScript("arguments[0].setAttribute('style', 'background: yellow; border: 1px solid red;');", element);
}

// Delete Dashboard
public void DeleteDashboard(WebDriver driver) throws InterruptedException {
    List<WebElement> objDashboard = driver.findElements(By.xpath("//div[text()='Dashboard']"));
    for (int i = 1; i <= objDashboard.size(); i++) {
        WebDriverWait wait = new WebDriverWait(driver, 30);
        WebElement objDashboardSettingsGrid = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[text()='Dashboard']/following-sibling::*[contains(@class,'jss')]")));
        if (objDashboardSettingsGrid.isDisplayed()) {
            executeJSClick(driver, objDashboardSettingsGrid);
            Thread.sleep(2000);
            WebElement objDashboardRemove = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//span[text()='Remove Dashboard']")));
            executeJSClick(driver, objDashboardRemove);
        } else {
            System.out.println("Settings object is not displayed");
        }
    }

}

// Delete Open Widget
public void DeleteOpenWidget(WebDriver driver, String WIDGET_NAME) throws InterruptedException {
    WebDriverWait wait = new WebDriverWait(driver, 30);
    WebElement objDashboardSettingsGrid = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[contains(text(),\'" + WIDGET_NAME + "\')]/following-sibling::div//style[contains(text(), '.jpmuitk-icon-settings')]//parent::span")));
    if (objDashboardSettingsGrid.isDisplayed()) {
        executeJSClick(driver, objDashboardSettingsGrid);
        Thread.sleep(2000);
        WebElement objDashboardRemove = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//span[text()='Remove widget']")));
        executeJSClick(driver, objDashboardRemove);
        Thread.sleep(5000);
    } else {
        System.out.println("Widget Settings object is not displayed");
    }
}


// THIS FUNCTIONS IS TO VALIDATE THE SORTING OF COLUMN WITH STRING VISIBLE ON THE SCREEN

// **PAGE DOWN IS NOT USED AS INDEX OF ELEMENT DYNAMICALLY CHANGES
// **PAGE DOWN IS NOT USED AS INDEX OF ELEMENT DYNAMICALLY CHANGES
// ** THIS IS WRITTEN CONSIDERING, ONE CLICK on COLUMN SORTS IN ASCENDING AND IF CLICKED TWICE IN DESCENDING
public boolean sortVerifyString(WebDriver driver, String WIDGET_NAME, String ColumnName, boolean bTC) throws InterruptedException, IOException, ParseException {

    System.out.println("----------------VALIDATING ASCENDING SORTING OF COLUMN: " + ColumnName + " --------------------");
    bTC = logger.fngRaisePassLog("----------------VALIDATING ASCENDING SORTING OF COLUMN : " + ColumnName + " --------------------", bTC);
    // Click once to sort the columns in Ascending order
    WebDriverWait wait = new WebDriverWait(driver, 30);
    WebElement objColumn = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//span[@class='ag-header-cell-text'][text()=\'" + ColumnName + "\']")));
    executeJSClick(driver, objColumn);
    Thread.sleep(2000);
    // Declare the list to be compared
    List<String> SortedList = new ArrayList();
    List<String> ActualList = new ArrayList();
    // Take row count of the Grid
    WebElement objGrid = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[contains(text(),\'" + WIDGET_NAME + "\')]/ancestor-or-self::div[@class='react-grid-item react-draggable cssTransforms react-resizable']/descendant::div[@class='ag-body-viewport ag-layout-normal']")));
    List<WebElement> rows = objGrid.findElements(By.xpath("./div[contains(@class, 'ag-body-container ag-layout-normal')]/descendant::div[@role='row']"));
    int numofChildren = rows.size();

    if (numofChildren > 0) {
        int flagColumndata = 0;
        int flagSort = 0;

        if (numofChildren > 28) {
            numofChildren = 28;
        }
        //int flagtest=0;
        // Loop through the column and store values in both lists

        if (ColumnName.equals("FourKey")) {
            for (int i = 0; i < numofChildren; i++) {
                SortedList.add(objGrid.findElement(By.xpath(".//div[@role='row' and @row-index=\'" + i + "\']//descendant::div[@col-id='ID']")).getText());
                ActualList.add(objGrid.findElement(By.xpath(".//div[@role='row' and @row-index=\'" + i + "\']//descendant::div[@col-id='ID']")).getText());
            }
        }
        if (ColumnName.equals("Date") || (ColumnName.equals("LastBidDate") || (ColumnName.equals("LastOfferDate")))) {

            for (int i = 0; i < numofChildren; i++) {

                if (("Date") == ("dd-MMM")) {
                    Calendar c = Calendar.getInstance();
                    c.setTime(new SimpleDateFormat("dd-MMM").parse(objGrid.findElement(By.xpath(".//div[@role='row' and @row-index=\'" + i + "\']//descendant::div[contains(@col-id,\'" + ColumnName + "\')]")).getText()));
                    String sortedDateVal1 = new SimpleDateFormat("yyyyMMdd").format(c.getTime());
                    SortedList.add(sortedDateVal1);
                    c.setTime(new SimpleDateFormat("dd-MMM").parse(objGrid.findElement(By.xpath(".//div[@role='row' and @row-index=\'" + i + "\']//descendant::div[contains(@col-id,\'" + ColumnName + "\')]")).getText()));
                    String sortedDateVal2 = new SimpleDateFormat("yyyyMMdd").format(c.getTime());
                    ActualList.add(sortedDateVal2);
                }

// else {
// Calendar c1 = Calendar.getInstance();
// c1.setTime(new SimpleDateFormat("dd:MM").parse(objGrid.findElement(By.xpath(".//div[@ROLE='row' and @row-index='" + i + "']//descendant::div[contains(@col-id,'" + ColumnName + "')]")).getText()));
// String sortedDateVal3 = new SimpleDateFormat("yyyyMMdd").format(c1.getTime());
// SortedList.add(sortedDateVal3);
// c1.setTime(new SimpleDateFormat("dd-MMM").parse(objGrid.findElement(By.xpath(".//div[@ROLE='row' and @row-index='" + i + "']//descendant::div[contains(@col-id,'" + ColumnName + "')]")).getText()));
// String sortedDateVal4 = new SimpleDateFormat("yyyyMMdd").format(c1.getTime());
// ActualList.add(sortedDateVal4);
// }
// if ((WIDGET_NAME== "TRADE BLOTTER") || (WIDGET_NAME=="BondTradeHistory"))
// {
// c.setTime(new SimpleDateFormat("dd:MMM").parse(objGrid.findElement(By.xpath(".//div[@ROLE='row' and @row-index='" + i + "']//descendant::div[contains(@col-id,'" + ColumnName + "')]")).getText()));
// String sortedDateVal3 = new SimpleDateFormat("yyyyMMdd").format(c.getTime());
// SortedList.add(sortedDateVal3);
// c.setTime(new SimpleDateFormat("dd:MMM").parse(objGrid.findElement(By.xpath(".//div[@ROLE='row' and @row-index='" + i + "']//descendant::div[contains(@col-id,'" + ColumnName + "')]")).getText()));
// String sortedDateVal4 = new SimpleDateFormat("yyyyMMdd").format(c.getTime());
// ActualList.add(sortedDateVal4);
// }
}
} else {
for (int i = 0; i < numofChildren; i++) {
//System.out.println(objGrid.findElement(By.xpath("//div[@ROLE='row' and @row-index='" + i + "']//descendant::div[@col-id='" +ColumnName+ "']")).getText());
SortedList.add(objGrid.findElement(By.xpath(".//div[@ROLE='row' and @row-index='" + i + "']//descendant::div[contains(@col-id,'" + ColumnName + "')]")).getText());
ActualList.add(objGrid.findElement(By.xpath(".//div[@ROLE='row' and @row-index='" + i + "']//descendant::div[contains(@col-id,'" + ColumnName + "')]")).getText());

         /*   // PAGE DOWN after 28 rows are navigated
            flagtest = flagtest+1;
            if(flagtest==28){
                Thread.sleep(1000);
                objGrid.findElement(By.xpath("//div[@role='row' and @row-index=\'" + i + "\']//descendant::div[@col-id=\'" +ColumnName+ "\']")).click();
                Thread.sleep(1000);
                Actions action = new Actions(driver);
                action.sendKeys(Keys.PAGE_DOWN).build().perform();
                flagtest=0;
            }
         */
            }
        }


        if (SortedList.size() > 0) {
            // Create an expected list
            Collections.sort(SortedList);


            // Validate Actual vs Expected list
            for (int i = 0; i < SortedList.size(); i++) {
                System.out.println(ColumnName + " :ACTUAL VALUE > " + ActualList.get(i) + "--" + ColumnName + " :EXPECTED VALUE > " + SortedList.get(i));
                if (!(SortedList.get(i).equals(ActualList.get(i)))) {
                    System.out.println(ColumnName + ": NOT SORTED : >>>>> FAIL <<<<< " + i);
                    bTC = logger.fngRaiseErrorLog(">>>> FAIL <<<<< " + ColumnName + " : NOT SORTED", driver, false);
                    flagSort = flagSort + 1;
                    break;
                }
            }
        } else {
            System.out.println(ColumnName + " No data visible on this column");
            logger.fngRaiseWarningLog(ColumnName + ": No data visible on this column", driver);
            flagColumndata = flagColumndata + 1;
        }
        if (flagSort == 0) {
            bTC = logger.fngRaisePassLog("ASCENDING SORTING PASSED FOR COLUMN : " + ColumnName + " --------------------", bTC);
        }


        System.out.println("----------------VALIDATING DESCENDING SORTING OF COLUMN: " + ColumnName + " --------------------");
        flagSort = 0;
        bTC = logger.fngRaisePassLog("----------------VALIDATING DESCENDING SORTING OF COLUMN : " + ColumnName + " --------------------", bTC);

        // Click once on already Ascending column to sort in Descending order

        WebElement objColumnAgain = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//span[@class='ag-header-cell-text'][text()=\'" + ColumnName + "\']")));
        executeJSClick(driver, objColumnAgain);
        Thread.sleep(2000);
        // Remove if there is already any data stored in the List
        SortedList.clear();
        ActualList.clear();


        if (ColumnName.equals("FourKey")) {
            // Loop through the column and store values in both lists
            for (int i = 0; i < numofChildren; i++) {
                //System.out.println(objGrid.findElement(By.xpath("//div[@role='row' and @row-index=\'" + i + "\']//descendant::div[@col-id=\'" +ColumnName+ "\']")).getText());
                SortedList.add(objGrid.findElement(By.xpath(".//div[@role='row' and @row-index=\'" + i + "\']//descendant::div[@col-id='ID']")).getText());
                ActualList.add(objGrid.findElement(By.xpath(".//div[@role='row' and @row-index=\'" + i + "\']//descendant::div[@col-id='ID']")).getText());
            }
        }
        if (ColumnName.equals("Date") || (ColumnName.equals("LastBidDate") || (ColumnName.equals("LastOfferDate")))) {
            for (int i = 0; i < numofChildren; i++) {

                Calendar c = Calendar.getInstance();
                c.setTime(new SimpleDateFormat("dd-MMM").parse(objGrid.findElement(By.xpath(".//div[@role='row' and @row-index=\'" + i + "\']//descendant::div[contains(@col-id,\'" + ColumnName + "\')]")).getText()));
                String sortedDateVal1 = new SimpleDateFormat("yyyyMMdd").format(c.getTime());
                SortedList.add(sortedDateVal1);
                c.setTime(new SimpleDateFormat("dd-MMM").parse(objGrid.findElement(By.xpath(".//div[@role='row' and @row-index=\'" + i + "\']//descendant::div[contains(@col-id,\'" + ColumnName + "\')]")).getText()));
                String sortedDateVal2 = new SimpleDateFormat("yyyyMMdd").format(c.getTime());
                ActualList.add(sortedDateVal2);

            }
        } else {
            // Loop through the column and store values in both lists
            for (int i = 0; i < numofChildren; i++) {
                //System.out.println(objGrid.findElement(By.xpath("//div[@role='row' and @row-index=\'" + i + "\']//descendant::div[@col-id=\'" +ColumnName+ "\']")).getText());
                SortedList.add(objGrid.findElement(By.xpath(".//div[@role='row' and @row-index=\'" + i + "\']//descendant::div[contains(@col-id,\'" + ColumnName + "\')]")).getText());
                ActualList.add(objGrid.findElement(By.xpath(".//div[@role='row' and @row-index=\'" + i + "\']//descendant::div[contains(@col-id,\'" + ColumnName + "\')]")).getText());
            }
        }


        if (SortedList.size() > 0) {
            // Create an expected list
            Collections.sort(SortedList);
            Collections.reverse(SortedList);

            // Validate Actual vs Expected list
            for (int i = 0; i < SortedList.size(); i++) {
                System.out.println(ColumnName + " :ACTUAL VALUE > " + ActualList.get(i) + "--" + ColumnName + " :EXPECTED VALUE > " + SortedList.get(i));
                if (!(SortedList.get(i).equals(ActualList.get(i)))) {
                    System.out.println(ColumnName + ": NOT SORTED : >>>>> FAIL <<<<< " + i);
                    bTC = logger.fngRaiseErrorLog(">>>> FAIL <<<<< " + ColumnName + " : NOT SORTED", driver, false);
                    flagSort = flagSort + 1;
                    break;
                }
            }
        } else {
            System.out.println(ColumnName + " No data visible on this column");
            logger.fngRaiseWarningLog(ColumnName + ": No data visible on this column", driver);
            flagColumndata = flagColumndata + 1;
        }

        if (flagSort == 0) {
            bTC = logger.fngRaisePassLog("DESCENDING SORTING PASSED FOR COLUMN : " + ColumnName + " --------------------", bTC);
        }


        if (flagColumndata > 1) {
            System.out.println(ColumnName + ">>>> NO DATA EXISTS <<<<");
            bTC = logger.fngRaiseErrorLog(">>>> >>>> NO DATA EXISTS <<<< <<<<< ", driver, false);
        }


    } else {
        System.out.println("FAIL - No data is available in " + WIDGET_NAME + "  Widget");
        bTC = logger.fngRaiseErrorLog("No data is available in" + WIDGET_NAME, driver, false);
    }

    return bTC;

}

// THIS FUNCTIONS IS TO VALIDATE THE SORTING OF COLUMN WITH NUMBERS VISIBLE ON THE SCREEN

// **PAGE DOWN IS NOT USED AS INDEX OF ELEMENT DYNAMICALLY CHANGES
// ** THIS IS WRITTEN CONSIDERING, ONE CLICK on COLUMN SORTS IN ASCENDING AND IF CLICKED TWICE IN DESCENDING
public boolean sortVerifyNumber(WebDriver driver, String WIDGET_NAME, String ColumnName, boolean bTC) throws InterruptedException, IOException {

    System.out.println("----------------VALIDATING ASCENDING SORTING OF COLUMN: " + ColumnName + " --------------------");
    bTC = logger.fngRaisePassLog("----------------VALIDATING ASCENDING SORTING OF COLUMN : " + ColumnName + " --------------------", bTC);
    // Click once to sort the columns in Ascending order
    WebDriverWait wait = new WebDriverWait(driver, 30);
    WebElement objColumn = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//span[@class='ag-header-cell-text'][text()=\'" + ColumnName + "\']")));
    executeJSClick(driver, objColumn);
    Thread.sleep(2000);
    // Declare the list to be compared
    List<Float> SortedList = new ArrayList();
    List<Float> ActualList = new ArrayList();
    // Take row count of the Grid
    WebElement objGrid = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[contains(text(),\'" + WIDGET_NAME + "\')]/ancestor-or-self::div[@class='react-grid-item react-draggable cssTransforms react-resizable']//descendant::div[@class='ag-body-viewport ag-layout-normal']")));
    List<WebElement> rows = objGrid.findElements(By.xpath("./div[contains(@class, 'ag-body-container ag-layout-normal')]/descendant::div[@role='row']"));
    int numofChildren = rows.size();


    if (numofChildren > 0) {
        int flagColumndata = 0;
        int flagSort = 0;

        if (numofChildren > 28) {
            numofChildren = 28;
        }
        // Loop through the column and store values in both lists
        for (int i = 0; i < numofChildren; i++) {
            //System.out.println(objGrid.findElement(By.xpath("//div[@role='row' and @row-index=\'" + i + "\']//descendant::div[@col-id=\'" + ColumnName + "\']")).getText());
            String tempString = objGrid.findElement(By.xpath(".//div[@role='row' and @row-index=\'" + i + "\']//descendant::div[@col-id=\'" + ColumnName + "\']")).getText();
            if (tempString != null && !tempString.equals("")) {
                if ((ColumnName.compareTo("Target") == 0) || (ColumnName.compareTo("Buy") == 0) || (ColumnName.compareTo("Sell") == 0) || (ColumnName.compareTo("Notional") == 0) || (ColumnName.compareTo("Utilization Value") == 0) || (ColumnName.compareTo("Utilization Percentage") == 0)) {
                    String lastChar = tempString.substring(tempString.length() - 1);
                    String[] arrNotionalValueslast = tempString.split(lastChar, 0);
                    int compareNotional = lastChar.compareTo("m");
                    int compareNotionalB = lastChar.compareTo("b");
                    int compareNotionalPercent = lastChar.compareTo("%");
                    Float fNotional;
                    if (ColumnName.compareTo("Target") == 0) {
                        if (compareNotional == 0) {
                            fNotional = Float.parseFloat(arrNotionalValueslast[0]);
                            fNotional = fNotional * 1000000;
                        } else if (compareNotionalB == 0) {
                            fNotional = Float.parseFloat(arrNotionalValueslast[0]);
                            fNotional = fNotional * 1000000000;
                        } else if (compareNotionalPercent == 0) {
                            fNotional = Float.parseFloat(arrNotionalValueslast[0]);
                        } else {
                            continue;
                        }
                    } else {
                        if (compareNotional == 0) {
                            fNotional = Float.parseFloat(arrNotionalValueslast[0]);
                            fNotional = fNotional * 1000000;
                        } else if (compareNotionalB == 0) {
                            fNotional = Float.parseFloat(arrNotionalValueslast[0]);
                            fNotional = fNotional * 1000000000;
                        } else if (compareNotionalPercent == 0) {
                            fNotional = Float.parseFloat(arrNotionalValueslast[0]);
                        } else {
                            fNotional = Float.parseFloat(arrNotionalValueslast[0]);
                            fNotional = fNotional * 1000;
                        }
                    }
                    SortedList.add(fNotional);
                    ActualList.add(fNotional);

                } else {
                    Float tempValue = Float.parseFloat(tempString);
                    SortedList.add(tempValue);
                    ActualList.add(tempValue);
                }
            }

        }

        if (SortedList.size() > 0) {

            // Create an expected list
            Collections.sort(SortedList);

            // Validate Actual vs Expected list
            for (int i = 0; i < SortedList.size(); i++) {
                System.out.println(ColumnName + " :ACTUAL VALUE > " + ActualList.get(i) + "--" + ColumnName + " :EXPECTED VALUE > " + SortedList.get(i));
                if (!(SortedList.get(i).equals(ActualList.get(i)))) {
                    System.out.println(ColumnName + ": NOT SORTED : >>>>> FAIL <<<<< " + i);
                    bTC = logger.fngRaiseErrorLog(">>>> FAIL <<<<< " + ColumnName + " : NOT SORTED", driver, false);
                    flagSort = flagSort + 1;
                    break;
                }
            }
        } else {
            System.out.println(ColumnName + ": No data visible on this column");
            logger.fngRaiseWarningLog(ColumnName + ": No data visible on this column", driver);
            flagColumndata = flagColumndata + 1;
        }

        if (flagSort == 0) {
            bTC = logger.fngRaisePassLog("ASCENDING SORTING PASSED FOR COLUMN : " + ColumnName + " --------------------", bTC);
        }


        System.out.println("----------------VALIDATING DESCENDING SORTING OF COLUMN: " + ColumnName + " --------------------");
        flagSort = 0;
        bTC = logger.fngRaisePassLog("----------------VALIDATING DESCENDING SORTING OF COLUMN : " + ColumnName + " --------------------", bTC);

        // Click once on already Ascending column to sort in Descending order
        WebElement objColumnAgain = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//span[@class='ag-header-cell-text'][text()=\'" + ColumnName + "\']")));
        executeJSClick(driver, objColumnAgain);
        Thread.sleep(2000);
        // Remove if there is already any data stored in the List
        SortedList.clear();
        ActualList.clear();

        // Loop through the column and store values in both lists
        for (int i = 0; i < numofChildren; i++) {
            //System.out.println(objGrid.findElement(By.xpath("//div[@role='row' and @row-index=\'" + i + "\']//descendant::div[@col-id=\'" + ColumnName + "\']")).getText());
            String tempString = objGrid.findElement(By.xpath(".//div[@role='row' and @row-index=\'" + i + "\']//descendant::div[@col-id=\'" + ColumnName + "\']")).getText();
            if (tempString != null && !tempString.equals("")) {
                if ((ColumnName.compareTo("Target") == 0) || (ColumnName.compareTo("Buy") == 0) || (ColumnName.compareTo("Sell") == 0) || (ColumnName.compareTo("Notional") == 0) || (ColumnName.compareTo("Utilization Value") == 0) || (ColumnName.compareTo("Utilization Percentage") == 0)) {
                    String lastChar = tempString.substring(tempString.length() - 1);
                    String[] arrNotionalValueslast = tempString.split(lastChar, 0);
                    int compareNotional = lastChar.compareTo("m");
                    int compareNotionalB = lastChar.compareTo("b");
                    int compareNotionalPercent = lastChar.compareTo("%");
                    Float fNotional;
                    if (ColumnName.compareTo("Target") == 0) {
                        if (compareNotional == 0) {
                            fNotional = Float.parseFloat(arrNotionalValueslast[0]);
                            fNotional = fNotional * 1000000;
                        } else if (compareNotionalB == 0) {
                            fNotional = Float.parseFloat(arrNotionalValueslast[0]);
                            fNotional = fNotional * 1000000000;
                        } else if (compareNotionalPercent == 0) {
                            fNotional = Float.parseFloat(arrNotionalValueslast[0]);
                        } else {
                            continue;
                        }
                    } else {
                        if (compareNotional == 0) {
                            fNotional = Float.parseFloat(arrNotionalValueslast[0]);
                            fNotional = fNotional * 1000000;
                        } else if (compareNotionalB == 0) {
                            fNotional = Float.parseFloat(arrNotionalValueslast[0]);
                            fNotional = fNotional * 1000000000;
                        } else if (compareNotionalPercent == 0) {
                            fNotional = Float.parseFloat(arrNotionalValueslast[0]);
                        } else {
                            fNotional = Float.parseFloat(arrNotionalValueslast[0]);
                            fNotional = fNotional * 1000;
                        }
                    }
                    SortedList.add(fNotional);
                    ActualList.add(fNotional);

                } else {
                    Float tempValue = Float.parseFloat(tempString);
                    SortedList.add(tempValue);
                    ActualList.add(tempValue);
                }
            }
        }

        if (SortedList.size() > 0) {
            // Create an expected list
            Collections.sort(SortedList);
            Collections.reverse(SortedList);

            // Validate Actual vs Expected list
            for (int i = 0; i < SortedList.size(); i++) {
                System.out.println(ColumnName + " :ACTUAL VALUE > " + ActualList.get(i) + "--" + ColumnName + " :EXPECTED VALUE > " + SortedList.get(i));
                if (!(SortedList.get(i).equals(ActualList.get(i)))) {
                    System.out.println(ColumnName + ": NOT SORTED : >>>>> FAIL <<<<< " + i);
                    bTC = logger.fngRaiseErrorLog(">>>> FAIL <<<<< " + ColumnName + " : NOT SORTED", driver, false);
                    flagSort = flagSort + 1;
                    break;
                }
            }
        } else {
            System.out.println(ColumnName + ": No data visible on this column");
            logger.fngRaiseWarningLog(ColumnName + ": No data visible on this column", driver);
            flagColumndata = flagColumndata + 1;
        }

        if (flagSort == 0) {
            bTC = logger.fngRaisePassLog("DESCENDING SORTING PASSED FOR COLUMN : " + ColumnName + " --------------------", bTC);
        }


        if (flagColumndata > 1) {
            System.out.println(ColumnName + ">>>> NO DATA EXISTS <<<<");
            bTC = logger.fngRaiseErrorLog(">>>> >>>> NO DATA EXISTS <<<< <<<<< ", driver, false);
        }


    } else {
        System.out.println("FAIL - No data is available in " + WIDGET_NAME + "  Widget");
        bTC = logger.fngRaiseErrorLog("No data is available in" + WIDGET_NAME, driver, false);
    }
    return bTC;

}


// THIS FUNCTIONS IS TO VALIDATE Fiters on the Widget

// **PAGE DOWN IS NOT USED AS INDEX OF ELEMENT DYNAMICALLY CHANGES

public boolean verifyFilter(WebDriver driver, String WIDGET_NAME, String ColumnName, String FILTER, String Values, boolean bTC) throws InterruptedException, IOException {
    System.out.println("----------------VALIDATING FILTER: " + FILTER + " --------------------");
    bTC = logger.fngRaisePassLog("----------------VALIDATING FILTER : " + FILTER + " --------------------", bTC);
    // Click on the filter
    WebDriverWait wait = new WebDriverWait(driver, 30);
    WebElement objGrid = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[contains(text(),\'" + WIDGET_NAME + "\')]/ancestor-or-self::div[@class='react-grid-item react-draggable cssTransforms react-resizable']//descendant::div[@class='ag-body-viewport ag-layout-normal']")));
    WebElement objFilter = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[contains(text(),\'" + WIDGET_NAME + "\')]/ancestor-or-self::div[@class='react-grid-item react-draggable cssTransforms react-resizable']//button[contains(.,\'" + FILTER + "\')]")));
    executeJSClick(driver, objFilter);
    Thread.sleep(8000);
    // Take row count of the Grid
    List<WebElement> rows = driver.findElements(By.xpath("//div[contains(text(),\'" + WIDGET_NAME + "\')]/ancestor-or-self::div[@class='react-grid-item react-draggable cssTransforms react-resizable']//descendant::div[@class='ag-body-viewport ag-layout-normal']//div[@role='row']"));
    int numofChildren = rows.size();
    WebElement objFilterRemove;
    switch (FILTER) {
        case "DONE":
        case "AWY":
        case "DID NOT TRADE":
        case "ACTIVE":
        case "CLOSED":
            String str = Values;
            String[] arrValues = str.split("~", 0);

            if (numofChildren > 0) {

                if (numofChildren > 28) {
                    numofChildren = 28;
                }
                // Loop through the column and store values in both lists
                for (int i = 0; i < numofChildren; i++) {
                    System.out.println(objGrid.findElement(By.xpath(".//div[@role='row' and @row-index=\'" + i + "\']//descendant::div[@col-id=\'" + ColumnName + "\']")).getText());
                    String tempValue = objGrid.findElement(By.xpath(".//div[@role='row' and @row-index=\'" + i + "\']//descendant::div[@col-id=\'" + ColumnName + "\']")).getText();
                    if (Arrays.asList(arrValues).contains(tempValue)) {

                    } else {
                        System.out.println("Incorrect Value -> " + tempValue + "for filter -> " + FILTER);
                        bTC = logger.fngRaiseErrorLog("Incorrect Value ->" + tempValue + "  for filter -> " + FILTER, driver, false);
                        break;
                    }
                }
            } else {
                System.out.println("No data is available in " + WIDGET_NAME + "  Widget for filter: " + FILTER);
                logger.fngRaiseWarningLog("No data is available in " + WIDGET_NAME + "  Widget for filter: " + FILTER, driver);
            }

            // Click on the filter to Remove
            objFilterRemove = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[contains(text(),\'" + WIDGET_NAME + "\')]/ancestor-or-self::div[@class='react-grid-item react-draggable cssTransforms react-resizable']//button[contains(.,\'" + FILTER + "\')]")));
            executeJSClick(driver, objFilterRemove);
            //executeJSClick(driver, objFilterRemove);
            break;

        case "≥1M":
        case ">2M":
        case ">3M":
        case ">4M":
        case ">5M":
            //TO BE ADDED SOON
            String arrNotionalValues;
            Float fNotional;

            if (numofChildren > 0) {

                if (numofChildren > 28) {
                    numofChildren = 28;
                }
                // Loop through the column and store values in both lists
                for (int i = 0; i < numofChildren; i++) {
                    String tempValue = objGrid.findElement(By.xpath(".//div[@role='row' and @row-index=\'" + i + "\']//descendant::div[@col-id=\'" + ColumnName + "\']")).getText();
                    String lastChar = tempValue.substring(tempValue.length() - 1);
                    String[] arrNotionalValueslast = tempValue.split(lastChar, 0);
                    int comparevar = arrNotionalValueslast[0].substring(0, 1).compareTo("-");

                    if (comparevar == 0) {
                        String[] arrNotionalValuestemp = arrNotionalValueslast[0].split("-", 0);
                        arrNotionalValues = arrNotionalValuestemp[1];
                    } else {
                        arrNotionalValues = arrNotionalValueslast[0];
                    }

                    int compareNotional = lastChar.compareTo("m");
                    int compareNotionalB = lastChar.compareTo("b");

                    if (compareNotional == 0) {
                        fNotional = Float.parseFloat(arrNotionalValues);
                        fNotional = fNotional * 1000000;
                    } else if (compareNotionalB == 0) {
                        fNotional = Float.parseFloat(arrNotionalValues);
                        fNotional = fNotional * 1000000000;
                    } else {
                        fNotional = Float.parseFloat(arrNotionalValues);
                        fNotional = fNotional * 1000;
                    }

                    int Int_FiterValue = 1000000;
                    switch (FILTER) {

                        case "≥1M":
                            Int_FiterValue = 1000000;
                            break;

                        case ">2M":
                            Int_FiterValue = 2000000;
                            break;

                        case ">3M":
                            Int_FiterValue = 3000000;
                            break;

                        case ">4M":
                            Int_FiterValue = 4000000;
                            break;

                        case ">5M":
                            Int_FiterValue = 5000000;
                            break;
                    }

                    if (fNotional < Int_FiterValue) {
                        System.out.println("FAIL -> " + tempValue + "is less than " + Int_FiterValue + " and diplayed in the filter");
                        bTC = logger.fngRaiseErrorLog("FAIL ->" + tempValue + " less than " + Int_FiterValue + " and diplayed in the filter", driver, false);
                        break;
                    } else {
                        System.out.println("Correct filter value displayed -> " + tempValue);
                    }

                }
            } else {
                System.out.println("No data is available in " + WIDGET_NAME + "  Widget for filter: " + FILTER);
                logger.fngRaiseWarningLog("No data is available in " + WIDGET_NAME + "  Widget for filter: " + FILTER, driver);
            }

            // Click on the filter to Remove
            objFilterRemove = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[contains(text(),\'" + WIDGET_NAME + "\')]/ancestor-or-self::div[@class='react-grid-item react-draggable cssTransforms react-resizable']//button[contains(.,\'" + FILTER + "\')]")));
            //objFilterRemove.click();
            executeJSClick(driver, objFilterRemove);
            break;


    }
    return bTC;

}


// CHECK LOADING **** under development ****
// THE METHOD IS TO CHECK IF PAGE OR A WIDGET IS STILL LOADING
// THIS METHOS WILL SEND FAILURE AFTER 50SEC
public void loading(WebDriver driver, String WIDGET_NAME) throws InterruptedException {
    WebDriverWait wait = new WebDriverWait(driver, 30);
    WebElement objloading;

    if (WIDGET_NAME != null && !WIDGET_NAME.equals("")) {
        objloading = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[contains(text(),\'" + WIDGET_NAME + "\')]/ancestor-or-self::div[@class='react-grid-item react-draggable cssTransforms react-resizable']/descendant::div[@aria-label='loading']")));
    } else {
        objloading = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@aria-label='loading']")));
    }
    long start_time = System.currentTimeMillis();
    long wait_time = 20000;
    long end_time = start_time + wait_time;

    while ((objloading.isDisplayed()) || (System.currentTimeMillis() < end_time)) {
        Thread.sleep(1000);

    }
    if (objloading.isDisplayed()) {
    } else {
        System.out.println("Data not loaded - " + WIDGET_NAME);
    }

}

public boolean mCheck(String strWidgetName, WebDriver driver, List listProp, List listActual, List listExpected, Boolean bFlag) throws IOException {
    //Validating WebElements
    for (int i = 0; i < listExpected.size(); i++) {
        List<String> expTemp = (List<String>) listExpected.get(i);
        List<Object> actTemp = (List<Object>) listActual.get(i);
        for (int j = 0; j < listProp.size(); j++) {
            String strCheckType = (String) listProp.get(j);
            switch (strCheckType) {

                case "Compare":
                    if (expTemp.get(j).trim().equals(actTemp.get(j).toString().trim())) {
                        bFlag = logger.fngRaisePassLog(strWidgetName + " " + strCheckType + " - " + expTemp.get(j).trim() + " == " + actTemp.get(j).toString().trim(), bFlag);
                    } else {
                        bFlag = logger.fngRaiseErrorLog(strWidgetName + " " + strCheckType + " - " + expTemp.get(j).trim() + " != " + actTemp.get(j).toString().trim(), driver, bFlag);
                    }
                    break;

                case "Visible":
                    boolean bExp = Boolean.parseBoolean(expTemp.get(j).trim());
                    WebElement x = (WebElement) actTemp.get(j);
                    boolean bAct = x.isDisplayed();
                    if (bExp == bAct) {
                        bFlag = logger.fngRaisePassLog(strWidgetName + " " + strCheckType + " - " + bExp + " == " + bAct, bFlag);
                    } else {
                        bFlag = logger.fngRaiseErrorLog(strWidgetName + " " + strCheckType + " - " + bExp + " != " + bAct, driver, bFlag);
                    }
                    break;

                case "Enable":
                    bExp = Boolean.parseBoolean(expTemp.get(j).trim());
                    x = (WebElement) actTemp.get(j);
                    bAct = x.isEnabled();
                    if (bExp == bAct) {
                        bFlag = logger.fngRaisePassLog(strWidgetName + " " + strCheckType + " - " + bExp + " == " + bAct, bFlag);
                    } else {
                        bFlag = logger.fngRaiseErrorLog(strWidgetName + " " + strCheckType + " - " + bExp + " != " + bAct, driver, bFlag);
                    }
                    break;

                case "Contains":
                    int intActLen = actTemp.get(j).toString().trim().length();
                    int intExpLen = expTemp.get(j).trim().length();
                    String str1, str2;
                    if (intActLen > intExpLen) {
                        str1 = actTemp.get(j).toString().trim();
                        str2 = expTemp.get(j).trim();
                    } else {
                        str1 = expTemp.get(j).trim();
                        str2 = actTemp.get(j).toString().trim();
                    }
                    if (str1.contains(str2)) {
                        bFlag = logger.fngRaisePassLog(strWidgetName + " " + strCheckType + " - " + expTemp.get(j).trim() + " contains " + actTemp.get(j).toString().trim(), bFlag);
                    } else {
                        bFlag = logger.fngRaiseErrorLog(strWidgetName + " " + strCheckType + " - " + expTemp.get(j).trim() + " does not contain " + actTemp.get(j).toString().trim(), driver, bFlag);
                    }
                    break;

                default:
                    System.out.println("Incorrect property provided");
            }
        }
    }
    return bFlag;
}


    //METHOD TO CONVERT BACKEND JSON DATA TO HASHMAP(Https API)
    public Map HTTPSUrl() {

        Map<String, String> jsonDataToHashmap = new HashMap<String, String>();
        String instrumentIdforBond = BondInfo.BondInfoData.get("id");
        jsonDataToHashmap.put("BOND INFO", "https://athena-app-preprod.jpmchase.net/emea/credit/dashboard/api/v1/json/BondRefData/%7B%22bondId%22%3A%22" + instrumentIdforBond + "%22%7D");
        jsonDataToHashmap.put("RISK PNL SUMMARY", "https://athena-app-preprod.jpmchase.net/CREDIT/dashboard-emea-risk-pnl/api/v1/json/RiskPNLSummaryStream/%7B%22filter%22%3A%7B%22level2%22%3A%5B%22IB%20RISK%22%2C%22CURRENCIES%20AND%20EMERGING%20MARKETS%22%2C%22PRIVATE%20CLIENT%20GROUP%22%2C%22ASIA%20RATES%22%2C%22GLOBAL%20CREDIT%20TRADING%20%26%20SYNDICATE%22%2C%22GLOBAL%20DCM%22%2C%22GLOBAL%20EMERGING%20MARKETS%22%2C%22CORPORATE%20ALIGNED-%20E%22%2C%22CIO%20-%20TREASURY%20SUMMARY-%20J%22%2C%22MORTGAGE%20PRODUCTION%20AND%20SERVICING%22%2C%22MARKETS%20MANAGEMENT%22%2C%22PRIME%20SERVICES%22%2C%22GLOBAL%20RATES%20%26%20RATES%20EXOTICS%22%2C%22COMMODITIES%20TRADING%22%2C%22GLOBAL%20SECURITIZED%20PRODUCTS%22%2C%22GLOBAL%20COVERAGE%20%26%20MGMT%22%2C%22FIXED%20INCOME%20FINANCING%22%2C%22GLOBAL%20WEALTH%20MANAGEMENT%22%2C%22GLOBAL%20CREDIT%20CORRELATION%20NF%22%2C%22PUBLIC%20FINANCE%22%2C%22GLOBAL%20CREDIT%20TRADING%20%26%20SYNDICATE_TEST%22%2C%22JPS%22%5D%7D%7D");
        jsonDataToHashmap.put("DAILY TRADES", "http://athena-app-preprod.jpmchase.net/CREDIT/amer-bond-daily-entitled-trade/api/v1/json/DailyTrades/%7B%22filterMode%22%3A%22BOOK%22%2C%22filterArgs%22%3A%7B%22includes%22%3A%7B%22Level2%22%3A%5B%7B%22id%22%3A%22GLOBAL%20CREDIT%20TRADING%20%26%20SYNDICATE%22%2C%22name%22%3A%22GLOBAL%20CREDIT%20TRADING%20%26%20SYNDICATE%22%7D%5D%7D%7D%7D");
        jsonDataToHashmap.put("TRADE HISTORY SUMMARY", "http://athena-app-preprod.jpmchase.net/CREDIT/emea-bond-entitled-trade/api/v1/json/TradeHistorySummary/%7B%22bondId%22%3A%22" + TradeHistorySummary.strAthenaBondID + "%22%2C%22filterMode%22%3A%22BOOK%22%2C%22filterArgs%22%3A%7B%22includes%22%3A%7B%22Level2%22%3A%5B%7B%22id%22%3A%22GLOBAL%20CREDIT%20TRADING%20%26%20SYNDICATE%22%2C%22name%22%3A%22GLOBAL%20CREDIT%20TRADING%20%26%20SYNDICATE%22%7D%5D%7D%7D%2C%22seriesLinkageMode%22%3A%22UNLINKED%22%2C%22sources%22%3A%5Bnull%5D%2C%22tenor%22%3A%221M%22%7D");
        //jsonDataToHashmap.put("DAILY TRADES", "http://athena-app-preprod.jpmchase.net/CREDIT/amer-bond-daily-entitled-trade/api/v1/json/DailyTrades/%7B%22filterMode%22%3A%22BOOK%22%2C%22filterArgs%22%3A%7B%22includes%22%3A%7B%22Level2%22%3A%5B%7B%22id%22%3A%22GLOBAL%20CREDIT%20TRADING%20%26%20SYNDICATE%22%2C%22name%22%3A%22GLOBAL%20CREDIT%20TRADING%20%26%20SYNDICATE%22%7D%5D%7D%7D%7D");
        //jsonDataToHashmap.put("TRADE HISTORY SUMMARY", "http://athena-app-preprod.jpmchase.net/CREDIT/emea-bond-entitled-trade/api/v1/json/TradeHistorySummary/%7B%22bondId%22%3A%22" + TradeHistorySummary.strAthenaBondID + "%22%2C%22filterMode%22%3A%22BOOK%22%2C%22filterArgs%22%3A%7B%22includes%22%3A%7B%22Level2%22%3A%5B%7B%22id%22%3A%22GLOBAL%20CREDIT%20TRADING%20%26%20SYNDICATE%22%2C%22name%22%3A%22GLOBAL%20CREDIT%20TRADING%20%26%20SYNDICATE%22%7D%5D%7D%7D%2C%22seriesLinkageMode%22%3A%22UNLINKED%22%2C%22sources%22%3A%5Bnull%5D%2C%22tenor%22%3A%221M%22%7D");
        return jsonDataToHashmap;
    }


    //METHOD TO CONVERT BACKEND JSON DATA TO HASHMAP(WSS API)
    public Map WSSUrl() {

        Map<String, String> jsonDataToHashmap = new HashMap<String, String>();
        jsonDataToHashmap.put("POSITION", "wss://athena-app-preprod.jpmchase.net/CREDIT/emea-bond-position/api/v1/ws");
        jsonDataToHashmap.put("INTEREST HISTORY", "wss://athena-app-preprod.jpmchase.net/CREDIT/emea-bond-rfq/api/v1/ws");
        jsonDataToHashmap.put("INTEREST HISTORY SUMMARY", "wss://athena-app-preprod.jpmchase.net/CREDIT/emea-bond-daily-rfq/api/v1/ws");
        jsonDataToHashmap.put("CDS INFO", "wss://athena-app-preprod.jpmchase.net/CREDIT/dashboard-search/api/v1/ws");
        jsonDataToHashmap.put("RISK PNL SUMMARY", " ");
        return jsonDataToHashmap;
    }



//METHOD TO PASS REQUEST OF THE WSS CALL
public Map WssRequest() {

    Map<String, String> jsonDataToHashmap = new HashMap<String, String>();
    jsonDataToHashmap.put("POSITION", "{\"format\":\"stream\",\"source\":\"Position\",\"key\":\"%7B%22bondId%22%3A%22BOND.Ad-C0r%22%2C%22filterMode%22%3A%22BOOK%22%2C%22filterArgs%22%3A%7B%22includes%22%3A%7B%22Level2%22%3A%5B%7B%22id%22%3A%22GLOBAL%20WEALTH%20MANAGEMENT%22%2C%22name%22%3A%22GLOBAL%20WEALTH%20MANAGEMENT%22%7D%2C%7B%22id%22%3A%22IB%20RISK%22%2C%22name%22%3A%22IB%20RISK%22%7D%2C%7B%22id%22%3A%22ASIA%20RATES%22%2C%22name%22%3A%22ASIA%20RATES%22%7D%2C%7B%22id%22%3A%22CURRENCIES%20AND%20EMERGING%20MARKETS%22%2C%22name%22%3A%22CURRENCIES%20AND%20EMERGING%20MARKETS%22%7D%2C%7B%22id%22%3A%22MARKETS%20MANAGEMENT%22%2C%22name%22%3A%22MARKETS%20MANAGEMENT%22%7D%2C%7B%22id%22%3A%22PUBLIC%20FINANCE%22%2C%22name%22%3A%22PUBLIC%20FINANCE%22%7D%2C%7B%22id%22%3A%22GLOBAL%20CREDIT%20TRADING%20%26%20SYNDICATE%22%2C%22name%22%3A%22GLOBAL%20CREDIT%20TRADING%20%26%20SYNDICATE%22%7D%2C%7B%22id%22%3A%22PRIVATE%20CLIENT%20GROUP%22%2C%22name%22%3A%22PRIVATE%20CLIENT%20GROUP%22%7D%2C%7B%22id%22%3A%22GLOBAL%20CREDIT%20TRADING%20%26%20SYNDICATE_TEST%22%2C%22name%22%3A%22GLOBAL%20CREDIT%20TRADING%20%26%20SYNDICATE_TEST%22%7D%2C%7B%22id%22%3A%22PRIME%20SERVICES%22%2C%22name%22%3A%22PRIME%20SERVICES%22%7D%2C%7B%22id%22%3A%22GLOBAL%20RATES%20%26%20RATES%20EXOTICS%22%2C%22name%22%3A%22GLOBAL%20RATES%20%26%20RATES%20EXOTICS%22%7D%2C%7B%22id%22%3A%22COMMODITIES%20TRADING%22%2C%22name%22%3A%22COMMODITIES%20TRADING%22%7D%2C%7B%22id%22%3A%22GLOBAL%20SECURITIZED%20PRODUCTS%22%2C%22name%22%3A%22GLOBAL%20SECURITIZED%20PRODUCTS%22%7D%2C%7B%22id%22%3A%22GLOBAL%20DCM%22%2C%22name%22%3A%22GLOBAL%20DCM%22%7D%2C%7B%22id%22%3A%22GLOBAL%20COVERAGE%20%26%20MGMT%22%2C%22name%22%3A%22GLOBAL%20COVERAGE%20%26%20MGMT%22%7D%2C%7B%22id%22%3A%22FIXED%20INCOME%20FINANCING%22%2C%22name%22%3A%22FIXED%20INCOME%20FINANCING%22%7D%2C%7B%22id%22%3A%22GLOBAL%20EMERGING%20MARKETS%22%2C%22name%22%3A%22GLOBAL%20EMERGING%20MARKETS%22%7D%2C%7B%22id%22%3A%22GLOBAL%20CREDIT%20CORRELATION%20NF%22%2C%22name%22%3A%22GLOBAL%20CREDIT%20CORRELATION%20NF%22%7D%5D%7D%7D%2C%22seriesLinkageMode%22%3A%22UNLINKED%22%7D\",\"id\":\"ef2c19d3-6ec1-4657-b70a-1dc81d683a67\",\"model\":\"ef2c19d3-6ec1-4657-b70a-1dc81d683a67\",\"verb\":\"get\",\"params\":{\"bondId\":\"BOND.Ad-C0r\",\"filterMode\":\"BOOK\",\"filterArgs\":{\"includes\":{\"Level2\":[{\"id\":\"GLOBAL WEALTH MANAGEMENT\",\"name\":\"GLOBAL WEALTH MANAGEMENT\"},{\"id\":\"IB RISK\",\"name\":\"IB RISK\"},{\"id\":\"ASIA RATES\",\"name\":\"ASIA RATES\"},{\"id\":\"CURRENCIES AND EMERGING MARKETS\",\"name\":\"CURRENCIES AND EMERGING MARKETS\"},{\"id\":\"MARKETS MANAGEMENT\",\"name\":\"MARKETS MANAGEMENT\"},{\"id\":\"PUBLIC FINANCE\",\"name\":\"PUBLIC FINANCE\"},{\"id\":\"GLOBAL CREDIT TRADING & SYNDICATE\",\"name\":\"GLOBAL CREDIT TRADING & SYNDICATE\"},{\"id\":\"PRIVATE CLIENT GROUP\",\"name\":\"PRIVATE CLIENT GROUP\"},{\"id\":\"GLOBAL CREDIT TRADING & SYNDICATE_TEST\",\"name\":\"GLOBAL CREDIT TRADING & SYNDICATE_TEST\"},{\"id\":\"PRIME SERVICES\",\"name\":\"PRIME SERVICES\"},{\"id\":\"GLOBAL RATES & RATES EXOTICS\",\"name\":\"GLOBAL RATES & RATES EXOTICS\"},{\"id\":\"COMMODITIES TRADING\",\"name\":\"COMMODITIES TRADING\"},{\"id\":\"GLOBAL SECURITIZED PRODUCTS\",\"name\":\"GLOBAL SECURITIZED PRODUCTS\"},{\"id\":\"GLOBAL DCM\",\"name\":\"GLOBAL DCM\"},{\"id\":\"GLOBAL COVERAGE & MGMT\",\"name\":\"GLOBAL COVERAGE & MGMT\"},{\"id\":\"FIXED INCOME FINANCING\",\"name\":\"FIXED INCOME FINANCING\"},{\"id\":\"GLOBAL EMERGING MARKETS\",\"name\":\"GLOBAL EMERGING MARKETS\"},{\"id\":\"GLOBAL CREDIT CORRELATION NF\",\"name\":\"GLOBAL CREDIT CORRELATION NF\"}]}},\"seriesLinkageMode\":\"UNLINKED\"}})");
    jsonDataToHashmap.put("INTEREST HISTORY", "{\"format\":\"stream\",\"source\":\"Interest\",\"key\":\"%7B%22bondId%22%3A%22BOND.EK-5Dh0K%22%2C%22filterMode%22%3A%22BOOK%22%2C%22filterArgs%22%3A%7B%22includes%22%3A%7B%22Level2%22%3A%5B%7B%22id%22%3A%22GLOBAL%20WEALTH%20MANAGEMENT%22%2C%22name%22%3A%22GLOBAL%20WEALTH%20MANAGEMENT%22%7D%2C%7B%22id%22%3A%22IB%20RISK%22%2C%22name%22%3A%22IB%20RISK%22%7D%2C%7B%22id%22%3A%22ASIA%20RATES%22%2C%22name%22%3A%22ASIA%20RATES%22%7D%2C%7B%22id%22%3A%22CURRENCIES%20AND%20EMERGING%20MARKETS%22%2C%22name%22%3A%22CURRENCIES%20AND%20EMERGING%20MARKETS%22%7D%2C%7B%22id%22%3A%22MARKETS%20MANAGEMENT%22%2C%22name%22%3A%22MARKETS%20MANAGEMENT%22%7D%2C%7B%22id%22%3A%22PUBLIC%20FINANCE%22%2C%22name%22%3A%22PUBLIC%20FINANCE%22%7D%2C%7B%22id%22%3A%22GLOBAL%20CREDIT%20TRADING%20%26%20SYNDICATE%22%2C%22name%22%3A%22GLOBAL%20CREDIT%20TRADING%20%26%20SYNDICATE%22%7D%2C%7B%22id%22%3A%22PRIVATE%20CLIENT%20GROUP%22%2C%22name%22%3A%22PRIVATE%20CLIENT%20GROUP%22%7D%2C%7B%22id%22%3A%22GLOBAL%20CREDIT%20TRADING%20%26%20SYNDICATE_TEST%22%2C%22name%22%3A%22GLOBAL%20CREDIT%20TRADING%20%26%20SYNDICATE_TEST%22%7D%2C%7B%22id%22%3A%22PRIME%20SERVICES%22%2C%22name%22%3A%22PRIME%20SERVICES%22%7D%2C%7B%22id%22%3A%22GLOBAL%20RATES%20%26%20RATES%20EXOTICS%22%2C%22name%22%3A%22GLOBAL%20RATES%20%26%20RATES%20EXOTICS%22%7D%2C%7B%22id%22%3A%22COMMODITIES%20TRADING%22%2C%22name%22%3A%22COMMODITIES%20TRADING%22%7D%2C%7B%22id%22%3A%22GLOBAL%20SECURITIZED%20PRODUCTS%22%2C%22name%22%3A%22GLOBAL%20SECURITIZED%20PRODUCTS%22%7D%2C%7B%22id%22%3A%22GLOBAL%20DCM%22%2C%22name%22%3A%22GLOBAL%20DCM%22%7D%2C%7B%22id%22%3A%22GLOBAL%20COVERAGE%20%26%20MGMT%22%2C%22name%22%3A%22GLOBAL%20COVERAGE%20%26%20MGMT%22%7D%2C%7B%22id%22%3A%22FIXED%20INCOME%20FINANCING%22%2C%22name%22%3A%22FIXED%20INCOME%20FINANCING%22%7D%2C%7B%22id%22%3A%22GLOBAL%20EMERGING%20MARKETS%22%2C%22name%22%3A%22GLOBAL%20EMERGING%20MARKETS%22%7D%2C%7B%22id%22%3A%22GLOBAL%20CREDIT%20CORRELATION%20NF%22%2C%22name%22%3A%22GLOBAL%20CREDIT%20CORRELATION%20NF%22%7D%5D%7D%7D%2C%22seriesLinkageMode%22%3A%22UNLINKED%22%2C%22sources%22%3A%5B%22RFQ%22%2C%22IOI%22%5D%2C%22tenor%22%3A%221M%22%7D\",\"id\":\"66148ce1-9092-4d8d-ab1d-4e970c04ad57\",\"model\":\"66148ce1-9092-4d8d-ab1d-4e970c04ad57\",\"verb\":\"get\",\"params\":{\"bondId\":\"BOND.EK-5Dh0K\",\"filterMode\":\"BOOK\",\"filterArgs\":{\"includes\":{\"Level2\":[{\"id\":\"GLOBAL WEALTH MANAGEMENT\",\"name\":\"GLOBAL WEALTH MANAGEMENT\"},{\"id\":\"IB RISK\",\"name\":\"IB RISK\"},{\"id\":\"ASIA RATES\",\"name\":\"ASIA RATES\"},{\"id\":\"CURRENCIES AND EMERGING MARKETS\",\"name\":\"CURRENCIES AND EMERGING MARKETS\"},{\"id\":\"MARKETS MANAGEMENT\",\"name\":\"MARKETS MANAGEMENT\"},{\"id\":\"PUBLIC FINANCE\",\"name\":\"PUBLIC FINANCE\"},{\"id\":\"GLOBAL CREDIT TRADING & SYNDICATE\",\"name\":\"GLOBAL CREDIT TRADING & SYNDICATE\"},{\"id\":\"PRIVATE CLIENT GROUP\",\"name\":\"PRIVATE CLIENT GROUP\"},{\"id\":\"GLOBAL CREDIT TRADING & SYNDICATE_TEST\",\"name\":\"GLOBAL CREDIT TRADING & SYNDICATE_TEST\"},{\"id\":\"PRIME SERVICES\",\"name\":\"PRIME SERVICES\"},{\"id\":\"GLOBAL RATES & RATES EXOTICS\",\"name\":\"GLOBAL RATES & RATES EXOTICS\"},{\"id\":\"COMMODITIES TRADING\",\"name\":\"COMMODITIES TRADING\"},{\"id\":\"GLOBAL SECURITIZED PRODUCTS\",\"name\":\"GLOBAL SECURITIZED PRODUCTS\"},{\"id\":\"GLOBAL DCM\",\"name\":\"GLOBAL DCM\"},{\"id\":\"GLOBAL COVERAGE & MGMT\",\"name\":\"GLOBAL COVERAGE & MGMT\"},{\"id\":\"FIXED INCOME FINANCING\",\"name\":\"FIXED INCOME FINANCING\"},{\"id\":\"GLOBAL EMERGING MARKETS\",\"name\":\"GLOBAL EMERGING MARKETS\"},{\"id\":\"GLOBAL CREDIT CORRELATION NF\",\"name\":\"GLOBAL CREDIT CORRELATION NF\"}]}},\"seriesLinkageMode\":\"UNLINKED\",\"sources\":[\"RFQ\",\"IOI\"],\"tenor\":\"1M\"}}");
    jsonDataToHashmap.put("INTEREST HISTORY SUMMARY", "wss://athena-app-preprod.jpmchase.net/CREDIT/emea-bond-daily-rfq/api/v1/ws");
    jsonDataToHashmap.put("CDS INFO", "wss://athena-app-preprod.jpmchase.net/CREDIT/dashboard-search/api/v1/ws");
    jsonDataToHashmap.put("RISK PNL SUMMARY", " ");
    return jsonDataToHashmap;
}



// Method to Open a Widget that belongs to a certain Category
    public void OpenWidgetSubCategory(WebDriver driver, String WIDGET_NAME, String SubCategory) throws InterruptedException {

        WebElement iconElement = getDriver().findElement(By.xpath("//*[contains(@class, 'jpmuitk-icon-grid-solid')]"));
        executeJSClick(driver, iconElement);
        Thread.sleep(3000);

        // locating webelements and entering an instrument
        WebElement txtWidgetSearch = getDriver().findElement(By.xpath("//input[@placeholder='Search Widget']"));
        txtWidgetSearch.sendKeys(WIDGET_NAME);
        Thread.sleep(1000);
        WebElement WEsubCategory = getDriver().findElement(By.xpath("//*[contains(text(),'" + SubCategory + "')]//ancestor::div[1]//following-sibling::div[contains(@class, 'jss')]/descendant::div[text()=\'" + WIDGET_NAME + "\']"));
        executeJSClick(driver, WEsubCategory);
        txtWidgetSearch.sendKeys(Keys.ESCAPE);

        //  ********************** Expand the Widget *****************************

        //WebDriverWait wait = new WebDriverWait(driver, 30);
   /* WebElement objGrid = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[contains(text(),\'" + WIDGET_NAME + "\')]/ancestor-or-self::div[@class='react-grid-item react-draggable cssTransforms react-resizable']")));
      WebElement resizeable = objGrid.findElement(By.xpath("./span[@class='react-resizable-handle']"));
    //highlighterMethod(driver, resizeable);
    executeJavascript(driver, "arguments[0].style.height = '1000px'", resizeable);
    executeJavascript(driver, "arguments[0].style.width = '2200px'", resizeable);*/
        // WebElement objGrid = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[contains(text(),\'" + WIDGET_NAME + "\')]/ancestor-or-self::div[@class='react-grid-item react-draggable cssTransforms react-resizable']")));

        WebElement resizeable = driver.findElement(By.xpath("//*[text()= \'" + WIDGET_NAME + "\']//ancestor::div[contains(@class, 'react-grid-item')]"));
        executeJavascript(driver, "arguments[0].style.height = '1000px'", resizeable);
        executeJavascript(driver, "arguments[0].style.width = '2200px'", resizeable);


    }


    //OPEN BOND INFO WIDGET AND GET INSTRUMENT ID
    public String GetInstrumentIdFromBondInfo(WebDriver driver) throws InterruptedException {

        WebElement iconElement = driver.findElement(By.xpath("//*[contains(@class, 'jpmuitk-icon-grid-solid')]"));
        //executor.executeScript("arguments[0].click();", iconElement);
        executeJSClick(driver, iconElement);
        Thread.sleep(3000);

        // locating webelement and entering an instrument
        WebElement txtWidgetSearch = driver.findElement(By.xpath("//input[@placeholder='Search Widget']"));
        txtWidgetSearch.sendKeys("BOND INFO");
        WebElement widget = driver.findElement(By.xpath("//*[text()= \'" + "BOND INFO" + "\']"));
        executeJSClick(driver, widget);
        txtWidgetSearch.sendKeys(Keys.ESCAPE);

        //  ********************** Expand the Widget *****************************
        WebElement resizeable = driver.findElement(By.xpath("//span[@class='react-resizable-handle']"));
        //highlighterMethod(driver, resizeable);
        executeJavascript(driver, "arguments[0].style.height = '1000px'", resizeable);
        executeJavascript(driver, "arguments[0].style.width = '2200px'", resizeable);
        Thread.sleep(5000);
        WebElement All = driver.findElement(By.xpath("//*[text()= 'All']"));
        executor.executeScript("arguments[0].click();", All);
        executor.executeScript("window.scrollBy(0,1000)", "");
        WebElement instrumentId = driver.findElement(By.xpath("//div[contains(text(),'Athena')]//following-sibling::div[contains(@class, 'jss')]"));
        System.out.println(instrumentId.getText());
        String InstrumentIdText = instrumentId.getText();
        Thread.sleep(8000);
        DeleteOpenWidget(driver, "BOND INFO");
        return InstrumentIdText;
    }

    public static String mConvertToKM(String strNotional) {
        //Conversion using parseLong(String) method
        float num = Float.parseFloat(strNotional);//Long.parseLong(strNotional);
        float temp;
        String strTemp;
        List<String> arrTemp1 = new ArrayList<String>();
        if (num >= 1000000) {
            temp = num / 1000000;
            strTemp = Float.toString(temp);
            arrTemp1 = Arrays.asList(strTemp.split("\\."));
            if (Integer.parseInt(arrTemp1.get(1)) > 0) {
                strNotional = Float.toString(temp) + "m";
            } else {
                strNotional = arrTemp1.get(0) + "m";
            }
        } else {
            temp = num / 1000;
            strTemp = Float.toString(temp);
            arrTemp1 = Arrays.asList(strTemp.split("\\."));
            if (Integer.parseInt(arrTemp1.get(1)) > 0) {
                strNotional = Float.toString(temp) + "k";
            } else {
                strNotional = arrTemp1.get(0) + "k";

            }
        }
        return strNotional;
    }

    //OPEN BOND INFO WIDGET AND GET INSTRUMENT ID
    public boolean OpenBlotterWidget_ClickItem(WebDriver driver, String subCategory, String widgetName, String columnName) throws InterruptedException, IOException {
        boolean mTC = false;
        WebElement iconElement = getDriver().findElement(By.xpath("//*[contains(@class, 'jpmuitk-icon-grid-solid')]"));
        executeJSClick(driver, iconElement);
        Thread.sleep(3000);

        //Opening the widget
        OpenWidgetSubCategory(driver, widgetName, subCategory);
        Thread.sleep(3000);

        //  ********************** Click on Widget item *****************************
        // Take row count of the Grid
        WebDriverWait wait = new WebDriverWait(driver, 30);
        WebElement objGrid = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[contains(text(),\'" + widgetName + "\')]/ancestor-or-self::div[@class='react-grid-item react-draggable cssTransforms react-resizable']//descendant::div[@class='ag-body-viewport ag-layout-normal']")));
        List<WebElement> rows = objGrid.findElements(By.xpath("//div[contains(@class, 'ag-body-container ag-layout-normal')]/descendant::div[@role='row']"));
        int numofChildren = rows.size();
        if (numofChildren > 0) {
            WebElement gridItem = objGrid.findElement(By.xpath("//div[@role='row' and @row-index='0']//descendant::div[contains(@col-id,\'" + columnName + "\')]"));
            driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
            executeJSClick(driver, gridItem);
            mTC = true;
            Thread.sleep(3000);
        }
        //Removing this, the widget closes before we can perform any action. Can be deleted later based on our usage in classes
        //DeleteOpenWidget(driver, widgetName);
        return mTC;
    }

    //To Expand the Widget
    public void ExpandWidget(WebDriver driver, String WIDGET_NAME) throws InterruptedException {
        WebElement resizeable = driver.findElement(By.xpath("//div[contains(text(),\'" + WIDGET_NAME + "\')]/ancestor-or-self::div[@class='react-grid-item react-draggable cssTransforms react-resizable']/descendant::span[@class='react-resizable-handle']"));
        executeJavascript(driver, "arguments[0].style.height = '1000px'", resizeable);
        executeJavascript(driver, "arguments[0].style.width = '2200px'", resizeable);
        Actions action = new Actions(driver);
        Thread.sleep(1000);
        Action resize = action.clickAndHold(resizeable).moveByOffset(1200, 550).release().build();
        Thread.sleep(1000);
        resize.perform();
        Thread.sleep(8000);
    }


    // Select Setting
    public void SelectSetting(WebDriver driver, String WIDGET_NAME, String OPTION, String Value) throws InterruptedException {

        WebDriverWait wait;
        WebElement objDashboardSettingsGrid;

        switch (OPTION) {
            case "Display View":
                wait = new WebDriverWait(driver, 30);
                objDashboardSettingsGrid = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[contains(text(),\'" + WIDGET_NAME + "\')]/following-sibling::*[contains(@class,'jss')]")));
                if (objDashboardSettingsGrid.isDisplayed()) {
                    executeJSClick(driver, objDashboardSettingsGrid);
                    Thread.sleep(2000);
                    WebElement objGrid = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[contains(text(),\'" + WIDGET_NAME + "\')]/ancestor-or-self::div[@class='react-grid-item react-draggable cssTransforms react-resizable']")));
                    WebElement objDashboardDisplayView = objGrid.findElement(By.xpath(".//input[@value=\'" + Value + "\' and @type='radio' and @name='displayView']"));
                    executeJSClick(driver, objDashboardDisplayView);
                    Thread.sleep(2000);
                    executeJSClick(driver, objDashboardSettingsGrid);
                } else {
                    System.out.println("Widget Settings object is not displayed");
                }
                break;

            case "Widget Filter":
                break;

            case "Notional Filter":
                wait = new WebDriverWait(driver, 30);
                objDashboardSettingsGrid = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[contains(text(),\'" + WIDGET_NAME + "\')]/following-sibling::*[contains(@class,'jss')]")));
                if (objDashboardSettingsGrid.isDisplayed()) {
                    executeJSClick(driver, objDashboardSettingsGrid);
                    Thread.sleep(2000);
                    WebElement objGrid = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[contains(text(),\'" + WIDGET_NAME + "\')]/ancestor-or-self::div[@class='react-grid-item react-draggable cssTransforms react-resizable']")));
                    WebElement objNotionalFilter = objGrid.findElement(By.xpath(".//descendant::div[contains(text(),\'" + OPTION + "\')]/parent::div[contains(@class,'jss')]/descendant::input[@type='text']"));
                    objNotionalFilter.sendKeys(Keys.CONTROL + "a");
                    objNotionalFilter.sendKeys(Value);
                    Thread.sleep(2000);
                    Actions action = new Actions(driver);
                    action.sendKeys(Keys.PAGE_DOWN).build().perform();
                    action.sendKeys(Keys.ENTER).build().perform();
                    executeJSClick(driver, objDashboardSettingsGrid);
                } else {
                    System.out.println("Widget Settings object is not displayed");
                }
                break;

        }

    }

    public List<List> mSuperListGUIValidations(List arrBtnProp, List<String> listExpectedText, List<String> listExpectedVisible, List<String> listExpectedEnable, List<WebElement> listWidgetWebElement, String type) {
        List<List> arrList = new ArrayList<List>();
        switch (type) {
            case "Expected":
                for (int i = 0; i < listExpectedText.size(); i++) {
                    List<String> listTemp = new ArrayList<String>();
                    for (int x = 0; x < arrBtnProp.size(); x++) {
                        switch (arrBtnProp.get(x).toString().trim()) {
                            case "Compare":
                            case "Contains":
                                listTemp.add(listExpectedText.get(i).trim());
                                break;
                            case "Visible":
                                listTemp.add(listExpectedVisible.get(i).trim());
                                break;
                            case "Enable":
                                listTemp.add(listExpectedEnable.get(i).trim());
                                break;
                        }
                    }
                    arrList.add(listTemp);
                }
                break;
            case "Actual":
                for (int i = 0; i < listWidgetWebElement.size(); i++) {
                    List<Object> listTemp = new ArrayList<Object>();
                    for (int x = 0; x < arrBtnProp.size(); x++) {
                        switch (arrBtnProp.get(x).toString().trim()) {
                            case "Compare":
                            case "Contains":
                                listTemp.add(listWidgetWebElement.get(i).getText());
                                break;
                            case "Visible":
                                listTemp.add(listWidgetWebElement.get(i));
                                break;
                            case "Enable":
                                listTemp.add(listWidgetWebElement.get(i));
                                break;
                        }
                    }
                    arrList.add(listTemp);
                }
                break;
        }
        return arrList;
    }


    // TO FILTER CERTAIN COLUMN VALUE AND PRINT THE VALUE AFTER THAT TO VALIDATE

    public void FilterSearch(WebDriver driver, String WIDGET_NAME) throws InterruptedException {
        WebElement columnHeader = null;
        WebDriverWait wait = new WebDriverWait(driver, 20);
        WebElement objGrid = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[contains(text(), \'" + WIDGET_NAME + "\')]//following::div[contains(@class, 'ag-root ag-font-style ag')]")));
        Map<String, String> mapTestData;
        mapTestData = ReadExcelSheetData.getTestData(mapWidgetData, WIDGET_NAME);
        String[] columnName = String.valueOf(mapTestData.get("ColumnList")).split(",");

        for (int i = 0; i < columnName.length; i++) {
            WebElement gridItem = null;
            if (columnName[i].contains("Date") || columnName[i].contains("Notional") || columnName[i].contains("CreateTime")) {

            } else {
                if ((WIDGET_NAME == "TRADE BLOTTER") || (WIDGET_NAME == "AUTOX RESPONSES")) {
                    columnHeader = driver.findElement(By.xpath("//*[text()= \'" + columnName[i] + "\']"));
                } else {
                    columnHeader = driver.findElement(By.xpath("//*[contains(text(), \'" + columnName[i] + "\')]"));
                }

                executeJSClick(driver, columnHeader);
                Thread.sleep(1000);
                WebElement columnHeaderAgain = driver.findElement(By.xpath("//*[text()= \'" + columnName[i] + "\']"));
                executeJSClick(driver, columnHeaderAgain);
                try {
                    gridItem = objGrid.findElement(By.xpath("//div[@role='row' and @row-index='0']//descendant::div[contains(@col-id, \'" + columnName[i] + "\')]"));
                    if (gridItem == null) {
                    } else {
                        String gridText = gridItem.getText();
                        System.out.println("The cellValue we double click on \'" + columnName[i] + "\' " + "column  ->> " + gridText);
                        Thread.sleep(1000);
                        // bTC = logger.fngRaiseErrorLog("double click value -> " + gridText);
                        Actions action = new Actions(driver);
                        action.doubleClick(gridItem).perform();
                        Thread.sleep(2000);
                        List<WebElement> row = objGrid.findElements(By.xpath("//div[contains(@ref,'eBodyContainer')]//following::div[contains(@class, 'ag-row ag-row-no-focus') and @role='row']"));
                        int rowSize = row.size();
                        System.out.println("No. of rows after filtering \'" + columnName[i] + "\' " + "column is ->> " + rowSize);

                        String traderText = null;
                        if (rowSize >= 0) {
                            try {
                                for (int j = 0; j <= rowSize; j++) {
                                    WebElement objGridText = objGrid.findElement(By.xpath(".//div[@role='row' and @row-index=\'" + j + "\']//descendant::div[@col-id=\'" + columnName[i] + "\']"));
                                    String objGridTextValue = objGridText.getText();
                                    System.out.println("The data present in the \'" + columnName[i] + "\' " + "column is -->>" + objGridTextValue);
                                }
                            } catch (Exception NoSuchElementException) {
                            }
                        }

// if (i > 2) {
// if (WIDGET_NAME == "TRADE BLOTTER") {
//
// traderText = (String) executor.executeScript("return document.getElementsByClassName('ag-floating-filter-input')[" + (i - 1) + "].value", traderText);
// }
// }
// if (i > 16) {
// if (WIDGET_NAME == "DAILY TRADES") {
// if (columnName[i] == "Cover") {
// traderText = (String) executor.executeScript("return document.getElementsByClassName('ag-floating-filter-input')[" + (i - 1) + "].value", traderText);
// } else {
// traderText = (String) executor.executeScript("return document.getElementsByClassName('ag-floating-filter-input')[" + (i - 2) + "].value", traderText);
// }
// } else {
// if (i > 2) {
// if (WIDGET_NAME == "DAILY TRACE") {
// traderText = (String) executor.executeScript("return document.getElementsByClassName('ag-floating-filter-input')[" + (i - 1) + "].value", traderText);
// } else {
// }
// }

                        if ((WIDGET_NAME == "AUTOX CONTROL LIMITS") || (WIDGET_NAME == "BOND OPTION REPO RATE") || (WIDGET_NAME == "DAILY XTRAKTER") || (WIDGET_NAME == "MARKIT CDS") || (WIDGET_NAME == "DAILY TRACE") || (WIDGET_NAME == "TRADE BLOTTER") || (WIDGET_NAME == "VOICE INQUIRY BLOTTER")) {
                            Thread.sleep(1000);
                            traderText = (String) executor.executeScript("return document.getElementsByClassName('ag-floating-filter-input')[" + i + "].value", traderText);
                        }
                    else
                        {
                            traderText = (String) executor.executeScript("return document.getElementsByClassName('ag-floating-filter-input')[" + (i - 1) + "].value", traderText);
                        }


                        System.out.println("Value present after double click/filtering \'" + columnName[i] + "\' " + "column  ->> " + traderText);
                        Thread.sleep(1000);
                        action.doubleClick(gridItem).build().perform();

                    }
                } catch (Exception WebDriverException) {
                    System.out.println("Value not readable at \'" + columnName[i] + "\' " + "column ");
                }
            }
        }
    }


    public void CheckSettings(WebDriver driver, String WIDGET_NAME, String OPTION, String Value) throws
    InterruptedException {
        WebElement widgetSettingsTab = driver.findElement(By.xpath("//div[text()='" + WIDGET_NAME + "\']/following-sibling::*[contains(@class,'jss')]"));
        executeJSClick(driver, widgetSettingsTab);
        WebElement buttonTab = driver.findElement(By.xpath("//div[contains(text(),'" + OPTION + "\']//following-sibling::*[contains(@class, 'jss')]"));
        executeJSClick(driver, buttonTab);
        WebElement searchOption = driver.findElement(By.xpath("//*[contains(text(),'" + Value + "\']"));
        if (searchOption.isDisplayed()) {
            System.out.println("search button is displayed");
        }
        Thread.sleep(2000);
    }

    public boolean CheckTabSelectionStatus(WebDriver driver, String WIDGET_NAME, String TabName, String Attribute,
    boolean bTC) throws
    InterruptedException, IOException {
        driver.findElement(By.xpath("//button[contains(.,\'" + TabName + "\')]")).click();
        Thread.sleep(1000);
        String testAttribute = driver.findElement(By.xpath("//button[contains(.,\'" + TabName + "\')]")).getAttribute(Attribute);
        if (testAttribute.equals("true")) {
            System.out.println(TabName + " is selected");
            bTC = logger.fngRaisePassLog(TabName + " is selected", bTC);
        } else {
            System.out.println(TabName + " is not selected");
            bTC = logger.fngRaiseErrorLog(TabName + " is not selected", driver, false);
        }

        return bTC;
    }


    public boolean CheckMarketDetails(WebDriver driver, String WIDGET_NAME, String TAB_NAME, boolean bTC) throws
    InterruptedException, IOException {
        //BUY
        Float fNotional;
        int NonZeroFlag = 0;
        if (driver.findElement(By.xpath("//div[contains(text(),'INTEREST')]/following-sibling::*[not(contains(text(),'-'))]")).isDisplayed()) {
            System.out.println("BUY - INTEREST Section is available");
            String strMarketVal = driver.findElement(By.xpath("//div[contains(text(),'INTEREST')]/following-sibling::*[not(contains(text(),'-'))]")).getText();
            System.out.println(strMarketVal);
            String lastChar = strMarketVal.substring(strMarketVal.length() - 1);
            String[] arrNotionalValues = strMarketVal.split(lastChar, 0);
            fNotional = Float.parseFloat(arrNotionalValues[0]);
            if (fNotional > 0) {
                NonZeroFlag = NonZeroFlag + 1;
            }

        } else {
            System.out.println("BUY - INTEREST Section is not available");
        }

        if (driver.findElement(By.xpath("//div[contains(text(),'AWAY')]/following-sibling::*[not(contains(text(),'-'))]")).isDisplayed()) {
            System.out.println("BUY - AWAY Section is available");
            String strMarketVal = driver.findElement(By.xpath("//div[contains(text(),'AWAY')]/following-sibling::*[not(contains(text(),'-'))]")).getText();
            System.out.println(strMarketVal);
            String lastChar = strMarketVal.substring(strMarketVal.length() - 1);
            String[] arrNotionalValues = strMarketVal.split(lastChar, 0);
            fNotional = Float.parseFloat(arrNotionalValues[0]);
            if (fNotional > 0) {
                NonZeroFlag = NonZeroFlag + 1;
            }
        } else {
            System.out.println("BUY - AWAY Section is not available");
        }
        if (driver.findElement(By.xpath("//div[contains(text(),'TRADED')]/following-sibling::*[not(contains(text(),'-'))]")).isDisplayed()) {
            System.out.println("BUY - TRADED Section is available");
            String strMarketVal = driver.findElement(By.xpath("//div[contains(text(),'TRADED')]/following-sibling::*[not(contains(text(),'-'))]")).getText();
            System.out.println(strMarketVal);
            String lastChar = strMarketVal.substring(strMarketVal.length() - 1);
            String[] arrNotionalValues = strMarketVal.split(lastChar, 0);
            fNotional = Float.parseFloat(arrNotionalValues[0]);
            if (fNotional > 0) {
                NonZeroFlag = NonZeroFlag + 1;
            }
        } else {
            System.out.println("BUY - TRADED Section is not available");
        }
        //SELL
        if (driver.findElement(By.xpath("//div[contains(text(),'INTEREST')]/following-sibling::*[contains(text(),'-')]")).isDisplayed()) {
            System.out.println("SELL - INTEREST Section is available");
            String strMarketVal = driver.findElement(By.xpath("//div[contains(text(),'INTEREST')]/following-sibling::*[contains(text(),'-')]")).getText().trim();
            System.out.println(strMarketVal);
            String lastChar = strMarketVal.substring(strMarketVal.length() - 1);
            String firstChar = strMarketVal.substring(0, 1);
            String[] arrNotionalValues = strMarketVal.split(lastChar, 0);
            String[] arrNotionalValuesSell = arrNotionalValues[0].split(firstChar, 0);
            fNotional = Float.parseFloat(arrNotionalValuesSell[1].trim());
            if (fNotional > 0) {
                NonZeroFlag = NonZeroFlag + 1;
            }
        } else {
            System.out.println("SELL - INTEREST Section is not available");
        }

        if (driver.findElement(By.xpath("//div[contains(text(),'AWAY')]/following-sibling::*[contains(text(),'-')]")).isDisplayed()) {
            System.out.println("SELL - AWAY Section is available");
            String strMarketVal = driver.findElement(By.xpath("//div[contains(text(),'AWAY')]/following-sibling::*[contains(text(),'-')]")).getText();
            System.out.println(strMarketVal);
            String lastChar = strMarketVal.substring(strMarketVal.length() - 1);
            String firstChar = strMarketVal.substring(0, 1);
            String[] arrNotionalValues = strMarketVal.split(lastChar, 0);
            String[] arrNotionalValuesSell = arrNotionalValues[0].split(firstChar, 0);
            fNotional = Float.parseFloat(arrNotionalValuesSell[1].trim());
            if (fNotional > 0) {
                NonZeroFlag = NonZeroFlag + 1;
            }
        } else {
            System.out.println("SELL - AWAY Section is not available");
        }

        if (driver.findElement(By.xpath("//div[contains(text(),'TRADED')]/following-sibling::*[contains(text(),'-')]")).isDisplayed()) {
            System.out.println("SELL - TRADED Section is available");
            String strMarketVal = driver.findElement(By.xpath("//div[contains(text(),'TRADED')]/following-sibling::*[contains(text(),'-')]")).getText();
            System.out.println(strMarketVal);
            String lastChar = strMarketVal.substring(strMarketVal.length() - 1);
            String firstChar = strMarketVal.substring(0, 1);
            String[] arrNotionalValues = strMarketVal.split(lastChar, 0);
            String[] arrNotionalValuesSell = arrNotionalValues[0].split(firstChar, 0);
            fNotional = Float.parseFloat(arrNotionalValuesSell[1].trim());
            if (fNotional > 0) {
                NonZeroFlag = NonZeroFlag + 1;
            }
        } else {
            System.out.println("SELL - TRADED Section is not available");
        }

        if (NonZeroFlag > 0) {
            System.out.println(TAB_NAME + " TAB - PASSED : Notional is NON-ZERO in this Tab");
            bTC = logger.fngRaisePassLog(TAB_NAME + " - PASSED : Notional is NON-ZERO in this Tab", bTC);
        } else {
            System.out.println(TAB_NAME + " TAB - FAIL : Notional is ZERO in this Tab");
            bTC = logger.fngRaiseErrorLog(TAB_NAME + " - FAIL : Notional is ZERO in this Tab", driver, false);
        }

        return bTC;
    }


    //For context search in React SD strSearch = {BOND, CLIENT, DEAL}; strBCD= {String value to be searched}
    public void contextSearch(WebDriver driver, String strSearch, String strBCD) throws InterruptedException {
        WebElement txtBond = driver.findElement(By.xpath("//*[text()=\'" + strSearch + "\']"));
        executeJavascript(driver, "arguments[0].style.height = '1000px'", txtBond);
        executeJavascript(driver, "arguments[0].style.width = '2200px'", txtBond);
        WebElement txtBondSearch = null;
        switch (strSearch) {
            case "BOND":
                txtBondSearch = driver.findElement(By.xpath("//input[@placeholder='Search Bond...']"));

            case "DEAL":
                txtBondSearch = driver.findElement(By.xpath("//input[@placeholder='Search Deal...']"));


            case "CLIENT":
                txtBondSearch = driver.findElement(By.xpath("//input[@placeholder='Search Client...']"));
        }
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
        txtBondSearch.sendKeys(strBCD);
        WebDriverWait wait = new WebDriverWait(driver, 60);
        wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(".//strong[contains(.,\'" + strBCD + "\')]")));
        WebElement temp = driver.findElement(By.xpath(".//strong[contains(.,\'" + strBCD + "\')]"));
        executeJSClick(driver, temp);
        //Actions action = new Actions(driver);
        //action.sendKeys(Keys.PAGE_DOWN).build().perform();
        //Thread.sleep(2000);
        //action.sendKeys(Keys.ENTER).build().perform();
    }


    //For checking in settings of widget if checkboxes are selected
    public void checkboxSelected(WebDriver driver, String WIDGET_NAME) throws InterruptedException {
        WebElement settingsgrid = driver.findElement(By.xpath("//div[text()=\'" + WIDGET_NAME + "\']/following-sibling::*[contains(@class,'jss')]"));
        executeJSClick(driver, settingsgrid);
        List<WebElement> numOfCheckboxes = driver.findElements(By.xpath("//input[@type='checkbox']"));

        {
            for (int i = 0; i < numOfCheckboxes.size(); i++) {
                System.out.println(numOfCheckboxes.get(i).getText());
                numOfCheckboxes.get(i).isSelected();
            }
            System.out.println("checkboxes are selected");

            try {
                Thread.sleep(2000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

        }

    }

    /**
     * Executes JavaScript in the context of the currently selected window
     *
     * @param driver  instance of WebDriver
     * @param element WebElement to perform operations on
     * @return
     */
    private static Object executeJSClick(WebDriver driver, WebElement element) {
        String script = "arguments[0].click()";
        return (executeJavascript(driver, script, element));
    }

    /**
     * Executes JavaScript in the context of the currently selected window
     *
     * @param driver  instance of WebDriver
     * @param script  javascript to run
     * @param element WebElement to perform operations on
     * @return
     */
    private static Object executeJavascript(WebDriver driver, String script, WebElement element) {
        System.out.println("Executing javascript: " + script);
        return ((JavascriptExecutor) driver).executeScript(script, element);
    }

    /**
     * Execute an asynchronous piece of JavaScript in the context of the currently selected frame or
     * window.
     *
     * @param driver  instance of WebDriver
     * @param script  javascript to run
     * @param element WebElement to perform operations on
     * @return result of execution
     */
    private static Object executeAsyncJavascript(WebDriver driver, String script, WebElement element) {
        System.out.println("Executing Async javascript: " + script);
        return ((JavascriptExecutor) driver).executeAsyncScript(script, element);
    }

    //For searching widgets under categories and sub-categories
}

`

@weiteho
Copy link
Contributor

weiteho commented Nov 22, 2019

@elusive666 I'm trying to figure out which part doesn't work. For the code below, does it work with executeJSClick but not with WebElement.click()?

//objFilterRemove.click();
executeJSClick(driver, objFilterRemove);

@elusive666
Copy link
Author

Yes that is correct an also when I try to resize the widget with the following;

//Actions class method to drag and drop
Actions builder = new Actions(driver);
builder.dragAndDropBy(from, xOffset,yOffset).perform();

Also is my BaseTest.java correct for starting the driver and openFin Application???

@elusive666
Copy link
Author

elusive666 commented Nov 23, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants