Module: WDA::Debug
- Included in:
- WDA
- Defined in:
- lib/wda_lib/debug.rb
Instance Method Summary collapse
-
#find_app(app_name) ⇒ Object
Had issue when there is app shortcut in SIRI search or Today’s extention, having duplication app text, have to find the visibile one.
- #get_source ⇒ Object
- #get_window(window_number = 0) ⇒ Object
- #get_window_statusbar ⇒ Object
-
#source(session_id = nil, accessible = true) ⇒ Object
Get all elements on the screen.
Instance Method Details
#find_app(app_name) ⇒ Object
Had issue when there is app shortcut in SIRI search or Today’s extention, having duplication app text, have to find the visibile one
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/wda_lib/debug.rb', line 27 def find_app(app_name) max = 1 app_found = false app = nil homescreen while !app_found do swipe(@win_x*4/5, 10, @win_y/2, @win_y/2) max += 1 texts(app_name).each do |e| app = e if e.displayed? app_found = true break end end end if app.nil? fail "Can't find app :#{app_name}" else app end end |
#get_source ⇒ Object
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_statusbar ⇒ Object
17 18 19 |
# File 'lib/wda_lib/debug.rb', line 17 def 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 |