Class: Selenium::WebDriver::Alert

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

Instance Method Summary (collapse)

Constructor Details

- (Alert) initialize(bridge)

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

- (Object) accept



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

def accept
  @bridge.accept_alert
end

- (Object) authenticate(username, password)



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

- (Object) dismiss



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

def dismiss
  @bridge.dismiss_alert
end

- (Object) send_keys(keys)



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

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

- (Object) text



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

def text
  @bridge.alert_text
end