Tree structure is same for each championship year. But the id of new year is different withprevious year. So we did not use id to handle this tree instead of DOM Tree.
When found elements and try to click it, the click actionis applied to the border, and can’t expand the tree.
Handel as below:
Code to handle it:
//Leagues - Leagues Setup -League tree- Expand/Click
public void expandLeagueTree(String node){
SeleniumUtils.waitForElement(driver, By.cssSelector("div#divJsTree ul li"+ " " + node), 20);
WebElement selectTreeNode = driver.findElement(By.cssSelector("div#divJsTree ul li"+ " " + node));
//selectTreeNode.click();
if(node.contains("a")){
selectTreeNode.click();
}else{
Actions action = new Actions(driver);
action.moveToElement(selectTreeNode);
action.moveByOffset(-selectTreeNode.getSize().getWidth() / 2 + 2, 0);
action.click().perform();
}
}