Class: Selenium::WebDriver::Alert

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/webdriver/common/alert.rb

Instance Method Summary collapse

Constructor Details

#initialize(bridge) ⇒ Alert

Returns a new instance of Alert.



23
24
25
26
27
28
# File 'lib/selenium/webdriver/common/alert.rb', line 23

def initialize(bridge)
  @bridge = bridge

  # fail fast if the alert doesn't exist
  bridge.alert_text
end

Instance Method Details

#acceptObject



30
31
32
# File 'lib/selenium/webdriver/common/alert.rb', line 30

def accept
  @bridge.accept_alert
end

#authenticate(username, password) ⇒ Object



46
47
48
49
# File 'lib/selenium/webdriver/common/alert.rb', line 46

def authenticate(username, password)
  @bridge.authentication(username: username, password: password)
  accept
end

#dismissObject



34
35
36
# File 'lib/selenium/webdriver/common/alert.rb', line 34

def dismiss
  @bridge.dismiss_alert
end

#send_keys(keys) ⇒ Object



38
39
40
# File 'lib/selenium/webdriver/common/alert.rb', line 38

def send_keys(keys)
  @bridge.alert = keys
end

#textObject



42
43
44
# File 'lib/selenium/webdriver/common/alert.rb', line 42

def text
  @bridge.alert_text
end