Sha256: c326963196a9906e5423afe3968b244be08022b3b8628b101f0cdcda1dbaf683
Contents?: true
Size: 930 Bytes
Versions: 3
Compression:
Stored size: 930 Bytes
Contents
require 'yaml' class TravianBot class Application module Connection # Login in to travian page def login @url, user, password = get_credentials driver = Selenium::WebDriver.for :firefox driver.navigate.to(@url) # Get the form fields. name_input = driver.find_element(:name, 'name') password_input = driver.find_element(:name, 'password') login_button = driver.find_element(:id, 's1') # Login name_input.send_keys(user) password_input.send_keys(password) login_button.submit driver end # Load the credentials from ENV['HOME']/.travian_bot def get_credentials credentials = YAML::load(File.open("#{ENV['HOME']}/.travian_bot")) [credentials['travian_bot']['url'], credentials['travian_bot']['usr'], credentials['travian_bot']['pwd']] end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
travian_bot-0.3.0 | lib/travian_bot/application/connection.rb |
travian_bot-0.2.4 | lib/travian_bot/application/connection.rb |
travian_bot-0.2.3 | lib/travian_bot/application/connection.rb |