@Test
  public void testDataBrowserHTMLEncode() {
    // navigate to Data browser page
    loadDataBrowserpage();

    WebDriver driver = webDriverRule.getDriver();
    List<WebElement> numOfReg = driver
        .findElements(By.xpath(PulseTestLocators.DataBrowser.divDataRegions));

    for (int i = 1; i <= numOfReg.size(); i++) {
      if (getTextUsingId("treeDemo_" + i + "_span").equals(PulseTestData.DataBrowser.regName)) {
        searchByIdAndClick("treeDemo_" + i + "_check"); // driver.findElement(By.id("treeDemo_" + i
        // + "_check")).click();
      }
    }

    sendKeysUsingId(PulseTestLocators.DataBrowser.queryEditorTxtBoxId,
        DataBrowserResultLoader.QUERY_TYPE_EIGHT);
    clickElementUsingId(PulseTestLocators.DataBrowser.btnExecuteQueryId);

    clickElementUsingId(PulseTestLocators.DataBrowser.historyIcon);
    String queryText = findElementByXpath(PulseTestLocators.DataBrowser.historyLst)
        .findElement(By.cssSelector(PulseTestLocators.DataBrowser.queryText)).getText();

    assertThat(queryText).isEqualTo(DataBrowserResultLoader.QUERY_TYPE_EIGHT);

    List<WebElement> elements =
        driver.findElements(By.xpath(PulseTestData.DataBrowser.resultClusterHeadingsXPath));
    List<WebElement> filteredElements = elements.stream().filter(webElement -> webElement.getText()
        .equals("org.apache.geode.cache.query.data.Portfolio")).collect(
            Collectors.toList());
    List<WebElement> finalElements = filteredElements.stream().map(webElement -> {
      webElement.click();
      return webElement.findElements(By.xpath(PulseTestData.DataBrowser.resultClusterCellXPath));
    }).flatMap(Collection::stream).collect(Collectors.toList());

    // confirm script text is displayed
    assertThat(finalElements).hasSize(2);
    finalElements.forEach(webElement -> {
      assertThat(webElement.getAttribute("title")).isEqualTo("<script>alert('xss')</script>");
    });
  }
This test class contains automated tests for Pulse application related to 1. Different grid data
validations for example - Topology, Server Group, Redundancy Zone 2. Data Browser 3.

@since GemFire 2014-04-02
geode-pulse/src/uiTest/java/org/apache/geode/tools/pulse/tests/ui/PulseAutomatedTest.java