def normalize(*args)
normalized = Normalized.new
normalized.options = if args.last.is_a?(Hash) then args.pop else {} end
if args[1]
normalized.selector = all[args[0]]
normalized.locator = args[1]
else
normalized.selector = all.values.find { |s| s.match?(args[0]) }
normalized.locator = args[0]
end
normalized.selector ||= all[Capybara.default_selector]
xpath = normalized.selector.call(normalized.locator)
if xpath.respond_to?(:to_xpaths)
normalized.xpaths = xpath.to_xpaths
else
normalized.xpaths = [xpath.to_s].flatten
end
normalized
end