Class: AwsAccountUtils::Login

Inherits:
Base
  • Object
show all
Defined in:
lib/aws_account_utils/login.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#screenshot

Constructor Details

#initialize(logger, browser) ⇒ Login

Returns a new instance of Login.



7
8
9
10
# File 'lib/aws_account_utils/login.rb', line 7

def initialize(logger, browser)
  @logger = logger
  @browser = browser
end

Instance Attribute Details

#browserObject (readonly)

Returns the value of attribute browser.



5
6
7
# File 'lib/aws_account_utils/login.rb', line 5

def browser
  @browser
end

#loggerObject (readonly)

Returns the value of attribute logger.



5
6
7
# File 'lib/aws_account_utils/login.rb', line 5

def logger
  @logger
end

Instance Method Details

#execute(url, aws_email, password) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/aws_account_utils/login.rb', line 12

def execute(url, aws_email, password)
  browser.goto url
  return true unless 
  logger.debug "Logging into AWS."
  screenshot(browser, "1")
  browser.text_field(:id => 'ap_email').when_present.set aws_email
  browser.text_field(:id => 'ap_password').when_present.set password
  screenshot(browser, "2")
  browser.button(:id => 'signInSubmit-input').when_present.click
rescue Watir::Wait::TimeoutError, Net::ReadTimeout => e
  screenshot(browser, "error")
  raise StandardError, "#{self.class.name} - #{e}"
end