List of usage examples for org.openqa.selenium By tagName
public static By tagName(String tagName)
From source file:com.mroza.seleniumTests.KidProgramsViewTests.KidProgramsForPeriodViewPage.java
License:Open Source License
public void chooseTable(String name) { 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(name)) { tableColumns.get(1).findElement(By.tagName("button")).click(); SeleniumWaiter.waitForJQueryAndPrimeFaces(driver); break; }/*from ww w.ja v a 2 s. c o m*/ } }
From source file:com.mroza.seleniumTests.KidProgramsViewTests.KidProgramsForPeriodViewPage.java
License:Open Source License
private List<WebElement> getAssignedProgramTableRows() { WebElement tableBody = driver// w w w. ja v a2 s .c o m .findElement(By.id("kid-programs-tab-view:periodProgramsForm:programsPerPeriodTab_data")); return tableBody.findElements(By.tagName("tr")); }
From source file:com.mroza.seleniumTests.KidProgramsViewTests.KidProgramsForPeriodViewPage.java
License:Open Source License
private WebElement getProgramsForPeriodFormContainer() { WebElement mainBody = driver.findElement(By.className("b-main-content")); WebElement tabs = mainBody.findElement(By.className("ui-tabs")); WebElement tabsPanel = tabs.findElement(By.className("ui-tabs-panels")); List<WebElement> panels = tabsPanel.findElements(By.className("ui-tabs-panel")); return panels.get(1).findElement(By.tagName("form")); }
From source file:com.mroza.seleniumTests.KidProgramsViewTests.KidProgramsForPeriodViewPage.java
License:Open Source License
public void changeActualPeriodStartDate(Date date) { WebElement input = getPeriodDateInput(1); input.click();//from w ww. ja v a 2 s .c o m SeleniumWaiter.waitForJQueryAndPrimeFaces(driver); setDatePickerForProperMonth(date); int dayOfMonth = getPartOfDate(date, Calendar.DAY_OF_MONTH); WebElement datePicker = driver.findElement(By.className("ui-datepicker-calendar")); List<WebElement> calendarFields = datePicker.findElements(By.tagName("td")); for (WebElement calendarField : calendarFields) { List<WebElement> calendarFieldValues = calendarField.findElements(By.tagName("a")); if (calendarFieldValues.size() > 0) { String chosenDay = calendarFieldValues.get(0).getText(); if (chosenDay.equals(String.valueOf(dayOfMonth))) { calendarField.click(); break; } } } SeleniumWaiter.waitForJQueryAndPrimeFaces(driver); }
From source file:com.mroza.seleniumTests.KidProgramsViewTests.KidProgramsForPeriodViewPage.java
License:Open Source License
public void deleteAssignedPrograms() { List<WebElement> tableRows = getAssignedProgramTableRows(); for (WebElement tableRow : tableRows) { List<WebElement> columns = tableRow.findElements(By.tagName("td")); WebElement buttonsColumn = columns.get(3); List<WebElement> buttons = buttonsColumn.findElements(By.tagName("a")); buttons.get(1).click();// w ww .j a va 2 s . c o m SeleniumWaiter.waitForJQueryAndPrimeFaces(driver); clickYesButtonInDialogBox(); SeleniumWaiter.waitForJQueryAndPrimeFaces(driver); } }
From source file:com.mroza.seleniumTests.KidProgramsViewTests.KidProgramsViewPage.java
License:Open Source License
private List<WebElement> getProgramElementsList(WebElement dataTable) { WebElement dataTableContent = dataTable.findElement(By.className("ui-datatable-tablewrapper")); WebElement dataTableContentList = dataTableContent.findElement(By.className("ui-datatable-data")); return dataTableContentList.findElements(By.tagName("tr")); }
From source file:com.mroza.seleniumTests.KidProgramsViewTests.KidProgramsViewPage.java
License:Open Source License
private List<String> getColumnValues(int columnNumber) { WebElement dataTable = getDataTableElement(); List<WebElement> programElements = getProgramElementsList(dataTable); List<String> programSymbolElementsList = new ArrayList<>(); for (WebElement programElement : programElements) { List<WebElement> programElementColumn = programElement.findElements(By.tagName("td")); programSymbolElementsList.add(programElementColumn.get(columnNumber).getText()); }//ww w .j a v a 2 s . co m return programSymbolElementsList; }
From source file:com.mroza.seleniumTests.KidProgramsViewTests.KidProgramsViewPage.java
License:Open Source License
public void clickDeleteButton(String expectedSymbol) { WebElement dataTable = getDataTableElement(); List<WebElement> programElements = getProgramElementsList(dataTable); for (WebElement programElement : programElements) { List<WebElement> programElementColumn = programElement.findElements(By.tagName("td")); if (programElementColumn.get(0).getText().equals(expectedSymbol)) { WebElement button = programElementColumn.get(4).findElement(By.tagName("button")); button.click();/*w w w.ja v a 2 s.c o m*/ SeleniumWaiter.waitForJQueryAndPrimeFaces(driver); break; } } }
From source file:com.mroza.seleniumTests.KidsViewTests.KidsViewPage.java
License:Open Source License
public List<String> getKidsSymbolsList() { WebElement tableContent = driver.findElement(By.className("ui-datatable-tablewrapper")); WebElement tableBody = tableContent.findElement(By.tagName("tbody")); List<WebElement> tableRows = tableBody.findElements(By.tagName("tr")); List<String> kidsSymbolsList = new ArrayList<>(); for (WebElement tableRow : tableRows) { WebElement symbolElement = tableRow.findElement(By.tagName("td")); String kidSymbol = symbolElement.getText(); kidsSymbolsList.add(kidSymbol);/*from w w w . j a va2 s . c om*/ } return kidsSymbolsList; }
From source file:com.mroza.seleniumTests.KidsViewTests.KidsViewPage.java
License:Open Source License
public void setSearchValue(String expectedSearchedSymbol) { WebElement searchboxArea = driver.findElement(By.className("ui-datatable-header")); WebElement searchBoxInput = searchboxArea.findElement(By.tagName("input")); searchBoxInput.sendKeys(expectedSearchedSymbol); SeleniumWaiter.waitForJQueryAndPrimeFaces(driver); }