Method: WDA::Debug#source
- Defined in:
- lib/wda_lib/debug.rb
#source(session_id = nil, not_fetch_inaccessible = true, not_fetch_invisible = true, timeout = 60) ⇒ Hash
Get all elements on current screen When accessible is true, ignore all elements except for the main window for accessibility tree When accessible is false, and visible is true, ignore all invisible elements
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/wda_lib/debug.rb', line 13 def source(session_id = nil, not_fetch_inaccessible = true, not_fetch_invisible = true, timeout = 60) @timeout = timeout.to_i if !timeout.nil? begin if session_id.nil? res = post(@base_url + '/source', { accessible: not_fetch_inaccessible, visible: not_fetch_invisible }, @timeout) else res = post('/source', { accessible: not_fetch_inaccessible, visible: not_fetch_invisible }, @timeout) end rescue raise Error::NoSuchElementError, "Can't fetch current screen elements within #{@timeout}s" if res['status'].nil? end @timeout = @default_timeout res end |