List of usage examples for org.openqa.selenium By tagName
public static By tagName(String tagName)
From source file:com.mroza.seleniumTests.EditProgramViewTests.EditProgramViewPage.java
License:Open Source License
public void clickDeleteRow(String tableName, String rowsName) { WebElement tableRow = getRowForTable(tableName, rowsName, true); List<WebElement> tableRowColumns = tableRow.findElements(By.tagName("td")); tableRowColumns.get(3).findElement(By.tagName("button")).click(); SeleniumWaiter.waitForJQueryAndPrimeFaces(driver); }
From source file:com.mroza.seleniumTests.EditProgramViewTests.EditProgramViewPage.java
License:Open Source License
public List<String> getTableRowsNamesForTable(String newTableName, Boolean isEditing) { WebElement table = getTableWithHeader(newTableName, isEditing); WebElement tableContent = table.findElement(By.className("ui-datatable-tablewrapper")); WebElement tableContentRowsArea = tableContent.findElement(By.tagName("tbody")); List<WebElement> tableRows = tableContentRowsArea.findElements(By.tagName("tr")); List<String> tableRowNames = new ArrayList<>(); for (WebElement tableRow : tableRows) { List<WebElement> tableRowColumns = tableRow.findElements(By.tagName("td")); if (isEditing) { tableRowNames.add(tableRowColumns.get(0).findElement(By.tagName("input")).getAttribute("value")); } else {/*from w w w. j av a 2 s . c o m*/ tableRowNames.add(tableRowColumns.get(0).getText()); } } return tableRowNames; }
From source file:com.mroza.seleniumTests.EditProgramViewTests.EditProgramViewPage.java
License:Open Source License
private WebElement getTableWithHeader(String header, Boolean isEditing) { List<WebElement> tablesList = getTablesList(); for (WebElement table : tablesList) { WebElement tableHeader = table.findElement(By.className("ui-datatable-header")); if (isEditing) { WebElement tableHeaderInput = tableHeader.findElement(By.tagName("input")); if (tableHeaderInput.getAttribute("value").equals(header)) return table; } else if (tableHeader.getText().equals(header)) return table; }//from www. j av a 2 s . co m return null; }
From source file:com.mroza.seleniumTests.EditProgramViewTests.EditProgramViewPage.java
License:Open Source License
private void setUpHeaderParameter(WebElement tableContentHeaderColumnsElement, int number) { tableContentHeaderColumnsElement.findElement(By.tagName("input")).sendKeys(String.valueOf(number)); }
From source file:com.mroza.seleniumTests.EditProgramViewTests.EditProgramViewPage.java
License:Open Source License
private WebElement getRowForTable(String tableName, String rowName, Boolean isEditing) { WebElement table = getTableWithHeader(tableName, isEditing); WebElement tableContent = table.findElement(By.className("ui-datatable-tablewrapper")); WebElement tableContentRowsArea = tableContent.findElement(By.tagName("tbody")); List<WebElement> tableRows = tableContentRowsArea.findElements(By.tagName("tr")); for (WebElement tableRow : tableRows) { List<WebElement> tableRowColumns = tableRow.findElements(By.tagName("td")); if (isEditing) { if (tableRowColumns.get(0).findElement(By.tagName("input")).getAttribute("value").equals(rowName)) { return tableRow; }//from www . j a va2s. c o m } else { if (tableRowColumns.get(0).getText().equals(rowName)) { return tableRow; } } } return null; }
From source file:com.mroza.seleniumTests.KidProgramsViewTests.KidProgramsForPeriodViewPage.java
License:Open Source License
public void turnToProgramsForPeriodPagePart() { WebElement navigationArea = driver.findElement(By.className("ui-tabs-nav")); List<WebElement> navigationButtons = navigationArea.findElements(By.tagName("li")); for (WebElement navigationButton : navigationButtons) { if (navigationButton.findElement(By.tagName("a")).getText() .equals(Utils.getMsgFromResources("kidProgramsView.programsForPeriod"))) { navigationButton.click();//from ww w . j av a 2 s .c o m break; } } SeleniumWaiter.waitForJQueryAndPrimeFaces(driver); }
From source file:com.mroza.seleniumTests.KidProgramsViewTests.KidProgramsForPeriodViewPage.java
License:Open Source License
private WebElement getPeriodDateInput(int index) { List<WebElement> spans = getActualChosenPeriodDisplayAreaSpans(); WebElement span = spans.get(index);/*from w ww . j a v a 2s . c o m*/ return span.findElement(By.tagName("input")); }
From source file:com.mroza.seleniumTests.KidProgramsViewTests.KidProgramsForPeriodViewPage.java
License:Open Source License
public List<String> getAssignedProgramsToActualPeriod() { List<WebElement> tableRows = getAssignedProgramTableRows(); List<String> assignedProgramsSymbols = new ArrayList<>(); for (WebElement tableRow : tableRows) { List<WebElement> tableColumns = tableRow.findElements(By.tagName("td")); assignedProgramsSymbols.add(tableColumns.get(0).getText()); }//from www . j a va 2s .co m return assignedProgramsSymbols; }
From source file:com.mroza.seleniumTests.KidProgramsViewTests.KidProgramsForPeriodViewPage.java
License:Open Source License
private List<WebElement> getActualChosenPeriodDisplayAreaSpans() { WebElement form = getProgramsForPeriodFormContainer(); WebElement outputPanel = form.findElement(By.className("ui-outputpanel")); return outputPanel.findElements(By.tagName("span")); }
From source file:com.mroza.seleniumTests.KidProgramsViewTests.KidProgramsForPeriodViewPage.java
License:Open Source License
public void chooseProgram(String symbol) { WebElement dialog = getVisibleDialogBox(); WebElement dialogContent = dialog.findElement(By.className("ui-dialog-content")); WebElement dialogForm = dialogContent.findElement(By.tagName("form")); WebElement tableWrapper = dialogForm.findElement(By.className("ui-datatable")) .findElement(By.className("ui-datatable-tablewrapper")); WebElement table = tableWrapper.findElement(By.tagName("table")); WebElement tableBody = table.findElement(By.tagName("tbody")); List<WebElement> tableRows = tableBody.findElements(By.tagName("tr")); for (WebElement tableRow : tableRows) { List<WebElement> tableColumns = tableRow.findElements(By.tagName("td")); if (tableColumns.get(0).getText().equals(symbol)) { tableColumns.get(2).findElement(By.tagName("button")).click(); SeleniumWaiter.waitForJQueryAndPrimeFaces(driver); break; }/* www. j a va 2 s. c o m*/ } }