This below code will surely help you.. Try this
public void click(WebDriver driver) throws InterruptedException { WebDriverWait wait = new WebDriverWait(driver, 30); try { Thread.sleep(3000); WebElement table = driver.findElement(By.className("ng-star-inserted")); List allrows = table.findElements(By.tagName("tr")); // List allcols = table.findElements(By.tagName("td")); Thread.sleep(2000); for(WebElement row: allrows) { List Cells = row.findElements(By.tagName("td")); for(WebElement Cell:Cells) { if (Cell.getText().contains("COASTAL")) Cell.click(); } } Thread.sleep(2000); System.out.println("Welcome"); Thread.sleep(10000); wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("call-caseDetail"))).click(); System.out.println("first row is clicked"); createDirector(wait, driver); updateDirector(wait, driver); deleteDirector(driver); } catch (Exception e) { System.out.println("Timeout " + e); }Try this
public void click(WebDriver driver) throws InterruptedException {
WebDriverWait wait = new WebDriverWait(driver, 30);
try {
Thread.sleep(3000);
WebElement table = driver.findElement(By.className("ng-star-inserted"));
List<WebElement> allrows = table.findElements(By.tagName("tr"));
// List<WebElement> allcols = table.findElements(By.tagName("td"));
Thread.sleep(2000);
for(WebElement row: allrows) {
List<WebElement> Cells = row.findElements(By.tagName("td"));
for(WebElement Cell:Cells) {
if (Cell.getText().contains("COASTAL"))
Cell.click();
}
}
Thread.sleep(2000);
System.out.println("Welcome");
Thread.sleep(10000);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("call-caseDetail"))).click();
System.out.println("first row is clicked");
createDirector(wait, driver);
updateDirector(wait, driver);
deleteDirector(driver);
}
catch (Exception e) {
System.out.println("Timeout " + e);
}