Skip to content

Instantly share code, notes, and snippets.

@digideskio
Forked from rsds143/eob.rb
Created December 4, 2017 16:29
Show Gist options
  • Save digideskio/f571a17e20a5068f96a557ec55539b5a to your computer and use it in GitHub Desktop.
Save digideskio/f571a17e20a5068f96a557ec55539b5a to your computer and use it in GitHub Desktop.
script aetna
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