class ContactCongressParser::Action
Attributes
data[R]
name[R]
Public Class Methods
create_from_step(step)
click to toggle source
# File lib/contact_congress_parser/action.rb, line 5 def self.create_from_step(step) name = step.keys.first values = step.values.first if values.class == Array values.map { |value| self.new(name, value) } else self.new(name, values) end end
new(name, data)
click to toggle source
# File lib/contact_congress_parser/action.rb, line 16 def initialize(name, data) @name = name @data = data end
Public Instance Methods
check_args()
click to toggle source
# File lib/contact_congress_parser/action.rb, line 54 def check_args '"' + @data['selector'] + '"' end
choose_args()
click to toggle source
# File lib/contact_congress_parser/action.rb, line 45 def choose_args # some chooses in contact-congress behave differently if data['options'] select_args else '"' + @data['selector'] + '"' end end
click_on_args()
click to toggle source
# File lib/contact_congress_parser/action.rb, line 62 def click_on_args to_click_on = data['value'] || data['selector'] '"' + to_click_on + '"' end
fill_in_args()
click to toggle source
# File lib/contact_congress_parser/action.rb, line 35 def fill_in_args '"' + escape_quotes(@data['selector']) + '"' + ', with: ' + field(@data['value'], required: @data['required']) end
find_args()
click to toggle source
# File lib/contact_congress_parser/action.rb, line 30 def find_args to_find = data['value'] || data['selector'] '"' + to_find + '"' end
select_args()
click to toggle source
# File lib/contact_congress_parser/action.rb, line 41 def select_args field(@data['value'], options: @data['options'], required: @data['required']) end
to_s()
click to toggle source
# File lib/contact_congress_parser/action.rb, line 21 def to_s # don't parse wait and find, they are problematic and (probably ;) unecessary ['wait', 'find'].include?(name) ? '' : name + ' ' + send("#{name}_args") end
uncheck_args()
click to toggle source
# File lib/contact_congress_parser/action.rb, line 58 def uncheck_args check_args end
visit_args()
click to toggle source
# File lib/contact_congress_parser/action.rb, line 26 def visit_args '"' + data + '"' end
Private Instance Methods
escape_quotes(str)
click to toggle source
# File lib/contact_congress_parser/action.rb, line 76 def escape_quotes(str) str.gsub('"', '\"') end
field(name, options={})
click to toggle source
# File lib/contact_congress_parser/action.rb, line 72 def field(name, options={}) Field.new(name, options).to_s end
path(uri)
click to toggle source
# File lib/contact_congress_parser/action.rb, line 68 def path(uri) URI.parse(uri).path end