Create Tree From Array Javascript Methods In Selenium