Sha256: a33181642ce9802436220b06f82773c74e32f7e2e027f95de2dc597549d7c3e6
Contents?: true
Size: 928 Bytes
Versions: 3
Compression:
Stored size: 928 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.2.2 | lib/travian_bot/application/connection.rb |
travian_bot-0.2.1 | lib/travian_bot/application/connection.rb |
travian_bot-0.2.0 | lib/travian_bot/application/connection.rb |