Method: Selenium::WebDriver::Driver#alert

Defined in:
lib/oats/oats_selenium_api.rb

#alert(msg = nil, action = 'accept') ⇒ Object



114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/oats/oats_selenium_api.rb', line 114

def alert(msg = nil, action = 'accept')
  return unless webdriver?
#    selenium.sleep 1
  alert = switch_to.alert;
  txt = alert.text
  if msg
    oats_debug "#{action}ing alert [#{txt}]"
    #        Oats.assert txt =~ /#{msg}/, "Alert text does not match input msg: [#{msg}]"
    Oats.assert(txt == msg, "Alert text does not match input msg: [#{msg}]")
  end
  alert.send(action);
end