Class: Appium::Ios::UITestElementsPrinter

Inherits:
Nokogiri::XML::SAX::Document
  • Object
show all
Defined in:
lib/appium_lib/ios/helper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#filterObject

Returns the value of attribute filter.



4
5
6
# File 'lib/appium_lib/ios/helper.rb', line 4

def filter
  @filter
end

Instance Method Details

#_print_attr(type, name, label, value, hint) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/appium_lib/ios/helper.rb', line 15

def _print_attr(type, name, label, value, hint)
  if name == label && name == value
    puts type.to_s if name || label || value || hint
    puts "   name, label, value: #{name}" if name
  elsif name == label
    puts type.to_s if name || label || value || hint
    puts "   name, label: #{name}" if name
    puts "   value: #{value}" if value
  elsif name == value
    puts type.to_s if name || label || value || hint
    puts "   name, value: #{name}" if name
    puts "  label: #{label}" if label
  else
    puts type.to_s if name || label || value || hint
    puts "   name: #{name}" if name
    puts "  label: #{label}" if label
    puts "  value: #{value}" if value
  end
  puts "   hint: #{hint}" if hint
end

#start_element(type, attrs = []) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/appium_lib/ios/helper.rb', line 6

def start_element(type, attrs = [])
  return if filter && !filter.eql?(type)
  page = attrs.inject({}) do |hash, attr|
    hash[attr[0]] = attr[1] if %w(name label value hint).include?(attr[0])
    hash
  end
  _print_attr(type, page['name'], page['label'], page['value'], page['hint'])
end