Repository: bbc/wraith

Issue #444: 'Can't open PhantomJS' error after upgrading PhantomJS from 1.9 to 2.0
Created: 2016-06-29T10:14:41Z
I have been successfully running wraith with PhantomJS 1.9 but when I upgraded PhantomJS to 2.0 I get an error message...
Can't open ''C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/wraith-3.2.0/lib/wraith/javascript/phantom.js''
Nothing else has changed and if I switch back to 1.9 it starts working again.
Output...
D:\wraith>wraith history configs/alpha/individual_history.yaml
DEBUG: #################################################
DEBUG:   Command run:        history configs/alpha/individual_history.yaml
DEBUG:   Wraith version:     3.2.0
DEBUG:   Ruby version:       ruby 2.2.3p173 (2015-08-18 revision 51636) [x64-mingw32]

DEBUG:   ImageMagick:        Version: ImageMagick 6.9.2-7 Q16 x64 2015-11-28 http://www.imagemagick.org

DEBUG:   PhantomJS version:  2.1.1

DEBUG:   CasperJS version:   Couldn't find nor compute phantom.casperPath, exiting.

DEBUG: #################################################
DEBUG:
Config validated. No serious issues found.
Creating Folders
SAVING IMAGES
DEBUG: phantomjs --ignore-ssl-errors=true 'C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/wraith-3.2.0/lib/wraith/javascript/phantom.js' 'https://localhost/web/individual/31621/profile/connections?step=profile_connections_direct' '1024x2000' 'alpha/individual_history_shotsx/profile_connections_direct/1024x2000_phantomjs_alpha2.png' 'body' 'false' 'D:/wraith/javascript/individual.js'
Can't open ''C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/wraith-3.2.0/lib/wraith/javascript/phantom.js''
WARN: Failed to capture image alpha/individual_history_shotsx/profile_connections_direct/1024x2000_phantomjs_alpha2.png on attempt number 1 of 5
Can't open ''C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/wraith-3.2.0/lib/wraith/javascript/phantom.js''
WARN: Failed to capture image alpha/individual_history_shotsx/profile_connections_direct/1024x2000_phantomjs_alpha2.png on attempt number 2 of 5
Can't open ''C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/wraith-3.2.0/lib/wraith/javascript/phantom.js''
WARN: Failed to capture image alpha/individual_history_shotsx/profile_connections_direct/1024x2000_phantomjs_alpha2.png on attempt number 3 of 5
Can't open ''C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/wraith-3.2.0/lib/wraith/javascript/phantom.js''
WARN: Failed to capture image alpha/individual_history_shotsx/profile_connections_direct/1024x2000_phantomjs_alpha2.png on attempt number 4 of 5
Can't open ''C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/wraith-3.2.0/lib/wraith/javascript/phantom.js''
WARN: Failed to capture image alpha/individual_history_shotsx/profile_connections_direct/1024x2000_phantomjs_alpha2.png on attempt number 5 of 5
ERROR: Unable to capture image alpha/individual_history_shotsx/profile_connections_direct/1024x2000_phantomjs_alpha2.png after 5 attempt(s)
WARN: Using fallback image instead

Config...
phantomjs_options: "--ignore-ssl-errors=true"

verbose: true

browser: "phantomjs"

mode: diffs_first

# Type the name of the directory that shots will be stored in
directory: 'alpha/individual_history_shotsx'  
history_dir: 'alpha/individual_history_shots_basex'

  # we've deliberately left out the snap_file

# Add only 2 domains, key will act as a label
domains:
  alpha2: "https://localhost/web"


#Type screen widths below, here are a couple of examples
screen_widths:
  - 1024x2000

#Type page URL paths below, here are a couple of examples
paths:
   profile_connections_direct:
     path: /individual/31621/profile/connections?step=profile_connections_direct
     before_capture: 'javascript/individual.js' 

#Amount of fuzz ImageMagick will use
fuzz: '20%'

Duplicate issue #475: Can't open ''C:/Ruby23/lib/ruby/gems/2.3.0/gems/wraith-3.2.1/lib/wraith/javascript/phantom.js"
Created: 2016-10-13T13:45:24Z
I keep getting this error when I run wraith history
Can't open ''C:/Ruby23/lib/ruby/gems/2.3.0/gems/wraith-3.2.1/lib/wraith/javascript/phantom.js''


Reporting a problem? Please describe the issue above, and complete the following checklist so that we can help you more quickly.
Issue checklist:

 I have validated my config file against YAML Validator to make sure it is valid YAML.
 I have run the command in verbose mode (by adding verbose: true to my config) and pasted the output below:

Can't open ''C:/Ruby23/lib/ruby/gems/2.3.0/gems/wraith-3.2.1/lib/wraith/javascript/phantom.js''
Can't open ''C:/Ruby23/lib/ruby/gems/2.3.0/gems/wraith-3.2.1/lib/wraith/javascript/phantom.js''
Can't open ''C:/Ruby23/lib/ruby/gems/2.3.0/gems/wraith-3.2.1/lib/wraith/javascript/phantom.js''
Can't open ''C:/Ruby23/lib/ruby/gems/2.3.0/gems/wraith-3.2.1/lib/wraith/javascript/phantom.js''
Can't open ''C:/Ruby23/lib/ruby/gems/2.3.0/gems/wraith-3.2.1/lib/wraith/javascript/phantom.js''
Can't open ''C:/Ruby23/lib/ruby/gems/2.3.0/gems/wraith-3.2.1/lib/wraith/javascript/phantom.js''
Can't open ''C:/Ruby23/lib/ruby/gems/2.3.0/gems/wraith-3.2.1/lib/wraith/javascript/phantom.js''
Can't open ''C:/Ruby23/lib/ruby/gems/2.3.0/gems/wraith-3.2.1/lib/wraith/javascript/phantom.js''
Can't open ''C:/Ruby23/lib/ruby/gems/2.3.0/gems/wraith-3.2.1/lib/wraith/javascript/phantom.js''
Can't open ''C:/Ruby23/lib/ruby/gems/2.3.0/gems/wraith-3.2.1/lib/wraith/javascript/phantom.js''
Can't open ''C:/Ruby23/lib/ruby/gems/2.3.0/gems/wraith-3.2.1/lib/wraith/javascript/phantom.js''
Can't open ''C:/Ruby23/lib/ruby/gems/2.3.0/gems/wraith-3.2.1/lib/wraith/javascript/phantom.js''
Can't open ''C:/Ruby23/lib/ruby/gems/2.3.0/gems/wraith-3.2.1/lib/wraith/javascript/phantom.js''
Can't open ''C:/Ruby23/lib/ruby/gems/2.3.0/gems/wraith-3.2.1/lib/wraith/javascript/phantom.js''
Can't open ''C:/Ruby23/lib/ruby/gems/2.3.0/gems/wraith-3.2.1/lib/wraith/javascript/phantom.js''
Can't open ''C:/Ruby23/lib/ruby/gems/2.3.0/gems/wraith-3.2.1/lib/wraith/javascript/phantom.js''
Can't open ''C:/Ruby23/lib/ruby/gems/2.3.0/gems/wraith-3.2.1/lib/wraith/javascript/phantom.js''
Can't open ''C:/Ruby23/lib/ruby/gems/2.3.0/gems/wraith-3.2.1/lib/wraith/javascript/phantom.js''
Can't open ''C:/Ruby23/lib/ruby/gems/2.3.0/gems/wraith-3.2.1/lib/wraith/javascript/phantom.js''
Can't open ''C:/Ruby23/lib/ruby/gems/2.3.0/gems/wraith-3.2.1/lib/wraith/javascript/phantom.js''
Can't open ''C:/Ruby23/lib/ruby/gems/2.3.0/gems/wraith-3.2.1/lib/wraith/javascript/phantom.js''
Can't open ''C:/Ruby23/lib/ruby/gems/2.3.0/gems/wraith-3.2.1/lib/wraith/javascript/phantom.js''
Can't open ''C:/Ruby23/lib/ruby/gems/2.3.0/gems/wraith-3.2.1/lib/wraith/javascript/phantom.js''
Can't open ''C:/Ruby23/lib/ruby/gems/2.3.0/gems/wraith-3.2.1/lib/wraith/javascript/phantom.js''
Can't open ''C:/Ruby23/lib/ruby/gems/2.3.0/gems/wraith-3.2.1/lib/wraith/javascript/phantom.js''
DEBUG: #################################################
DEBUG:   Command run:        history configs/history.yaml
DEBUG:   Wraith version:     3.2.1
DEBUG:   Ruby version:       ruby 2.3.1p112 (2016-04-26 revision 54768) [i386-mingw32]

DEBUG:   ImageMagick:        Version: ImageMagick 7.0.3-4 Q16 x64 2016-10-10 http://www.imagemagick.org

DEBUG:   PhantomJS version:  2.1.1

DEBUG:   CasperJS version:   1.1.2

DEBUG: #################################################
DEBUG:
Config validated. No serious issues found.
Creating Folders
SAVING IMAGES
DEBUG: phantomjs  'C:/Ruby23/lib/ruby/gems/2.3.0/gems/wraith-3.2.1/lib/wraith/javascript/phantom.js' 'http://www.bbc.co.uk/' '320' 'shots/home/320_phantomjs_english.png' 'body' 'false' 'false'
DEBUG: phantomjs  'C:/Ruby23/lib/ruby/gems/2.3.0/gems/wraith-3.2.1/lib/wraith/javascript/phantom.js' 'http://www.bbc.co.uk/' '600x768' 'shots/home/600x768_phantomjs_english.png' 'body' 'false' 'false'
DEBUG: phantomjs  'C:/Ruby23/lib/ruby/gems/2.3.0/gems/wraith-3.2.1/lib/wraith/javascript/phantom.js' 'http://www.bbc.co.uk/' '768' 'shots/home/768_phantomjs_english.png' 'body' 'false' 'false'
DEBUG: phantomjs  'C:/Ruby23/lib/ruby/gems/2.3.0/gems/wraith-3.2.1/lib/wraith/javascript/phantom.js' 'http://www.bbc.co.uk/' '1024' 'shots/home/1024_phantomjs_english.png' 'body' 'false' 'false'
DEBUG: phantomjs  'C:/Ruby23/lib/ruby/gems/2.3.0/gems/wraith-3.2.1/lib/wraith/javascript/phantom.js' 'http://www.bbc.co.uk/' '1280' 'shots/home/1280_phantomjs_english.png' 'body' 'false' 'false'
WARN: Failed to capture image shots/home/600x768_phantomjs_english.png on attempt number 1 of 5
WARN: Failed to capture image shots/home/1024_phantomjs_english.png on attempt number 1 of 5
WARN: Failed to capture image shots/home/1280_phantomjs_english.png on attempt number 1 of 5
WARN: Failed to capture image shots/home/768_phantomjs_english.png on attempt number 1 of 5
WARN: Failed to capture image shots/home/320_phantomjs_english.png on attempt number 1 of 5
WARN: Failed to capture image shots/home/600x768_phantomjs_english.png on attempt number 2 of 5
WARN: Failed to capture image shots/home/320_phantomjs_english.png on attempt number 2 of 5
WARN: Failed to capture image shots/home/768_phantomjs_english.png on attempt number 2 of 5
WARN: Failed to capture image shots/home/1024_phantomjs_english.png on attempt number 2 of 5
WARN: Failed to capture image shots/home/1280_phantomjs_english.png on attempt number 2 of 5
WARN: Failed to capture image shots/home/600x768_phantomjs_english.png on attempt number 3 of 5
WARN: Failed to capture image shots/home/768_phantomjs_english.png on attempt number 3 of 5
WARN: Failed to capture image shots/home/320_phantomjs_english.png on attempt number 3 of 5
WARN: Failed to capture image shots/home/1024_phantomjs_english.png on attempt number 3 of 5
WARN: Failed to capture image shots/home/600x768_phantomjs_english.png on attempt number 4 of 5
WARN: Failed to capture image shots/home/1280_phantomjs_english.png on attempt number 3 of 5
WARN: Failed to capture image shots/home/320_phantomjs_english.png on attempt number 4 of 5
WARN: Failed to capture image shots/home/768_phantomjs_english.png on attempt number 4 of 5
WARN: Failed to capture image shots/home/1024_phantomjs_english.png on attempt number 4 of 5
WARN: Failed to capture image shots/home/600x768_phantomjs_english.png on attempt number 5 of 5
ERROR: Unable to capture image shots/home/600x768_phantomjs_english.png after 5 attempt(s)
WARN: Using fallback image instead
WARN: Failed to capture image shots/home/1280_phantomjs_english.png on attempt number 4 of 5
WARN: Failed to capture image shots/home/320_phantomjs_english.png on attempt number 5 of 5
ERROR: Unable to capture image shots/home/320_phantomjs_english.png after 5 attempt(s)
WARN: Using fallback image instead
WARN: Failed to capture image shots/home/768_phantomjs_english.png on attempt number 5 of 5
ERROR: Unable to capture image shots/home/768_phantomjs_english.png after 5 attempt(s)
WARN: Using fallback image instead
WARN: Failed to capture image shots/home/1024_phantomjs_english.png on attempt number 5 of 5
ERROR: Unable to capture image shots/home/1024_phantomjs_english.png after 5 attempt(s)
WARN: Using fallback image instead
WARN: Failed to capture image shots/home/1280_phantomjs_english.png on attempt number 5 of 5
ERROR: Unable to capture image shots/home/1280_phantomjs_english.png after 5 attempt(s)
WARN: Using fallback image instead



 I have pasted the contents of my config file below:

##############################################################
##############################################################
# This is an example configuration provided by Wraith.
# Feel free to amend for your own requirements.
# ---
# This particular config is intended to demonstrate how
# to use Wraith in 'history' mode, which is best suited to
# making sure your site's appearance remains consistent over
# time.
#
# `wraith history history.yaml` # generate base screenshots
# `wraith latest history.yaml`  # take new shots and compare
#
##############################################################
##############################################################

# (required) The engine to run Wraith with. Examples: 'phantomjs', 'casperjs', 'slimerjs'
browser: "phantomjs"

# (required) The domain to take screenshots of.
domains:
  english: "http://www.bbc.co.uk"

# (required) The paths to capture. This particular config is using casperjs, so we can take screenshots of selectors rather than the entire page.
paths:
  home: /

# (required) Screen widths (and optional height) to resize the browser to before taking the screenshot.
screen_widths:
  - 320
  - 600x768
  - 768
  - 1024
  - 1280

# (required for history mode, otherwise optional) The directory that your base screenshots will be stored in.
history_dir: 'shots_base'

# (required) The directory that your latest screenshots will be stored in
directory: 'shots'

# (required) Amount of fuzz ImageMagick will use when comparing images. A higher fuzz makes the comparison less strict.
fuzz: '20%'

# (optional) The maximum acceptable level of difference (in %) between two images before Wraith reports a failure. Default: 0
threshold: 5

# (optional) Choose which results are displayed in the gallery, and in what order. Default: alphanumeric
# Options:
#   alphanumeric - all paths (with or without a difference) are shown, sorted by path
#   diffs_first - all paths (with or without a difference) are shown, sorted by difference size (largest first)
#   diffs_only - only paths with a difference are shown, sorted by difference size (largest first)
# Note: different screen widths are always grouped together.
mode: diffs_first

# (optional) Choose to run Wraith in verbose mode, for easier debugging. Default: false
verbose: true

# (optional) Color to highlight the image diff. Default: 'blue'
highlight_color: red

Closing comment (2016-10-13T16:53:33Z): Thanks for raising this issue - it is a duplicate of #444, and can hopefully be fixed for the time being by downgrading to PhantomJS 1.9.