// Sends number of axes to the GUI public static void setAxes() { // 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 axeLabel = WebAutomation.driver .findElement(By.xpath("//*[@id=\"show_units\"]/div/table/tbody/tr[" + i + "]")) .getText(); if (substring(axeLabel, 1, 4).equals("Axe") || substring(axeLabel, 2, 5).equals("Axe") || substring(axeLabel, 3, 6).equals("Axe") || substring(axeLabel, 4, 7).equals("Axe") || substring(axeLabel, 5, 8).equals("Axe") || substring(axeLabel, 6, 9).equals("Axe") || substring(axeLabel, 7, 10).equals("Axe")) { TroopsDetailPanel.setAxeLabel( WebAutomation.driver .findElement( By.xpath("//*[@id='show_units']/div/table/tbody/tr[" + i + "]/td/strong")) .getText()); break; } // the troop was not found else { TroopsDetailPanel.setAxeLabel("0"); } } catch (NoSuchElementException e) { } } }