Ejemplo n.º 1
0
  // Sends whether or not the village has a paladin
  public static void setPaladin() {

    // loop through all the show unit lines
    // if the unit name is found then display it on the GUI
    for (int i = 1; i < 15; i++) {
      try {
        String paladinLabel =
            WebAutomation.driver
                .findElement(By.xpath("//*[@id=\"show_units\"]/div/table/tbody/tr[" + i + "]"))
                .getText();
        if (substring(paladinLabel, 0, 7).equals("Paladin")) {
          TroopsDetailPanel.setPaladinLabel("1");
          break;
        }
        // the troop was not found
        else {
          TroopsDetailPanel.setPaladinLabel("0");
        }
      } catch (NoSuchElementException e) {
      }
    }
  }