Class: Appium::Ios::UITestElementsPrinter

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#filterObject

Returns the value of attribute filter.



19
20
21
# File 'lib/appium_lib/ios/common/helper.rb', line 19

def filter
  @filter
end

Instance Method Details

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



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/appium_lib/ios/common/helper.rb', line 32

def _print_attr(type, name, label, value, hint, visible) # rubocop:disable Metrics/ParameterLists
  puts type.to_s if name || label || value || hint || visible

  if name == label && name == value
    puts "   name, label, value: #{name}" if name
  elsif name == label
    puts "   name, label: #{name}" if name
    puts "   value: #{value}" if value
  elsif name == value
    puts "   name, value: #{name}" if name
    puts "  label: #{label}" if label
  else
    puts "   name: #{name}" if name
    puts "  label: #{label}" if label
    puts "  value: #{value}" if value
  end
  puts "   hint: #{hint}" if hint
  puts "   visible: #{visible}" if visible
end

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



21
22
23
24
25
26
27
28
29
# File 'lib/appium_lib/ios/common/helper.rb', line 21

def start_element(type, attrs = [])
  return if filter && !filter.eql?(type)

  page = attrs.each_with_object({}) do |attr, hash|
    hash[attr[0]] = attr[1] if %w(name label value hint visible).include?(attr[0])
    hash
  end
  _print_attr(type, page['name'], page['label'], page['value'], page['hint'], page['visible'])
end