Created
August 30, 2013 12:13
-
-
Save jdelStrother/6389244 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'rack/handler/webrick' | |
| require 'selenium-webdriver' | |
| require 'rack' | |
| class Selenium::WebDriver::Chrome::Bridge | |
| def extract_service_args(args) | |
| ["--log-path=chromedriver.log", "--verbose"] | |
| end | |
| end | |
| Thread.new{ | |
| app = proc { |env| [200, {}, ["Hello Server! #{env['PATH_INFO']}"]]} | |
| Rack::Handler::WEBrick.run(app, :Port => 22790) | |
| } | |
| # Make sure the server has started | |
| loop do | |
| begin | |
| break if Net::HTTP.start('127.0.0.1', 22790) { |http| http.get('/') }.is_a?(Net::HTTPSuccess) | |
| rescue SystemCallError | |
| sleep 0.01 | |
| end | |
| end | |
| loop do | |
| browser = Selenium::WebDriver.for(:chrome) | |
| puts Time.now | |
| browser.navigate.to "http://127.0.0.1:22790/1" | |
| browser.navigate.to 'about:blank' | |
| browser.quit | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment