Skip to content

Instantly share code, notes, and snippets.

@mitchlloyd
Created November 21, 2009 05:19
Show Gist options
  • Save mitchlloyd/240021 to your computer and use it in GitHub Desktop.
Save mitchlloyd/240021 to your computer and use it in GitHub Desktop.
def answer_iucu_challenge(question)
case question
when /what year/: return "1988"
when /what street/: return "Main Street"
when /father\'s middle name/: return "Jonathan"
when /what city/: return "Denver"
else "blah"
end
end
def get_iucu_bal
@selenium = Selenium::SeleneseInterpreter.new("localhost", 4444, "*firefox", "https://ht.iucu.org", 10000)
@selenium.start
@selenium.open "/PCC/servlet/tpservlet?transactiontype=PreloginActionBean&FIID=0001"
@selenium.type "user_id", "1234567"
@selenium.click "login_button"
@selenium.wait_for_page_to_load "30000"
@selenium.type "document.entryForm.CHALLENGE_ANSWER", answer_iucu_challenge(@selenium.get_html_source)
@selenium.click "Login"
@selenium.wait_for_page_to_load "30000"
@selenium.type "PIN", "1234"
@selenium.click "Login"
@selenium.wait_for_page_to_load "30000"
#I still need to wait a bit so all the html shows up.
sleep(2)
iucu_data = @selenium.get_html_source
#Here we pull out the piece we want: the checking balance.
bal = iucu_data[/\$\d+([,\.]\d+)+/]
@selenium.close
return bal
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment