Sha256: 60bcf0d9a1acbaf0de35543f3a250e4f910080ea5f161491d382a6350b69edb9

Contents?: true

Size: 953 Bytes

Versions: 6

Compression:

Stored size: 953 Bytes

Contents

require 'selenium-webdriver'

class TravianBot
  class Application
    module Queue
      # Check if building something
      def building_queue(selenium)        
        begin
          building_pipe = selenium.find_elements(:xpath, "//table[@id='building_contract']/tbody/tr")
          
          building_pipe.inject([]) do |out, entry|
            out << entry.text
            
            out
          end
        rescue Selenium::WebDriver::Error::NoSuchElementError
          []
        end
      end
      
      # Show the troop movement.
      def troop_movement(selenium)
        begin
          troop_movement = selenium.find_elements(:xpath, "//table[@id='movements']/tbody/tr")
          
          troop_movement.inject([]) do |out, movement|
            out << movement.text
            
            out
          end
        rescue   Selenium::WebDriver::Error::NoSuchElementError
          []
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
travian_bot-0.3.0 lib/travian_bot/application/queue.rb
travian_bot-0.2.4 lib/travian_bot/application/queue.rb
travian_bot-0.2.3 lib/travian_bot/application/queue.rb
travian_bot-0.2.2 lib/travian_bot/application/queue.rb
travian_bot-0.2.1 lib/travian_bot/application/queue.rb
travian_bot-0.2.0 lib/travian_bot/application/queue.rb