class Capybara::Result

def [](*args)

def [](*args)
  idx, length = args
  max_idx = case idx
  when Integer
    if !idx.negative?
      length.nil? ? idx : idx + length - 1
    else
      nil
    end
  when Range
    idx.max
  end
  if max_idx.nil?
    full_results[*args]
  else
    load_up_to(max_idx + 1)
    @result_cache[*args]
  end
end