Class: ScbEasy::Client
- Inherits:
-
Object
- Object
- ScbEasy::Client
- Defined in:
- lib/scb_easy/client.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(username:, password:) ⇒ Client
constructor
A new instance of Client.
- #savings ⇒ Object
Constructor Details
#initialize(username:, password:) ⇒ Client
Returns a new instance of Client.
12 13 14 15 16 |
# File 'lib/scb_easy/client.rb', line 12 def initialize(username:, password:) @username = username @password = password @driver = self.class.driver end |
Class Method Details
.driver ⇒ Object
5 6 7 8 9 10 |
# File 'lib/scb_easy/client.rb', line 5 def self.driver return @driver if defined? @driver = Selenium::WebDriver::Chrome::Options.new(args: ['headless']) @driver = Selenium::WebDriver.for(:chrome, options: ) end |
Instance Method Details
#savings ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/scb_easy/client.rb', line 18 def savings begin header = @driver.find_element(id: 'DataProcess_imgHeader') account_summary unless header.attribute('src').end_with?('acc_sum_hd.gif') rescue Selenium::WebDriver::Error::NoSuchElementError account_summary end @driver. find_element(xpath: "//*/table[@class='pd_rt_10']/tbody/tr[3]/td[3]"). text end |