-
-
Save digideskio/f571a17e20a5068f96a557ec55539b5a to your computer and use it in GitHub Desktop.
script aetna
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'capybara' | |
require 'capybara/dsl' | |
require 'active_support/all' | |
require 'debugger' | |
class AetnaDownloader | |
include Capybara::DSL | |
def initialize | |
Capybara.run_server = false | |
Capybara.current_driver = :selenium | |
Capybara.javascript_driver = true | |
Capybara.app_host = "https://member.aetna.com/" | |
end | |
def download_pdf index | |
sleep 3 | |
eob = "/memberSecure/featureRouter/claims/eobDetailMainPDF?eob=#{index}&eobType=NM" | |
visit eob | |
end | |
def login | |
fill_in 'USER', :with=> 'username' | |
fill_in 'Password', :with=>'password' | |
page.evaluate_script("document.forms[0].submit()") | |
#find_field('Password').native.send_key(:enter) | |
# page.find('.login-button').click | |
end | |
end | |
downloader = AetnaDownloader.new | |
downloader.download_pdf 1 | |
sleep 3 | |
downloader.login | |
sleep 3 | |
i = 1 | |
while i < 100 do | |
i += 1 | |
downloader.download_pdf i | |
end% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment