driver.findElement(By.xpath("//input[@id='tree-node-commands']//following::span[@class='rct-checkbox' and position()=1]")).click(); Thread.sleep(2000); //driver ...