require 'selenium-webdriver'

class K5

  def initialize
    @browser = Selenium::WebDriver.for :chrome
    @browser.get 'http://kuro5hin.org'
    @login_name = 'trane'
    @password = 'ROR'
    sleep 5
    login
  end

  def login
    @browser.find_element(name: 'uname').send_keys @login_name
    @browser.find_element(name: 'pass').send_keys @password
    @browser.find_element(name: 'login').click
    sleep 5
    # TODO: check to see if we're logged in
    @browser.find_element(link_text: 'Review Hidden Comments').click
    puts @browser.title
    puts @browser.page_source
    
  end

end

K5.new
