Method: Rtml::Test::Screen#autoselect_hyperlink

Defined in:
lib/rtml/test/screen.rb

Returns the hyperlink Hpricot element, if there’s only one; nil if there are none; and raises an Rtml::Errors::ApplicationError if there are multiple links (because there’s no inference as to which link to follow).



46
47
48
49
50
51
52
53
54
55
# File 'lib/rtml/test/screen.rb', line 46

def autoselect_hyperlink
  if !(links = hyperlinks).empty?
    if links.length > 1
      raise Rtml::Errors::ApplicationError, "Cannot auto-select hyperlink: too many choices on screen #{id.inspect}"
    end
    links.shift
  else
    nil
  end
end