class Appium::Driver

def exists pre_check=0, post_check=@default_wait, &search_block

Returns:
  • (Boolean) -

Parameters:
  • search_block (Block) -- the block to call
  • post_check (Integer) -- the amount in seconds to set the
  • pre_check (Integer) -- the amount in seconds to set the
def exists pre_check=0, post_check=@default_wait, &search_block
  set_wait pre_check # set wait to zero
  # the element exists unless an error is raised.
  exists = true
  begin
    search_block.call # search for element
  rescue
    exists = false # error means it's not there
  end
  # restore wait
  set_wait post_check if post_check != pre_check
  exists
end