Skip to content

Instantly share code, notes, and snippets.

@raul-gracia
Last active October 13, 2015 23:38
Show Gist options
  • Save raul-gracia/4273989 to your computer and use it in GitHub Desktop.
Save raul-gracia/4273989 to your computer and use it in GitHub Desktop.
My Solution to the Gambit Researching Challenge
source "https://rubygems.org"
gem "capybara"
gem "selenium-webdriver"
GEM
remote: https://rubygems.org/
specs:
capybara (2.2.1)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
childprocess (0.5.1)
ffi (~> 1.0, >= 1.0.11)
ffi (1.9.3)
mime-types (2.2)
mini_portile (0.5.2)
multi_json (1.9.2)
nokogiri (1.6.1)
mini_portile (~> 0.5.0)
rack (1.5.2)
rack-test (0.6.2)
rack (>= 1.0)
rubyzip (1.1.2)
selenium-webdriver (2.40.0)
childprocess (>= 0.5.0)
multi_json (~> 1.0)
rubyzip (~> 1.0)
websocket (~> 1.0.4)
websocket (1.0.7)
xpath (2.0.0)
nokogiri (~> 1.3)
PLATFORMS
ruby
DEPENDENCIES
capybara
selenium-webdriver
require 'capybara'
require 'capybara/dsl'
Capybara.run_server = false
Capybara.current_driver = :selenium
Capybara.app_host = 'http://quiz.gambitresearch.com'
module MyCapybaraTest
class Test
include Capybara::DSL
def solve_challenge
visit('/')
challenge = find(".x").text
challenge = challenge[1..-2]
result = eval(challenge)
visit('/job/' + result.to_s )
puts find('body').text
save_screenshot('solution.png')
end
end
end
t = MyCapybaraTest::Test.new
t.solve_challenge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment