Reduce Function Array Javascript Methods In Selenium Webdriver