// Sends the level of warehouse to the GUI public static void setWarehouse() { for (int i = 2; i < 20; i++) { try { String wareHouseLabel = WebAutomation.driver .findElement(By.xpath("//*[@id=\"buildings\"]/tbody/tr[" + i + "]/td[1]")) .getText(); if (substring(wareHouseLabel, 0, 9).equals("Warehouse")) { BuildPanel.setWareHouseLabel("Warehouse " + substring(wareHouseLabel, 10, 20)); if (substring(wareHouseLabel, 10, 20).equals("")) { BuildPanel.setWareHouseLabel("Warehouse (Level 0)"); BuildPanel.setWareHouseButtonTrueOrFalse(false); } break; } else { BuildPanel.setWareHouseLabel("Warehouse (Level 0)"); } } catch (NoSuchElementException e) { BuildPanel.setUpgradeWareHouseLabel("Cannot upgrade"); BuildPanel.setWareHouseButtonTrueOrFalse(false); BuildPanel.setWareHouseLabel("Warehouse max level"); } } }