Class: NarouAgent::Actions::Login

Inherits:
NarouAgent::Action show all
Defined in:
lib/narou_agent/actions/login.rb

Constant Summary

Constants included from UrlHelper

UrlHelper::NCODE_PATTERN

Instance Method Summary collapse

Methods inherited from NarouAgent::Action

#initialize

Methods included from UrlHelper

extract_part_id, ncode_to_i

Constructor Details

This class inherits a constructor from NarouAgent::Action

Instance Method Details

#run(id, password) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/narou_agent/actions/login.rb', line 4

def run(id, password)
  driver.get()

  driver.find_element(name: 'narouid').send_keys(id)
  driver.find_element(name: 'pass').send_keys(password)

  driver.find_element(id: 'mainsubmit').click

  # Confirm logging in succeeded
  driver.find_element(id: 'userid')
rescue Selenium::WebDriver::Error::WebDriverError => e
  raise ActionFailedError.new(e)
end