// Sends the level of wall to the GUI public static void setWall() { for (int i = 2; i < 20; i++) { try { String wallLabel = WebAutomation.driver .findElement(By.xpath("//*[@id=\"buildings\"]/tbody/tr[" + i + "]/td[1]")) .getText(); if (substring(wallLabel, 0, 4).equals("Wall")) { BuildPanel.setWallLabel("Wall " + substring(wallLabel, 5, 14)); if (substring(wallLabel, 5, 14).equals("")) { BuildPanel.setWallLabel("Wall (Level 0)"); BuildPanel.setWallButtonTrueOrFalse(false); } break; } else { BuildPanel.setWallLabel("Wall (Level 0)"); } } catch (NoSuchElementException e) { BuildPanel.setUpgradeWallLabel("Cannot upgrade"); BuildPanel.setWallButtonTrueOrFalse(false); BuildPanel.setWallLabel("Wall max level"); } } }