Here is a method, it will scroll the screen and return an element or an empty array if the element is not found.
def find_if_exist(text) query_result = query("* marked:'#{text}'") current_screen_state = query('*') prev_screen_state = [] while (query_result.empty? and (current_screen_state != prev_screen_state)) prev_screen_state = current_screen_state perform_action('drag', 50, 50, 60, 40, 20) current_screen_state = query('*') query_result = query("* marked:'#{text}'") end query_result end
source share