-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathweb_session.rb
33 lines (28 loc) · 940 Bytes
/
web_session.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
require 'capybara'
require 'selenium/webdriver'
module BancoDoBrasil
module WebSession
include Capybara::DSL
def setup
Capybara.register_driver :java_applet_compatible do |app|
profile = Selenium::WebDriver::Firefox::Profile.new
profile['extensions.blocklist.enabled'] = false
profile['plugin.state.java'] = 2
Capybara::Selenium::Driver.new(app, browser: :firefox, profile: profile)
end
Capybara.current_driver = :java_applet_compatible
Capybara.default_max_wait_time = 30
end
def authenticate
@authenticate ||= begin
setup
visit 'https://www2.bancobrasil.com.br/aapf/login.jsp' and
page.has_content?('Autoatendimento')
fill_in 'dependenciaOrigem', with: @branch
fill_in 'numeroContratoOrigem', with: @account
fill_in 'senhaConta', with: @password
click_on 'botaoEntrar'
end
end
end
end