Class: AwsAccountUtils::ChallengeQuestions
- Defined in:
- lib/aws_account_utils/challenge_questions.rb
Instance Attribute Summary collapse
-
#browser ⇒ Object
readonly
Returns the value of attribute browser.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
- #create(account_email, account_password, challenge_words = {}) ⇒ Object
-
#initialize(logger, browser) ⇒ ChallengeQuestions
constructor
A new instance of ChallengeQuestions.
Methods inherited from Base
Constructor Details
#initialize(logger, browser) ⇒ ChallengeQuestions
Returns a new instance of ChallengeQuestions.
9 10 11 12 |
# File 'lib/aws_account_utils/challenge_questions.rb', line 9 def initialize(logger, browser) @logger = logger @browser = browser end |
Instance Attribute Details
#browser ⇒ Object (readonly)
Returns the value of attribute browser.
7 8 9 |
# File 'lib/aws_account_utils/challenge_questions.rb', line 7 def browser @browser end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
7 8 9 |
# File 'lib/aws_account_utils/challenge_questions.rb', line 7 def logger @logger end |
Instance Method Details
#create(account_email, account_password, challenge_words = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/aws_account_utils/challenge_questions.rb', line 14 def create(account_email, account_password, challenge_words = {}) logger.debug "Setting security challenge answers." Login.new(logger, browser).execute url, account_email, account_password browser.a(:xpath => '//a[@ng-click="toggleEditingSecurityQuestionsInfoState()"]').when_present.click challenge_words.each do |num, word| browser.input(:xpath => "//input[@ng-model=\"selectedSecurityQuestions.question#{num}.answer\"]").to_subtype.when_present.set word end screenshot(browser, "1") browser.(:xpath => '//button[@ng-click="updateSecurityQuestions()"]').when_present.click browser.a(:xpath => '//a[@ng-click="toggleEditingSecurityQuestionsInfoState()"]').wait_until_present challenge_words rescue Watir::Wait::TimeoutError, Net::ReadTimeout => e screenshot(browser, "error") raise StandardError, "#{self.class.name} - #{e}" end |