God - starting new process while existing process is still stopping - ruby

Using God (godrb.com) I'm trying to write a recipe that starts up a new process regardless of the status of an existing process when deploying an application. The existing process needs to have a long running timeout for it to finish current tasks, but the new process should start immediately using the newly deployed code.
What I currently have now sets a timeout of 300 seconds on the stop but waits the whole 300 seconds before starting up the new process.
God.watch do |w|
w.name = "sidekiq"
w.interval = 30.seconds
w.start = "bash -lc 'cd /path/to/current && ./bin/sidekiq -P /path/to/shared/pids/sidekiq.pid'"
w.stop = "bash -lc 'kill -USR1 `cat /path/to/shared/pids/sidekiq.pid`'"
w.stop_timeout = 300.seconds
w.pid_file = "/path/to/shared/pids/sidekiq.pid"
w.behavior(:clean_pid_file)
end
In this case, the kill -USR1 tells sidekiq to finish processing any current jobs, but to not take anymore work.
I'd like to keep the 300 second timeout on the existing worker but start up the new process as soon as the kill command is run.

I think you have to define some transitions.
This is my god.rb:
# I'm using Rails
rails_env = ENV['RAILS_ENV'] || 'development'
rails_root = '/path/to/current'
pid_file = "#{rails_root}/tmp/pids/sidekiq.pid"
God.watch do |w|
w.dir = rails_root
w.name = "sidekiq"
w.interval = 30.seconds
w.env = {'RAILS_ENV' => rails_env, 'BUNDLE_GEMFILE' => "#{rails_root}/Gemfile"}
w.uid = 'deployer'
w.gid = 'staff'
w.start = "cd #{rails_root}; bundle exec sidekiq -e #{rails_env} -C #{rails_root}/config/sidekiq.yml -i #{i} -P #{pid_file}&"
w.stop = "cd #{rails_root}; bundle exec sidekiqctl stop #{pid_file} 10"
w.restart = "#{w.stop} && #{w.start}"
w.start_grace = 15.seconds
w.restart_grace = 15.seconds
w.pid_file = pid_file
w.log = "#{rails_root}/log/sidekiq.log"
# clean pid files before start if necessary
w.behavior(:clean_pid_file)
# determine the state on startup
w.transition(:init, {true => :up, false => :start}) do |on|
on.condition(:process_running) do |c|
c.running = true
end
end
# determine when process has finished starting
w.transition([:start, :restart], :up) do |on|
on.condition(:process_running) do |c|
c.running = true
end
# failsafe
on.condition(:tries) do |c|
c.times = 5
c.transition = :start
end
end
# start if process is not running
w.transition(:up, :start) do |on|
on.condition(:process_exits)
end
# lifecycle
w.lifecycle do |on|
on.condition(:flapping) do |c|
c.to_state = [:start, :restart]
c.times = 5
c.within = 5.minute
c.transition = :unmonitored
c.retry_in = 10.minutes
c.retry_times = 5
c.retry_within = 2.hours
end
end
end

Related

What is the correct way to terminate all threads that are 'sub' to main

I am running multiple threads, and when one of the threads sets the global function '$trade_executed' to true I want it to kill all other threads and remove them from the global '$threads' array.
Then I restart the thread creation process.
Below is a simplified version of my codebase.
3 Threads are created and it looks like 2 threads are deleted but a third thread stays. (for reasons unknown)
Ideally this script would never print '2' or '3' because it would always trigger at '1' minute and kill all threads and reset.
*
thr.exit is preferred. I don't want any code pushed from other threads with a thr.join after $trade_executed is set
require 'thread'
class Finnean
def initialize
#lock = Mutex.new
end
def digger(minute)
sleep(minute * 60)
coco(minute)
end
def coco(minute)
#lock.synchronize {
puts "coco #{minute}"
$threads.each do |thr|
next if thr == Thread.current
thr.exit
end
$trade_executed = true
Thread.current.exit
}
end
end
minutes = [1, 2, 3]
$threads = Array.new
$trade_executed = false
abc = Finnean.new
def start_threads(minutes, abc)
minutes.each do |minute|
$threads << Thread.new {abc.digger(minute)}
puts minute
end
end
start_threads(minutes, abc)
while true
if $trade_executed != false then
count = 0
$threads.map! do |thr|
count += 1
puts "#{thr} & #{thr.status}"
thr.exit
$threads.delete(thr)
puts "Iteration #{count}"
end
count = 0
$threads.each do |thr|
count += 1
puts "#{thr}" ##{thr.status}
puts "Threads Still Left: #{count}"
end
$trade_executed = false
abc = Finnean.new
start_threads(minutes, abc)
end
end
Why not make a thread killer that you keep locked up until the first one finishes:
# Create two variables that can be passed in to the Thread.new block closure
threads = [ ]
killer = nil
# Create 10 threads, each of which waits a random amount of time before waking up the thread killer
10.times do |n|
threads << Thread.new do
sleep(rand(2..25))
puts "Thread #{n} finished!"
killer.wakeup
end
end
# Define a thread killer that will call `kill` on all threads, then `join`
killer = Thread.new(threads) do
Thread.stop
threads.each do |thread|
puts "Killing #{thread}"
thread.kill
thread.join
end
end
# The killer will run last, so wait for that to finish
killer.join
You can't force a thread to exit, but you can kill it. That generates an exception you could rescue and deal with as necessary.

Ruby Script download photos

Goal: Download photos from iCloud Shared web album via script: https://www.icloud.com/sharedalbum/#B0Q5oqs3qGtDCal
I have following script from here: https://github.com/dsboulder/icloud-shared-album-download/blob/master/download_album.rb
(I have taken out the image resize)
Problem: Photos seem to download, however they all look all like this (script output further below):
#!/usr/bin/env ruby
# C:\Users\Win10IE11\Desktop\icloud-shared-album-download-master\download_album2.rb B0Q5oqs3qGtDCal
require 'selenium-webdriver'
require 'fileutils'
require 'yaml'
album_name = ARGV[0]
options = Selenium::WebDriver::Chrome::Options.new(args: ['headless'])
driver = Selenium::WebDriver.for(:chrome, options: options)
puts "Downloading album ID #{album_name}:"
dir = "C:/Users/Win10IE11/Downloads/#{album_name}"
movies_dir = "/home/pi/Videos"
FileUtils.mkdir_p(dir)
urls_seen = Set.new
files_seen = Set.new
driver.get("https://www.icloud.com/sharedalbum/##{album_name}")
puts " Navigated to index page: #{driver.current_url}"
sleep 2
driver.find_element(css: "[role=button]").click
sleep 5
c = 0
current_url = driver.current_url
seen_first = false
exit_early = false
until urls_seen.include?(current_url) or c >= 200 or exit_early do
retries = 0
begin
current_url = driver.current_url
puts " Navigated to: #{current_url}"
urls_seen.add(current_url)
i = driver.find_element(css: "img")
puts " Downloading image #{c}: #{i["src"]}"
u = URI.parse(i["src"])
ext = u.path.split(".").last.downcase
filename = "#{current_url.split(";").last}.#{ext}".downcase
path = "#{dir}/#{filename}"
if File.exist?(path)
if c == 0
seen_first = true
puts " Already seen first image, going backwards now"
elsif seen_first and c == 1
exit_early = true
puts " Already seen last image, we're probably done!"
else
puts " Skipping already downloaded file #{path}"
end
else
r = Net::HTTP.get_response(u)
puts " #{r.inspect}"
File.write(path, r.body)
puts " Wrote file of length #{r.body.length} to #{path}"
videos = driver.find_elements(css: ".play-button")
if videos.length > 0
puts " Found video!!!"
videos.first.click
video_src = driver.find_element(css: "video > source")["src"]
u = URI.parse(video_src)
ext = u.path.split(".").last.downcase
filename = "#{current_url.split("#").last.gsub(";", "_")}.#{ext}".downcase
path = "#{movies_dir}/#{filename}"
puts " Downloading from #{video_src} to #{path}"
driver.navigate.refresh
r = Net::HTTP.get_response(u)
File.write(path, r.body)
puts " Wrote #{r.body.length} bytes of video to #{path}"
end
end
c += 1
sleep 1
driver.find_element(css: "body").send_keys(seen_first ? :arrow_left : :arrow_right)
sleep 1
current_url = driver.current_url
rescue => e
puts "Error: #{e.inspect}"
retries += 1
if retries < 4
driver.quit rescue nil
puts "RETRY ##{retries}"
system "pkill -f chromedriver"
driver = Selenium::WebDriver.for(:chrome, options: options)
driver.get(current_url)
sleep 5
retry
end
end
end
puts " Finished #{c} photos in album #{album_name}!"
driver.quit
***Output:
Navigated to: https://www.icloud.com/sharedalbum/#B0Q5oqs3qGtDCal;64D46E01-D439-4FB3-9234-EEADFD92B4B8
Downloading image 22: https://cvws.icloud-content.com/S/AZmmX4aAk6O2XpXCavO3rA4XSNms/IMG_0023.JPG?o=AtHCwB51UajcHVvLEboQsSvM4hK5ZHb25DMLu5rjLgMs&v=1&z=https%3A%2F%2Fp26-content.icloud.com%3A443&x=1&a=BqocZLbrD6m1lXeHN6LXov32oNLDA-UfRgEAAAMxH0Y&e=1538045095&r=900d8d25-0a15-43e5-be59-2a4c9267cfaf-36&s=C3ee21ErkyHFKzq-JWjZkKXpah4
#<Net::HTTPOK 200 OK readbody=true>
Wrote file of length 1248141 to C:/Users/Win10IE11/Downloads/B0Q5oqs3qGtDCal/64d46e01-d439-4fb3-9234-eeadfd92b4b8.jpg
Swapped the function with "open-uri" function, doc found here: https://cobwwweb.com/download-collection-of-images-from-url-using-ruby.html
Swapped old code:
File.write(path, r.body)
with:
File.open(dest, 'wb') { |f| f.write(u.read) }
Here is the fixed code:
#!/usr/bin/env ruby
# C:\Users\Win10IE11\Desktop\icloud-shared-album-download-master\dl5.rb B0Q5oqs3qGtDCal
require 'selenium-webdriver'
require 'fileutils'
require 'yaml'
require 'open-uri'
album_name = ARGV[0]
options = Selenium::WebDriver::Chrome::Options.new(args: ['headless'])
driver = Selenium::WebDriver.for(:chrome, options: options)
puts "Downloading album ID #{album_name}:"
dir = "C:/Users/Win10IE11/Downloads/#{album_name}"
movies_dir = dir
FileUtils.mkdir_p(dir)
urls_seen = Set.new
files_seen = Set.new
driver.get("https://www.icloud.com/sharedalbum/##{album_name}")
puts " Navigated to index page: #{driver.current_url}"
sleep 1
driver.find_element(css: "[role=button]").click
sleep 1
c = 0
current_url = driver.current_url
seen_first = true
exit_early = false
def download_image(url, dest)
open(url) do |u|
File.open(dest, 'wb') { |f| f.write(u.read) }
puts "Saved #{url} to #{dest}"
end
end
until urls_seen.include?(current_url) or c >= 200 or exit_early do
retries = 0
begin
current_url = driver.current_url
puts " Navigated to: #{current_url}"
urls_seen.add(current_url)
i = driver.find_element(css: "img")
# C:\Users\Win10IE11\Desktop\icloud-shared-album-download-master\dl5.rb B0Q5oqs3qGtDCal
puts " count #{c}"
videos = driver.find_elements(css: ".play-button")
if videos.length > 0
#puts " Found video!!!"
videos.first.click
i = driver.find_element(css: "video > source")
url = "#{i["src"]}"
local1 = "#{url.split('/').last}"
local = "#{c}_#{local1.split('?').first}"
download_image(url, "#{dir}/#{local}")
driver.navigate.refresh
sleep 1
else
#puts " not video!!!"
url = "#{i["src"]}"
local1 = "#{url.split('/').last}"
local = "#{c}_#{local1.split('?').first}"
download_image(url, "#{dir}/#{local}")
end
c += 1
sleep 0.1
driver.find_element(css: "body").send_keys(seen_first ? :arrow_left : :arrow_right)
sleep 0.1
current_url = driver.current_url
rescue => e
puts "Error: #{e.inspect}"
retries += 1
if retries < 4
driver.quit rescue nil
puts "RETRY ##{retries}"
system "pkill -f chromedriver"
driver = Selenium::WebDriver.for(:chrome, options: options)
driver.get(current_url)
sleep 1
retry
end
end
end
puts " Finished #{c} photos in album #{album_name}!"
driver.quit

resque worker error when forking [Ruby, Redis]

I'm having a difficulty with processing resque tasks which were enqueued.
The whole enqueuing part goes well - I can see it in Redis and also Resque.info shows the pending tasks number incrementing as it should.
If I run the perform method of the Job class explicitly - everything works fine.
Once the worker come alive - all the tasks fail.
This is the Job class:
class TestJob
#queue = :test1_queue
def self.perform(str)
begin
f = open('/tmp/test.txt', 'a')
f.write("#{Time.now.to_s} #{str} in self.perform\n")
rescue Exception => e
f.write("#{Time.now.to_s} #{str} in self.perform\n#{e.message}\n#{e.backtrace}\n")
ensure
f.close
end
end
end
The resque.rb initializer:
require 'resque'
require 'redis'
Dir['../../jobs'].each { |file| require file }
Resque.redis = $resque_redis
Resque.logger.level = Logger::WARN
Resque.after_fork do |_|
$resque_redis.client.reconnect
end
Redis initializer:
require 'redis'
$resque_redis = Redis.new(:host => REDIS_BITMAP_HOST, :port => REDIS_PORT, :db => 0, :timeout => 30)
config file to start the worker with god:
require_relative './common.rb'
watch_resque_process('test1', 1)
God definitions:
$home_dir = ENV["HOME"]
$rack_env = ENV["ETL_ENV"] || "development"
def create_deafult_monitoring_scheme(watch)
# Restart if memory is above 150 Megabytes or CPU is above 50% for 5 consecutive intervals
watch.restart_if do |restart|
restart.condition(:memory_usage) do |c|
c.above = 150.megabytes
c.times = [3, 5] # 3 out of 5 intervals
end
restart.condition(:cpu_usage) do |c|
c.above = 50.percent
c.times = 5
end
end
# The :flapping condition guards against the edge case wherein god rapidly starts or restarts your application.
# If this watch is started or restarted five times withing 5 minutes, then unmonitor it for 10 minutes.
# After 10 minutes, monitor it again to see if it was just a temporary problem; if the process is seen to be flapping five times within two hours, then give up completely.
watch.lifecycle do |on|
on.condition(:flapping) do |c|
c.to_state = [:start, :restart]
c.times = 5
c.within = 5.minute
c.transition = :unmonitored
c.retry_in = 10.minute
c.retry_times = 5
c.retry_within = 30.minute
end
end
end
def watch_resque_process(resque_process_name, worker_count=8)
God.watch do |w|
w.name = "resque_work-#{resque_process_name}"
w.start = "cd #{$home_dir}/rtb-etl && COUNT=#{worker_count} QUEUE='#{resque_process_name}_queue' RACK_ENV=#{$rack_env} rake resque:workers"
w.interval = 30.seconds
w.log = File.join($home_dir, 'logs', 'resque', "resque_#{resque_process_name}.log")
w.err_log = File.join($home_dir, 'logs', 'resque', "resque_#{resque_process_name}.log")
w.env = { 'PIDFILE' => "#{$home_dir}/pids/#{w.name}.pid" }
# Check if the process is still up every 5 seconds
w.start_if do |start|
start.condition(:process_running) do |c|
c.interval = 5.seconds
c.running = false
end
end
create_deafult_monitoring_scheme(w)
end
end
def watch_rake_task(rake_task_name, interval=30.seconds)
God.watch do |w|
w.name = "rake_#{rake_task_name}"
# w.start = "cd #{$home_dir}/rtb-etl && RACK_ENV=#{$rack_env} bundle exec rake #{rake_task_name}"
w.start = "cd #{$home_dir}/rtb-etl && RACK_ENV=#{$rack_env} rake #{rake_task_name}"
w.interval = interval
w.log = File.join($home_dir, 'logs', 'resque', "rake_#{rake_task_name}.log")
w.err_log = File.join($home_dir, 'logs', 'resque', "rake_#{rake_task_name}.log")
w.env = { 'PIDFILE' => "#{$home_dir}/pids/#{w.name}.pid" }
# Check if the process is still up every 30 seconds
w.start_if do |start|
start.condition(:process_running) do |c|
c.interval = interval
c.running = false
end
end
create_deafult_monitoring_scheme(w)
end
end
when I run the follwoing:
irb(main):004:0> Resque.enqueue(TestJob, 'foo')
=> true
In order to check what went wrong, I run in irb the following:
Resque::Failure.all(0,20).each { |job|
puts "#{job["exception"]} #{job["backtrace"]}"
}
and get this result:
[{"failed_at"=>"2015/08/26 17:35:00 UTC",
"payload"=>{"class"=>"TestJob", "args"=>["foo"]},
"exception"=>"NoMethodError",
"error"=>"undefined method `client' for nil:NilClass",
"backtrace"=>[], "worker"=>"ip-172-31-11-211:5006:test1_queue",
"queue"=>"test1_queue"}]
Any ideas ?

Ruby Watir: cannot launch browser in a thread in Linux

I'm trying to run this code in Red Hat Linux, and it won't launch a browser. The only way I can get it to work is if i ALSO launch a browser OUTSIDE of the thread, which makes no sense to me. Here is what I mean:
require 'watir-webdriver'
$alphabet = ["A", "B", "C"]
$alphabet.each do |z|
puts "pshaw"
Thread.new{
Thread.current["testPuts"] = "ohai " + z.to_s
Thread.current["myBrowser"] = Watir::Browser.new :ff
puts Thread.current["testPuts"] }
$browser = Watir::Browser.new :ff
end
the output is:
pshaw
(launches browser)
ohai A
(launches browser)
pshaw
(launches browser)
ohai B
(launches browser)
pshaw
(launches browser)
ohai C
(launches browser)
However, if I remove the browser launch that is outside of the thread, as so:
require 'watir-webdriver'
$alphabet = ["A", "B", "C"]
$alphabet.each do |z|
puts "pshaw"
Thread.new{
Thread.current["testPuts"] = "ohai " + z.to_s
Thread.current["myBrowser"] = Watir::Browser.new :ff
puts Thread.current["testPuts"] }
end
The output is:
pshaw
pshaw
pshaw
What is going on here? How do I fix this so that I can launch a browser inside a thread?
EDIT TO ADD:
The solution Justin Ko provided worked on the psedocode above, but it's not helping with my actual code:
require 'watir-webdriver'
require_relative 'Credentials'
require_relative 'ReportGenerator'
require_relative 'installPageLayouts'
require_relative 'PackageHandler'
Dir[(Dir.pwd.to_s + "/bmx*")].each {|file| require_relative file } #this includes all the files in the directory with names starting with bmx
module Runner
def self.runTestCases(orgType, *caseNumbers)
$testCaseArray = Array.new
caseNumbers.each do |thisCaseNum|
$testCaseArray << thisCaseNum
end
$allTestCaseResults = Array.new
$alphabet = ["A", "B", "C"]
#count = 0
#multiOrg = 0
#peOrg = 0
#eeOrg = 0
#threads = Array.new
$testCaseArray.each do |thisCase|
$alphabet[#count] = Thread.new {
puts "working one"
Thread.current["tBrowser"] = Watir::Browser.new :ff
puts "working two"
if ((thisCase.declareOrg().downcase == "multicurrency") || (thisCase.declareOrg().downcase == "mc"))
currentOrg = $multicurrencyOrgArray[#multiOrg]
#multiOrg += 1
elsif ((thisCase.declareOrg().downcase == "enterprise") || (thisCase.declareOrg().downcase == "ee"))
currentOrg = $eeOrgArray[#eeOrg]
#eeOrg += 1
else #default to single currency PE
currentOrg = $peOrgArray[#peOrg]
#peOrg += 1
end
setupOrg(currentOrg, thisCase.testCaseID, currentOrg.layoutDirectory)
runningTest = thisCase.actualTest()
if runningTest.crashed != "crashed" #changed this to read the attr_reader isntead of the deleted caseStatus method from TestCase.rb
cleanupOrg(thisCase.testCaseID, currentOrg.layoutDirectory)
end
#threads << Thread.current
}
#count += 1
end
#threads.each do |thisThread|
thisThread.join
end
writeReport($allTestCaseResults)
end
def self.setupOrg(thisOrg, caseID, layoutPath)
begin
thisOrg.logIn
pkg = PackageHandler.new
basicInstalled = "false"
counter = 0
until ((basicInstalled == "true") || (counter == 5))
pkg.basicInstaller()
if Thread.current["tBrowser"].text.include? "You have attempted to access a page"
thisOrg.logIn
else
basicInstalled = "true"
end
counter +=1
end
if !((caseID.include? "bmxb") || (caseID.include? "BMXB"))
moduleInstalled = "false"
counter2 = 0
until ((moduleInstalled == "true") || (counter == 5))
pkg.packageInstaller(caseID)
if Thread.current["tBrowser"].text.include? "You have attempted to access a page"
thisOrg.logIn
else
moduleInstalled = "true"
end
counter2 +=1
end
end
installPageLayouts(layoutPath)
rescue
$allTestCaseResults << TestCaseResult.new(caseID, caseID, 1, "SETUP FAILED!" + "<p>#{$!}</p><p>#{$#}</p>").hashEmUp
writeReport($allTestCaseResults)
end
end
def self.cleanupOrg(caseID, layoutPath)
begin
uninstallPageLayouts(layoutPath)
pkg = PackageHandler.new
pkg.packageUninstaller(caseID)
Thread.current["tBrowser"].close
rescue
$allTestCaseResults << TestCaseResult.new(caseID, caseID, 1, "CLEANUP FAILED!" + "<p>#{$!}</p><p>#{$#}</p>").hashEmUp
writeReport($allTestCaseResults)
end
end
end
The output it's generating is:
working one
working one
working one
It's not opening a browser or doing any of the subsequent code.
It looks like the code is having the problem mentioned in the Thread class documentation:
If we don't call thr.join before the main thread terminates, then all
other threads including thr will be killed.
Basically your main thread is finishing pretty instantaneously. However, the threads, which create browsers, take a lot longer than that. As result the threads get terminated before the browser opens.
By adding a long sleep at the end, you can see that your browsers can be opened by your code:
require 'watir-webdriver'
$chunkythread = ["A", "B", "C"]
$chunkythread.each do |z|
puts "pshaw"
Thread.new{
Thread.current["testwords"] = "ohai " + z.to_s
Thread.current["myBrowser"] = Watir::Browser.new :ff
puts Thread.current["testwords"] }
end
sleep(300)
However, for more reliability, you should join all the threads at the end:
require 'watir-webdriver'
threads = []
$chunkythread = ["A", "B", "C"]
$chunkythread.each do |z|
puts "pshaw"
threads << Thread.new{
Thread.current["testwords"] = "ohai " + z.to_s
Thread.current["myBrowser"] = Watir::Browser.new :ff
puts Thread.current["testwords"] }
end
threads.each { |thr| thr.join }
For the actual code example, putting #threads << Thread.current will not work. The join will be evaluating like #threads is empty. You could try doing the following:
$testCaseArray.each do |thisCase|
#threads << Thread.new {
puts "working one"
Thread.current["tBrowser"] = Watir::Browser.new :ff
# Do your other thread stuff
}
$alphabet[#count] = #threads.last
#count += 1
end
#threads.each do |thisThread|
thisThread.join
end
Note that I am not sure why you want to store the threads in $alphabet. I put in the $alphabet[#count] = #threads.last, but could be removed if not in use.
I uninstalled Watir 5.0.0 and installed Watir 4.0.2, and now it works fine.

Noisy Webdriver output during automated tests

While running a cucumber-based test, I used the -b commend to get more information on the error. Now it seems that my webdriver will not go back to quiet mode.
Here's my support file:
require 'capybara'
require 'capybara/cucumber'
require 'rspec'
require 'selenium/webdriver'
#require 'capybara/rails'
def snore(location)
x = 0
timeout = 120
while (page.has_css?(location) == false) && (x < timeout)
sleep(1)
x = x + 1
puts x
puts page.has_css?(location)
end
end
def eventday
now = Time.now
today = 0
if now.day.to_i > 27
today = 15
else
today = now.day.to_s
end
return today.to_s
end
def monthup
now = Time.now
monthtime = 0
if now.day.to_i > 27
monthtime = 1500000
else
monthtime = 3000000
end
return monthtime.to_i
end
caps = Selenium::WebDriver::Remote::Capabilities.chrome #chrome|firefox|internet_explorer
#caps.version = "8"
#caps.platform = :WINDOWS
Capybara.server_port = 3001
Capybara.app_host = "http://www.google.com"
Capybara.default_driver = :selenium
Capybara.ignore_hidden_elements = true
Capybara.register_driver :selenium do |app|
Capybara::Selenium::Driver.new(app,
:browser => :chrome #chrome|firefox|internet_explorer
#,
#:url => "localhost:4444/wd/hub",
#:desired_capabilities => ("chrome.binary", "/usr/lib/chromium-browser/chromium-browser")
)
end
Here's some of the output I'm seeing:
[8.261][INFO]: received WebDriver request: POST /session/1bdb4fe1ae6d3bef1f6e4299c3b3/url
"url": "http://example.org"
}
[8.267][INFO]: waiting for pending navigations...
[8.283][INFO]: done waiting for pending navigations
[8.377][INFO]: waiting for pending navigations...
[0703/152133:ERROR:gl_surface_egl.cc(479)] Error: surface has zero area 0 x 0
[0703/152133:ERROR:gl_surface_egl.cc(547)] Failed to resize pbuffer.
[10.866][INFO]: done waiting for pending navigations
[10.866][INFO]: sending WebDriver response: 200 {
"sessionId": "1bdb4fe1ae6d3bef1f6e4299c3b3",
"status": 0,
"value": null

Resources