Module: WDA::Debug

Included in:
WDA
Defined in:
lib/wda_lib/debug.rb

Instance Method Summary collapse

Instance Method Details

#find_app(app_name) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/wda_lib/debug.rb', line 25

def find_app(app_name)
  max = 1
  homescreen if !text(app_name).displayed? && max <= 5
  while !text(app_name).displayed? do 
    swipe(@win_x-50, 10, @win_y/2, @win_y/2)
    max += 1
  end
  text(app_name)
end

#get_sourceObject



13
14
15
# File 'lib/wda_lib/debug.rb', line 13

def get_source
  get(@base_url + '/source')['value']['tree']['children']
end

#get_window(window_number = 0) ⇒ Object



21
22
23
# File 'lib/wda_lib/debug.rb', line 21

def get_window(window_number = 0)
  get(@base_url + '/source')['value']['tree']['children'][window_number]
end

#get_window_statusbarObject



17
18
19
# File 'lib/wda_lib/debug.rb', line 17

def get_window_statusbar
  get(@base_url + '/source')['value']['tree']['children'][2]
end

#source(session_id = nil, accessible = true) ⇒ Object

Get all elements on the screen



5
6
7
8
9
10
11
# File 'lib/wda_lib/debug.rb', line 5

def source(session_id = nil, accessible = true)
  if session_id.nil?
    post(@base_url + '/source', { accessible: accessible })
  else
    post '/source', { accessible: accessible }
  end 
end