List of usage examples for org.openqa.selenium.support.ui ExpectedConditions presenceOfElementLocated
public static ExpectedCondition<WebElement> presenceOfElementLocated(final By locator)
From source file:org.mousephenotype.cda.selenium.support.PhenotypeTable.java
License:Apache License
/** * Pulls <code>numRows</code> rows of postQc data and column access variables from * the pheno page's 'phenotypes' HTML table. * * @param numRows the number of postQc phenotype table rows to return, including * the heading row. To specify all postQc rows, set <code>numRows</code> to null. * @return <code>numRows</code> rows of data and column access variables * from the pheno page's 'phenotypes' HTML table. *//* w w w . j a va2 s . c om*/ public GridMap load(Integer numRows) { if (numRows == null) numRows = computeTableRowCount(); String[][] dataArray; postQcList = new ArrayList(); preAndPostQcList = new ArrayList(); String value; // Wait for page. WebElement phenotypesTable = wait .until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("table#phenotypes"))); // Grab the headings. List<WebElement> headings = phenotypesTable.findElements(By.cssSelector("thead tr th")); numRows = Math.min(computeTableRowCount(), numRows); // Take the lesser of: actual row count in HTML table (including heading), or requested numRows. int numCols = headings.size(); dataArray = new String[numRows][numCols]; // Allocate space for the data. int sourceColIndex = 0; for (WebElement heading : headings) { // Copy the heading values. dataArray[0][sourceColIndex] = heading.getText(); sourceColIndex++; } postQcList.add(Arrays.asList(dataArray[0])); preAndPostQcList.add(Arrays.asList(dataArray[0])); // Loop through all of the tr objects for this page, gathering the data. int sourceRowIndex = 1; for (WebElement row : phenotypesTable.findElements(By.xpath("//table[@id='phenotypes']/tbody/tr"))) { List<WebElement> cells = row.findElements(By.cssSelector("td")); sourceColIndex = 0; boolean skipLink = false; boolean createMaleRow = false; for (WebElement cell : cells) { value = ""; if (sourceColIndex == COL_INDEX_PHENOTYPES_PAGE_GENE_ALLELE) { String rawAllele = cell.findElement(By.cssSelector("span.smallerAlleleFont")).getText(); List<WebElement> alleleElements = cell.findElements(By.cssSelector("sup")); if (alleleElements.isEmpty()) { value = rawAllele + " / " + rawAllele; // Some genes don't have allele markers. Save the gene symbol and use it for the allele symbol. } else { String sup = cell.findElement(By.cssSelector("sup")).getText(); AlleleParser ap = new AlleleParser(rawAllele, sup); value = ap.gene + " / " + ap.toString(); } } else if (sourceColIndex == COL_INDEX_PHENOTYPES_PAGE_SEX) { // Translate the male/female symbol into a string: 'male', 'female', 'both', or 'no_data'. List<WebElement> sex = cell.findElements(By.xpath(".//img[@alt='Male' or @alt='Female']")); if (sex.isEmpty()) { value = SexType.no_data.toString(); } else { if (sex.size() == 2) { List<WebElement> bothSexesElement = cell .findElements(By.xpath("./span[@class='bothSexes']")); if (bothSexesElement.isEmpty()) { value = SexType.female.toString(); createMaleRow = true; } else { value = SexType.both.toString(); } } else { value = sex.get(0).getAttribute("alt").toLowerCase(); } } } else if (sourceColIndex == COL_INDEX_PHENOTYPES_PAGE_PHENOTYPE) { value = cell.findElement(By.cssSelector("a")).getText(); // Get the phenotype text. } else if (sourceColIndex == COL_INDEX_PHENOTYPES_PAGE_GRAPH_LINK) { // Extract the graph url from the <a> anchor and decode it. List<WebElement> graphLinks = cell.findElements(By.cssSelector("a")); value = ""; if (!graphLinks.isEmpty()) { value = graphLinks.get(0).getAttribute("href"); } else { graphLinks = cell.findElements(By.cssSelector("i")); if (!graphLinks.isEmpty()) { value = graphLinks.get(0).getAttribute("oldtitle"); if (value.contains(TestUtils.NO_SUPPORTING_DATA)) { skipLink = true; } } } } else { value = cell.getText(); // SPECIAL RULES: For some reason, cell.getText() removes one space from the <td> element, thus causing a download file mismatch. if (value.startsWith("Immunophenotyping | RP Macrophage (CD19- CD11c-)")) { value = "Immunophenotyping | RP Macrophage (CD19- CD11c-)"; } } dataArray[sourceRowIndex][sourceColIndex] = value; sourceColIndex++; } String[] maleRow = null; if (createMaleRow) { maleRow = dataArray[sourceRowIndex].clone(); maleRow[COL_INDEX_PHENOTYPES_PAGE_SEX] = "male"; } if (!skipLink) { postQcList.add(Arrays.asList(dataArray[sourceRowIndex])); // Add the row to the postQc list. if (maleRow != null) { postQcList.add(Arrays.asList(maleRow)); } if (postQcList.size() >= numRows) { // Return when we have the number of requested rows. break; // Return when we have the number of requested rows. } } preAndPostQcList.add(Arrays.asList(dataArray[sourceRowIndex])); // Add the row to the preQc- and postQc-list. if (maleRow != null) { preAndPostQcList.add(Arrays.asList(maleRow)); } sourceRowIndex++; } postQcList = commonUtils.expandCompoundColumns(postQcList, expandColumnPipeList, "|"); postQcList = commonUtils.expandCompoundColumns(postQcList, expandColumnSlashList, "/"); preAndPostQcList = commonUtils.expandCompoundColumns(preAndPostQcList, expandColumnPipeList, "|"); preAndPostQcList = commonUtils.expandCompoundColumns(preAndPostQcList, expandColumnSlashList, "/"); data = new GridMap(postQcList, target); return data; }
From source file:org.mousephenotype.cda.selenium.support.SearchAnatomyTable.java
License:Apache License
/** * Pulls <code>numRows</code> rows of search page gene facet data and column access variables from the search page's * 'maGrid' HTML table.//from w ww . ja va2s. c om * * @param numRows the number of <code>GridMap</code> table rows to return, including the heading row. To specify all * rows, set <code>numRows</code> to null. * * @return <code>numRows</code> rows of search page gene facet data and column access variables from the search * page's 'diseaseGrid' HTML table. */ private GridMap load(Integer numRows) { if (numRows == null) numRows = computeTableRowCount(); String[][] pageArray; // Wait for page. wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("table#maGrid"))); int numCols = COL_INDEX_LAST + 1; pageArray = new String[numRows][numCols]; // Allocate space for the data. for (int i = 0; i < numCols; i++) { pageArray[0][i] = "Column_" + i; // Set the headings. } // Save the body values. List<WebElement> bodyRowElementsList = table.findElements(By.cssSelector("tbody tr")); if (!bodyRowElementsList.isEmpty()) { int sourceRowIndex = 1; pageArray[sourceRowIndex][COL_INDEX_ANATOMY_TERM] = ""; // Insure there is always a non-null value. pageArray[sourceRowIndex][COL_INDEX_ANATOMY_ID] = ""; // Insure there is always a non-null value. pageArray[sourceRowIndex][COL_INDEX_ANATOMY_ID_LINK] = ""; // Insure there is always a non-null value. pageArray[sourceRowIndex][COL_INDEX_ANATOMY_SYNONYMS] = ""; // Insure there is always a non-null value. for (WebElement bodyRowElements : bodyRowElementsList) { AnatomyRow anatomyRow = new AnatomyRow(); List<WebElement> bodyRowElementList = bodyRowElements.findElements(By.cssSelector("td")); WebElement anatomyColElement = bodyRowElementList.get(0); WebElement anatomyColAnchorElement = bodyRowElementList.get(0).findElement(By.cssSelector("a")); // In order to see the contents of the span, we need to first bring the anatomy term into view, then // hover over it. Actions builder = new Actions(driver); try { testUtils.scrollToTop(driver, anatomyColElement, -50); // Scroll anatomy term into view. Actions hoverOverTerm = builder.moveToElement(anatomyColElement); hoverOverTerm.perform(); anatomyRow.anatomyIdLink = anatomyColAnchorElement.getAttribute("href"); // anatomyIdLink int pos = anatomyRow.anatomyIdLink.lastIndexOf("/"); anatomyRow.anatomyTerm = anatomyColAnchorElement.getText(); // anatomyTerm anatomyRow.anatomyId = anatomyRow.anatomyIdLink.substring(pos + 1); // anatomyId List<WebElement> subinfoElement = bodyRowElementList.get(0) .findElements(By.cssSelector("div.subinfo")); if (!subinfoElement.isEmpty()) { String[] parts = subinfoElement.get(0).getText().split(":"); switch (parts[0].trim().toLowerCase()) { case "synonym": // This handles a single synonym only. Multiple synonyms pass through this path but parts[1] has a newline in that case. if ((parts.length > 1) && (!parts[1].contains("\n"))) { anatomyRow.synonyms.add(parts[1].trim()); // single synonym } default: break; } } List<WebElement> synonymElements = bodyRowElementList.get(0) .findElements(By.cssSelector("ul.synonym li")); // Look for multiple synonyms. for (WebElement synonymElement : synonymElements) { anatomyRow.synonyms.add(synonymElement.getText().trim()); } } catch (Exception e) { logger.error("EXCEPTION: SearchAnatomyTable.load() while waiting to hover. Error message: " + e.getLocalizedMessage()); e.printStackTrace(); } pageArray[sourceRowIndex][COL_INDEX_ANATOMY_TERM] = anatomyRow.anatomyTerm; pageArray[sourceRowIndex][COL_INDEX_ANATOMY_ID] = anatomyRow.anatomyId; pageArray[sourceRowIndex][COL_INDEX_ANATOMY_ID_LINK] = anatomyRow.anatomyIdLink; pageArray[sourceRowIndex][COL_INDEX_ANATOMY_SYNONYMS] = StringUtils.join(anatomyRow.synonyms, "|"); sourceRowIndex++; bodyRows.add(anatomyRow); } } return new GridMap(pageArray, target); }
From source file:org.mousephenotype.cda.selenium.support.SearchDiseaseTable.java
License:Apache License
/** * Pulls <code>numRows</code> rows of search page gene facet data and column access variables from the search page's * 'diseaseGrid' HTML table.//w w w . ja v a 2 s .com * * @param numRows the number of <code>GridMap</code> table rows to return, including the heading row. To specify all * rows, set <code>numRows</code> to null. * * @return <code>numRows</code> rows of search page gene facet data and column access variables from the search * page's 'diseaseGrid' HTML table. */ private GridMap load(Integer numRows) { if (numRows == null) numRows = computeTableRowCount(); String[][] pageArray; // Wait for page. wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("table#diseaseGrid"))); int numCols = COL_INDEX_LAST + 1; pageArray = new String[numRows][numCols]; // Allocate space for the data. for (int i = 0; i < numCols; i++) { pageArray[0][i] = "Column_" + i; // Set the headings. } // Save the body values. List<WebElement> bodyRowElementsList = table.findElements(By.cssSelector("tbody tr")); if (!bodyRowElementsList.isEmpty()) { int sourceRowIndex = 1; // Insure there is always a non-null value. pageArray[sourceRowIndex][COL_INDEX_DISEASE_ID] = ""; pageArray[sourceRowIndex][COL_INDEX_DISEASE_ID_LINK] = ""; pageArray[sourceRowIndex][COL_INDEX_DISEASE_NAME] = ""; pageArray[sourceRowIndex][COL_INDEX_SOURCE] = ""; pageArray[sourceRowIndex][COL_INDEX_CURATED_HUMAN_OMIM] = ""; pageArray[sourceRowIndex][COL_INDEX_CURATED_MOUSE_MGI] = ""; pageArray[sourceRowIndex][COL_INDEX_CANDIDATE_IMPC] = ""; pageArray[sourceRowIndex][COL_INDEX_CANDIDATE_MGI] = ""; for (WebElement bodyRowElements : bodyRowElementsList) { DiseaseRow diseaseRow = new DiseaseRow(); List<WebElement> bodyRowElementList = bodyRowElements.findElements(By.cssSelector("td")); WebElement diseaseColElement = bodyRowElementList.get(0); WebElement diseaseColAnchorElement = bodyRowElementList.get(0).findElement(By.cssSelector("a")); // In order to see the contents of the span, we need to first bring the anatomy term into view, then // hover over it. Actions builder = new Actions(driver); try { testUtils.scrollToTop(driver, diseaseColElement, -50); // Scroll disease term into view. Actions hoverOverTerm = builder.moveToElement(diseaseColElement); hoverOverTerm.perform(); diseaseRow.diseaseIdLink = diseaseColAnchorElement.getAttribute("href"); int pos = diseaseRow.diseaseIdLink.lastIndexOf("/"); diseaseRow.diseaseId = diseaseRow.diseaseIdLink.substring(pos + 1); diseaseRow.diseaseName = diseaseColAnchorElement.getText(); diseaseRow.source = bodyRowElementList.get(1).getText(); diseaseRow.curatedHumanOmim = bodyRowElements.findElements(By.cssSelector("span.curatedHuman")) .isEmpty() ? false : true; diseaseRow.curatedMouseMgi = bodyRowElements.findElements(By.cssSelector("span.curatedMice")) .isEmpty() ? false : true; diseaseRow.candidateImpc = bodyRowElements.findElements(By.cssSelector("span.candidateImpc")) .isEmpty() ? false : true; diseaseRow.candidateMgi = bodyRowElements.findElements(By.cssSelector("span.candidateMgi")) .isEmpty() ? false : true; } catch (Exception e) { logger.error("EXCEPTION: SearchAnatomyTable.load() while waiting to hover. Error message: " + e.getLocalizedMessage()); e.printStackTrace(); } pageArray[sourceRowIndex][COL_INDEX_DISEASE_ID] = diseaseRow.diseaseId; pageArray[sourceRowIndex][COL_INDEX_DISEASE_ID_LINK] = diseaseRow.diseaseIdLink; pageArray[sourceRowIndex][COL_INDEX_DISEASE_NAME] = diseaseRow.diseaseName; pageArray[sourceRowIndex][COL_INDEX_SOURCE] = diseaseRow.source; pageArray[sourceRowIndex][COL_INDEX_CURATED_HUMAN_OMIM] = (diseaseRow.curatedHumanOmim ? "true" : "false"); pageArray[sourceRowIndex][COL_INDEX_CURATED_MOUSE_MGI] = (diseaseRow.curatedMouseMgi ? "true" : "false"); pageArray[sourceRowIndex][COL_INDEX_CANDIDATE_IMPC] = (diseaseRow.candidateImpc ? "true" : "false"); pageArray[sourceRowIndex][COL_INDEX_CANDIDATE_MGI] = (diseaseRow.candidateMgi ? "true" : "false"); sourceRowIndex++; bodyRows.add(diseaseRow); } } return new GridMap(pageArray, target); }
From source file:org.mousephenotype.cda.selenium.support.SearchGeneTable.java
License:Apache License
/** * Pulls <code>numRows</code> rows of search page gene facet data and column access variables from the search page's * 'geneGrid' HTML table.//from ww w. j a v a 2 s .c om * * @param numRows the number of <code>GridMap</code> table rows to return, including the heading row. To specify all * rows, set <code>numRows</code> to null. * * @return <code>numRows</code> rows of search page gene facet data and column access variables from the search * page's phenotype HTML table. */ private GridMap load(Integer numRows) { if (numRows == null) numRows = computeTableRowCount(); String[][] pageArray; // Wait for page. wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("table#geneGrid"))); int numCols = COL_INDEX_LAST + 1; pageArray = new String[numRows][numCols]; // Allocate space for the data. for (int i = 0; i < numCols; i++) { pageArray[0][i] = "Column_" + i; // Set the headings. } // Save the body values. List<WebElement> bodyRowElementsList = table.findElements(By.cssSelector("tbody tr")); if (!bodyRowElementsList.isEmpty()) { int sourceRowIndex = 1; for (WebElement bodyRowElements : bodyRowElementsList) { GeneRow geneRow = new GeneRow(); List<WebElement> bodyRowElementList = bodyRowElements.findElements(By.cssSelector("td")); WebElement titleDivElement = bodyRowElementList.get(0) .findElement(By.cssSelector("div.geneCol div.title a")); String href = titleDivElement.getAttribute("href"); WebElement geneColElement = bodyRowElementList.get(0).findElement(By.cssSelector("div.geneCol")); // Look for phenotype status. List<WebElement> phenotypeStatusElements = bodyRowElementList.get(2) .findElements(By.xpath("./a[contains(@class, 'phenotypingStatus')]")); List<String> phenotypeStatus = new ArrayList(); List<String> phenotypeStatusLink = new ArrayList(); for (WebElement phenotypeStatusElement : phenotypeStatusElements) { phenotypeStatus.add(phenotypeStatusElement.getText().trim()); phenotypeStatusLink.add(phenotypeStatusElement.getAttribute("href")); } GeneDetails geneDetails = new GeneDetails(geneColElement); geneRow.geneSymbol = titleDivElement.findElement(By.cssSelector("span.gSymbol")).getText().trim(); // geneSymbol geneRow.humanOrthologs = geneDetails.humanOrthologs; // humanOrtholog list geneRow.geneId = href.substring(href.lastIndexOf("/") + 1).trim(); // geneId geneRow.geneName = geneDetails.name; // geneName geneRow.synonyms = geneDetails.synonyms; // synonym list geneRow.phenotypeStatus = phenotypeStatus; // phenotypeStatus geneRow.phenotypeStatusLink = phenotypeStatusLink; // phenotypeStatusLink pageArray[sourceRowIndex][COL_INDEX_GENE_SYMBOL] = geneRow.geneSymbol; pageArray[sourceRowIndex][COL_INDEX_HUMAN_ORTHOLOG] = StringUtils.join(geneRow.humanOrthologs, "|"); pageArray[sourceRowIndex][COL_INDEX_GENE_ID] = geneRow.geneId; pageArray[sourceRowIndex][COL_INDEX_GENE_NAME] = geneRow.geneName; pageArray[sourceRowIndex][COL_INDEX_GENE_SYNONYMS] = StringUtils.join(geneRow.synonyms, "|"); pageArray[sourceRowIndex][COL_INDEX_PHENOTYPE_STATUS] = StringUtils.join(geneRow.phenotypeStatus, "|"); pageArray[sourceRowIndex][COL_INDEX_PHENOTYPE_STATUS_LINK] = StringUtils .join(geneRow.phenotypeStatusLink, "|"); sourceRowIndex++; bodyRows.add(geneRow); } } return new GridMap(pageArray, target); }
From source file:org.mousephenotype.cda.selenium.support.SearchImageAnnotationView.java
License:Apache License
/** * Pulls <code>numRows</code> rows of search page gene facet data and column access variables from the search page's * image annotation view./*from w ww . j av a 2 s. c o m*/ * * @param numRows the number of <code>GridMap</code> table rows to return, including the heading row. To specify * all rows, set <code>numRows</code> to null. * * @return <code>numRows</code> rows of search page gene facet data and column access variables from the search * page's image annotation view. */ private GridMap load(Integer numRows) { if (numRows == null) numRows = computeTableRowCount(); String[][] pageArray; // Wait for page. wait.until(ExpectedConditions.presenceOfElementLocated(map.get(TableComponent.BY_TABLE))); int numCols = COL_INDEX_LAST + 1; pageArray = new String[numRows][numCols]; // Allocate space for the data. for (int i = 0; i < numCols; i++) { pageArray[0][i] = "Column_" + i; // Set the headings. } // Save the body values. List<WebElement> bodyRowElementsList = table.findElements(By.cssSelector("tbody tr")); if (!bodyRowElementsList.isEmpty()) { int sourceRowIndex = 1; pageArray[sourceRowIndex][COL_INDEX_ANNOTATION_TYPE] = ""; pageArray[sourceRowIndex][COL_INDEX_ANNOTATION_TERM] = ""; pageArray[sourceRowIndex][COL_INDEX_ANNOTATION_ID] = ""; // Insure there is always a non-null value. pageArray[sourceRowIndex][COL_INDEX_ANNOTATION_ID_LINK] = ""; // Insure there is always a non-null value. pageArray[sourceRowIndex][COL_INDEX_RELATED_IMAGE_COUNT] = ""; pageArray[sourceRowIndex][COL_INDEX_IMAGES_LINK] = ""; for (WebElement bodyRowElements : bodyRowElementsList) { ImageRow bodyRow = new ImageRowFactory(bodyRowElements).getImageRow(); pageArray[sourceRowIndex][COL_INDEX_ANNOTATION_TYPE] = bodyRow.getAnnotationType(); pageArray[sourceRowIndex][COL_INDEX_ANNOTATION_TERM] = bodyRow.getAnnotationTerm(); pageArray[sourceRowIndex][COL_INDEX_ANNOTATION_ID] = bodyRow.getAnnotationId(); pageArray[sourceRowIndex][COL_INDEX_ANNOTATION_ID_LINK] = bodyRow.getAnnotationIdLink(); pageArray[sourceRowIndex][COL_INDEX_RELATED_IMAGE_COUNT] = Integer .toString(bodyRow.getRelatedImageCount()); pageArray[sourceRowIndex][COL_INDEX_IMAGES_LINK] = bodyRow.getImagesLink(); sourceRowIndex++; bodyRows.add(bodyRow); } } return new GridMap(pageArray, target); }
From source file:org.mousephenotype.cda.selenium.support.SearchImageImageView.java
License:Apache License
/** * Pulls <code>numRows</code> rows of search page gene facet data and column access variables from the search page's * image image view./*from ww w .ja v a 2 s. c o m*/ * * @param numRows the number of <code>GridMap</code> table rows to return, including the heading row. To specify * all rows, set <code>numRows</code> to null. * @return <code>numRows</code> rows of search page gene facet data and column access variables from the search * page's image image view. */ private GridMap load(Integer numRows) { if (numRows == null) numRows = computeTableRowCount(); String[][] pageArray; // Wait for page. wait.until(ExpectedConditions.presenceOfElementLocated(map.get(TableComponent.BY_TABLE))); int numCols = COL_INDEX_LAST + 1; pageArray = new String[numRows][numCols]; // Allocate space for the data. for (int i = 0; i < numCols; i++) { pageArray[0][i] = "Column_" + i; // Set the headings. } // Save the body values. List<WebElement> bodyRowElementsList = table.findElements(By.cssSelector("tbody tr")); if (!bodyRowElementsList.isEmpty()) { for (int sourceRowIndex = 0; sourceRowIndex < bodyRowElementsList.size(); sourceRowIndex++) { ImageRow bodyRow = new ImageRow(bodyRowElementsList.get(sourceRowIndex)); pageArray[sourceRowIndex + 1][COL_INDEX_ANNOTATION_TERM] = bodyRow.toStringTerms(); pageArray[sourceRowIndex + 1][COL_INDEX_ANNOTATION_ID] = bodyRow.toStringIds(); pageArray[sourceRowIndex + 1][COL_INDEX_ANNOTATION_ID_LINK] = bodyRow.toStringIdLinks(); pageArray[sourceRowIndex + 1][COL_INDEX_IMAGE_LINK] = (bodyRow.imageLink.isEmpty() ? "" : bodyRow.getImageLink()); } } return new GridMap(pageArray, target); }
From source file:org.mousephenotype.cda.selenium.support.SearchImpcImageImageView.java
License:Apache License
/** * Pulls <code>numRows</code> rows of search page gene facet data and column access variables from the search page's * image image view./*from ww w . ja v a 2 s . c o m*/ * * @param numRows the number of <code>GridMap</code> table rows to return, including the heading row. To specify * all rows, set <code>numRows</code> to null. * @return <code>numRows</code> rows of search page gene facet data and column access variables from the search * page's image image view. */ private GridMap load(Integer numRows) { if (numRows == null) numRows = computeTableRowCount(); String[][] pageArray; // Wait for page. wait.until(ExpectedConditions.presenceOfElementLocated(map.get(TableComponent.BY_TABLE))); int numCols = COL_INDEX_LAST + 1; pageArray = new String[numRows][numCols]; // Allocate space for the data. for (int i = 0; i < numCols; i++) { pageArray[0][i] = "Column_" + i; // Set the headings. } // Save the body values. List<WebElement> bodyRowElementsList = table.findElements(By.cssSelector("tbody tr")); if (!bodyRowElementsList.isEmpty()) { for (int sourceRowIndex = 0; sourceRowIndex < bodyRowElementsList.size(); sourceRowIndex++) { ImageRow bodyRow = new ImageRow(bodyRowElementsList.get(sourceRowIndex)); pageArray[sourceRowIndex + 1][COL_INDEX_PROCEDURE] = bodyRow.toStringProcedures(); pageArray[sourceRowIndex + 1][COL_INDEX_GENE_SYMBOL] = bodyRow.toStringGeneSymbols(); pageArray[sourceRowIndex + 1][COL_INDEX_GENE_SYMBOL_LINK] = bodyRow.toStringGeneSymbolLinks(); pageArray[sourceRowIndex + 1][COL_INDEX_MA_TERM] = bodyRow.toStringMATerms(); pageArray[sourceRowIndex + 1][COL_INDEX_MA_TERM_LINK] = bodyRow.toStringMATermLinks(); pageArray[sourceRowIndex + 1][COL_INDEX_IMAGE_LINK] = (bodyRow.imageLink.isEmpty() ? "" : bodyRow.getImageLink()); } } return new GridMap(pageArray, target); }
From source file:org.mousephenotype.cda.selenium.support.SearchPage.java
License:Apache License
/** * Clicks the facet and returns the result count. This has the side effect of * waiting for the page to finish loading. * * @param facetId HTML 'li' id of desired facet to click * @return the [total] results count/* www . j a va 2s . c o m*/ */ public int clickFacetById(String facetId) throws TestException { // Clicking the li element opens the facet but does not close it. Click on the subfacetText in the span instead. WebElement element = wait.until(ExpectedConditions .elementToBeClickable(By.xpath("//li[@id='" + facetId + "']//span[@class='flabel']"))); testUtils.scrollToTop(driver, element, -50); // Scroll element into view. element.click(); try { wait.until(ExpectedConditions .presenceOfElementLocated(By.xpath("//table[contains(@class, 'dataTable')]"))); // Wait for facet to load. wait.until(ExpectedConditions .presenceOfElementLocated(By.xpath("//div[contains(@class, 'dataTables_paginate')]"))); // Wait for page buttons to load. setFacetTable(); } catch (Exception e) { System.out.println("SearchPage.clickFacetById: Exception: " + e.getLocalizedMessage() + "\nURL: " + driver.getCurrentUrl()); e.printStackTrace(); throw new TestException(e); } return getTabResultCountFooter(); }
From source file:org.mousephenotype.cda.selenium.support.SearchPage.java
License:Apache License
/** * Returns the tab count in the footer at the bottom of the specified facet tab (HTML id 'dTable') * * @param facet the facet tab for which the count is desired * * @return the tab count in the footer at the bottom of the specified facet tab (HTML id 'dTable') *//* w w w . j a va 2 s .com*/ public int getTabResultCountFooter(Facet facet) { WebElement element = wait .until(ExpectedConditions.presenceOfElementLocated((By.xpath("//div[@id='dTable_info']")))); String[] showingParts = element.getText().split(" "); // Typical string: "Showing 1 to 10 of 23432 entries" return commonUtils.tryParseInt(showingParts[5].trim()); }
From source file:org.mousephenotype.cda.selenium.support.SearchPage.java
License:Apache License
/** * Returns the tab count in the header at the top of the specified facet tab (HTML id 'dTable') * * @param facet the facet tab for which the count is desired * * @return the tab count in the header at the top of the specified facet tab (HTML id 'dTable') * <i>NOTE: Only the images and impce_images tabs have counts in the header.</i> *///www . ja v a2s . com public int getTabResultCountHeader(Facet facet) { WebElement element = wait .until(ExpectedConditions.presenceOfElementLocated((By.xpath("//span[@id='resultCount']/a")))); String sResultCount = element.getText(); // Typical string: "Showing 1 to 10 of 23432 entries" return commonUtils.tryParseInt(sResultCount.trim()); }