// Get data content
public static void SyncMonitorDataValidation(WebDriver driver, String emplid, String contenttype, String content, TestParameters testParameters, String direction)
	throws InterruptedException {
	driver.get(testParameters.mURLMyInsead+testParameters.msyncMonitor);
	Assert.assertEquals(driver.getTitle(), "MyINSEAD - Sync Monitor");
	int lastindex = -1;
	boolean emplidfound = false;
	boolean dataprocessed = false;
	for (int i = 1; i <= 25; i++) {
		System.out.println("\nIteration no.: " + i);
		WebElement key = driver.findElement(By.xpath("(//tbody/tr[" + i + "]/td)[5]"));
		String keydata = key.getText();
		System.out.println(keydata);
		boolean result = keydata.contains("Key: " + emplid);
		String actualDirection = driver.findElement(By.xpath("//*[@id='tblResult']/tbody/tr["+i+"]/td[3]")).getText().trim();
		Thread.sleep(5000);
		if (result == true && actualDirection.equals(direction)) { // Validate if emplid is in the key
			emplidfound = true;
			String status = driver.findElement(By.xpath("(//tbody/tr[" + i + "]/td)[2]")).getText();
			System.out.println(status);
			boolean statusresult = status.equals("PROCESSED");
			String dataID = driver.findElement(By.xpath("(//tbody/tr["+i+"]/td)[1]")).getText();//TODO get the data id
			System.out.println(dataID);
			//Validation if Data is processed
		if (statusresult == true) {// Validate if processed
			System.out.println("Data PROCESSED");
			dataprocessed = true;
			lastindex = i;
			break;
		} else {
			System.out.println("Data Not Yet Processed");
			int count = 20;
			String dataIDafterrefresh = driver.findElement(By.xpath("(//tbody/tr["+i+"]/td)[1]")).getText();//TODO to remove
			boolean correctdataid = dataID.equals(dataIDafterrefresh);//TODO to remove
			System.out.println(correctdataid);//TODO to remove
			while (count != 0 && statusresult == false) {// Loop for
			// processed
				if(correctdataid==true){
			System.out.println("Status check: " + status);
			System.out.println(count);
			driver.navigate().refresh();
			Thread.sleep(15000);
			status = driver.findElement(By.xpath("(//tbody/tr[" + i + "]/td)[2]")).getText();
			statusresult = status.equals("PROCESSED");
			count--;
			}else
			{
				//TODO GO BACK TO CHECK EMPLID
			}
			}		
		if(statusresult==true)
		{
			lastindex = i;
			dataprocessed = true;
			break;
		}
		}
		break;
		} else {
		System.out.println("Checking next data");
		}
	}
		if(!emplidfound)
		{
			System.out.println("No data in Sync Monitor");
			Assert.assertTrue(emplidfound);
		}
		if(dataprocessed)
		{
			Thread.sleep(3000);
			WebElement button = driver.findElement(By.xpath("(//tbody/tr[" + lastindex + "]/td)[1]/button"));
			// Get data content
			String dataBlock = button.getAttribute("data-content").replaceAll("\\s+", "");
			// Validate that content was correct
			boolean contenttypefound = dataBlock.contains(contenttype);
			boolean contentfound = dataBlock.contains(content);
			Assert.assertEquals(true, contenttypefound);
			Assert.assertEquals(true, contentfound);
		}else{
			System.out.println("Data was not processed in sync monitor");
			Assert.assertTrue(dataprocessed);
		}
		}
Thread.sleep(3000);
WebElement button = driver.findElement(By.xpath("(//tbody/tr[" + lastindex + "]/td)[1]/button"));
// Get data content
String dataBlock = button.getAttribute("data-content").replaceAll("\\s+", "");
// Validate that content was correct
}
if(!emplidfound)
{
System.out.println("No data in Sync Monitor");
Assert.assertTrue(emplidfound);
}
if(dataprocessed)
{
Thread.sleep(3000);
WebElement button = driver.findElement(By.xpath("(//tbody/tr[" + lastindex + "]/td)[1]/button"));
// Get data content
String dataBlock = button.getAttribute("data-content").replaceAll("\\s+", "");
// Validate that content was correct
boolean contenttypefound = dataBlock.contains(contenttype);
boolean contentfound = dataBlock.contains(content);
Assert.assertEquals(true, contenttypefound);
Assert.assertEquals(true, contentfound);
}else{
System.out.println("Data was not processed in sync monitor");
Assert.assertTrue(dataprocessed);
}
{
lastindex = i;
dataprocessed = true;
break;
}
}
break;
} else {
System.out.println("Checking next data");
}
}
if(!emplidfound)
{
System.out.println("No data in Sync Monitor");
Assert.assertTrue(emplidfound);
}
if(dataprocessed)
{
Thread.sleep(3000);
WebElement button = driver.findElement(By.xpath("(//tbody/tr[" + lastindex + "]/td)[1]/button"));
// Get data content
String dataBlock = button.getAttribute("data-content").replaceAll("\\s+", "");
// Validate that content was correct
boolean contenttypefound = dataBlock.contains(contenttype);
boolean contentfound = dataBlock.contains(content);
Assert.assertEquals(true, contenttypefound);
Assert.assertEquals(true, contentfound);
}else{
System.out.println("Data was not processed in sync monitor");
Assert.assertTrue(dataprocessed);
}
}