/** Enables the tab with the given tab number. */ public void clickTab(int tabNumber) { WebElement tab = driver.findElement( By.xpath( "//div[contains(@class, 'v-tabsheet-tabcontainer')]/table/tbody/tr/td[" + tabNumber + "]/div/div")); tab.click(); WaitConditions.waitForVaadin(driver); }
/** Clicks the button located at the given table at the given row and column. */ public void clickTableButton(String tableName, int row, int col) { String xpath = "//div[@id='" + tableName + "']//div[contains(@class, 'v-table-body')]//tr[" + row + "]/td[" + col + "]//div[contains(@class, 'v-button')]"; WebElement button = driver.findElement(By.xpath(xpath)); button.click(); WaitConditions.waitForVaadin(driver); }
/** * Clicks the button located at the given table at the given row and column. It additionally * expects it to be secured with a ConfirmDiaĺog * (https://vaadin.com/directory#addon/confirmdialog). */ public void clickTableButtonWithConfirmation(String tableName, int row, int col) { clickTableButton(tableName, row, col); ConfirmDialogPO popUpWindowPO = new ConfirmDialogPO(driver); popUpWindowPO.clickOKButton(); FluentWait<WebDriver> wait = new WebDriverWait(driver, WaitConditions.LONG_WAIT_SEC, WaitConditions.SHORT_SLEEP_MS) .ignoring(StaleElementReferenceException.class); wait.until( new ExpectedCondition<Boolean>() { @Override public Boolean apply(WebDriver driver) { List<WebElement> findElements = driver.findElements(By.xpath("//div[contains(@class, 'v-window ')]")); return findElements.size() == 0; } }); WaitConditions.waitForShortTime(); }
/** Clicks the button with the given buttonName as id. */ public void clickButton(String buttonName) { driver.findElement(By.id(buttonName)).click(); WaitConditions.waitForVaadin(driver); }