def execute_script(script, *args)
      args.map! do |e|
        e.is_a?(Element) ? e.wait_until(&:exists?).wd : e
      end

      wrap_elements_in(self, @driver.execute_script(script, *args))
    end
def execute_script(script, *args)
      args.map! do |e|
        e.is_a?(Element) ? e.wait_until(&:exists?).wd : e
      end

      wrap_elements_in(self, @driver.execute_script(script, *args))
    end
Executes JavaScript snippet.

 If you are going to use the value snippet returns, make sure to use
 `return` explicitly.

 @example Check that Ajax requests are completed with jQuery
   browser.execute_script("return jQuery.active") == 0
   #=> true

 @param [String] script JavaScript snippet to execute
 @param args Arguments will be available in the given script in the 'arguments' pseudo-array