ios_utils.rb
#
# Scroll down until the element is found
# @params:
# amount: number of pixels to scroll down
# how: method used to find the element, :id, :xpath, etc
# what: locator, format depending on the find method 'id_value', "//div[@name='...']"
# returns the element
Scroll down until the element is found
Scroll down until the element is found
def scroll_down_until_found(amount, how, what)
      while self.can_scroll(amount) && !self.is_element_present(how,what)
        self.scroll_down(amount)
      end
      if !is_element_present(how,what)
        raise StandardError.new('Element not found')
      end
      return $driver.find_element(how, what)
   end
def scroll_down_until_found ( amount , how , what ) while self . can_scroll ( amount ) && ! self . is_element_present ( how , what ) self . scroll_down ( amount ) end if ! is_element_present ( how , what ) raise StandardError . new ( 'Element not found' ) end return $driver . find_element ( how , what ) end
Scroll down until the element is found
Scroll down until the element is found
#TODO maybe not raise an standard error but just make the scenario fail, but continue with the rest of scenarios
amount
how
what
params:
number of pixels to scroll down how: method used to find the element, :id, :xpath, etc what: locator, format depending on the find method 'id_value', "//div[@name='...']" returns the element
number of pixels to scroll down how : method used to find the element : id : xpath etc what : locator format depending on the find method ' id_value ' " // div [ @name = ' ... ' ] " returns the element