Skip to content

Instantly share code, notes, and snippets.

@jdelStrother
Created August 30, 2013 12:13
Show Gist options
  • Select an option

  • Save jdelStrother/6389244 to your computer and use it in GitHub Desktop.

Select an option

Save jdelStrother/6389244 to your computer and use it in GitHub Desktop.
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