bbc / wraith

Wraith — A responsive screenshot comparison tool

Home Page:http://bbc-news.github.io/wraith/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`resize': undefined method `[]' for nil:NilClass (NoMethodError)

bartlangelaan opened this issue · comments

I can't get Wraith to work. :'-(

My config looks like the following:

browser: "phantomjs"
verbose: true
domains:
  - "http://www.example.com"
  - "http://www.example.nl"
paths:
  - "%2F"
directory: "shots/hero-master/hero_nl"

Results:

Ruby 2.4 (latest)

$ wraith capture ./wraith-queue/hero_nl.yml
DEBUG: #################################################
DEBUG:   Command run:        capture ./wraith-queue/hero_nl.yml
DEBUG:   Wraith version:     4.0.0
DEBUG:   Ruby version:       ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]
DEBUG:   ImageMagick:        Version: ImageMagick 6.8.9-9 Q16 x86_64 2016-11-26 http://www.imagemagick.org
DEBUG:   PhantomJS version:  2.1.1
DEBUG:   CasperJS version:   1.1.1
DEBUG: #################################################
Config validated. No serious issues found.
Creating Folders
SAVING IMAGES
/usr/local/bundle/gems/wraith-4.0.0/lib/wraith/helpers/capture_options.rb:22:in `resize': undefined method `[]' for nil:NilClass (NoMethodError)
        from /usr/local/bundle/gems/wraith-4.0.0/lib/wraith/save_images.rb:38:in `block in define_jobs'
        from /usr/local/bundle/gems/wraith-4.0.0/lib/wraith/save_images.rb:35:in `each'
        from /usr/local/bundle/gems/wraith-4.0.0/lib/wraith/save_images.rb:35:in `define_jobs'
        from /usr/local/bundle/gems/wraith-4.0.0/lib/wraith/save_images.rb:29:in `save_images'
        from /usr/local/bundle/gems/wraith-4.0.0/lib/wraith/cli.rb:78:in `block in save_images'
        from /usr/local/bundle/gems/wraith-4.0.0/lib/wraith/helpers/utilities.rb:4:in `within_acceptable_limits'
        from /usr/local/bundle/gems/wraith-4.0.0/lib/wraith/cli.rb:75:in `save_images'
        from /usr/local/bundle/gems/wraith-4.0.0/lib/wraith/cli.rb:124:in `block in capture'
        from /usr/local/bundle/gems/wraith-4.0.0/lib/wraith/helpers/utilities.rb:4:in `within_acceptable_limits'
        from /usr/local/bundle/gems/wraith-4.0.0/lib/wraith/cli.rb:120:in `capture'
        from /usr/local/bundle/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
        from /usr/local/bundle/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
        from /usr/local/bundle/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
        from /usr/local/bundle/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
        from /usr/local/bundle/gems/wraith-4.0.0/bin/wraith:5:in `<top (required)>'
        from /usr/local/bundle/bin/wraith:22:in `load'
        from /usr/local/bundle/bin/wraith:22:in `<main>'

Ruby 2.2

$ wraith capture ./wraith-queue/hero_nl.yml
DEBUG: #################################################
DEBUG:   Command run:        capture ./wraith-queue/hero_nl.yml
DEBUG:   Wraith version:     4.0.0
DEBUG:   Ruby version:       ruby 2.2.6p396 (2016-11-15 revision 56800) [x86_64-linux]
DEBUG:   ImageMagick:        Version: ImageMagick 6.8.9-9 Q16 x86_64 2016-11-26 http://www.imagemagick.org
DEBUG:   PhantomJS version:  2.1.1
DEBUG:   CasperJS version:   1.1.1
DEBUG: #################################################
Config validated. No serious issues found.
Creating Folders
SAVING IMAGES
/usr/local/bundle/gems/wraith-4.0.0/lib/wraith/helpers/capture_options.rb:22:in `resize': undefined method `[]' for nil:NilClass (NoMethodError)
        from /usr/local/bundle/gems/wraith-4.0.0/lib/wraith/save_images.rb:38:in `block in define_jobs'
        from /usr/local/bundle/gems/wraith-4.0.0/lib/wraith/save_images.rb:35:in `each'
        from /usr/local/bundle/gems/wraith-4.0.0/lib/wraith/save_images.rb:35:in `define_jobs'
        from /usr/local/bundle/gems/wraith-4.0.0/lib/wraith/save_images.rb:29:in `save_images'
        from /usr/local/bundle/gems/wraith-4.0.0/lib/wraith/cli.rb:78:in `block in save_images'
        from /usr/local/bundle/gems/wraith-4.0.0/lib/wraith/helpers/utilities.rb:4:in `within_acceptable_limits'
        from /usr/local/bundle/gems/wraith-4.0.0/lib/wraith/cli.rb:75:in `save_images'
        from /usr/local/bundle/gems/wraith-4.0.0/lib/wraith/cli.rb:124:in `block in capture'
        from /usr/local/bundle/gems/wraith-4.0.0/lib/wraith/helpers/utilities.rb:4:in `within_acceptable_limits'
        from /usr/local/bundle/gems/wraith-4.0.0/lib/wraith/cli.rb:120:in `capture'
        from /usr/local/bundle/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
        from /usr/local/bundle/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
        from /usr/local/bundle/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
        from /usr/local/bundle/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
        from /usr/local/bundle/gems/wraith-4.0.0/bin/wraith:5:in `<top (required)>'
        from /usr/local/bundle/bin/wraith:22:in `load'
        from /usr/local/bundle/bin/wraith:22:in `<main>'

Ruby 2.1.2

$ wraith capture ./wraith-queue/hero_nl.yml
DEBUG: #################################################
DEBUG:   Command run:        capture ./wraith-queue/hero_nl.yml
DEBUG:   Wraith version:     4.0.0
DEBUG:   Ruby version:       ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
DEBUG:   ImageMagick:        Version: ImageMagick 6.7.7-10 2014-08-15 Q16 http://www.imagemagick.org
DEBUG:   PhantomJS version:  2.1.1
DEBUG:   CasperJS version:   1.1.1
DEBUG: #################################################
Config validated. No serious issues found.
Creating Folders
SAVING IMAGES
/usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.0/lib/wraith/helpers/capture_options.rb:22:in `resize': undefined method `[]' for nil:NilClass (NoMethodError)
        from /usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.0/lib/wraith/save_images.rb:38:in `block in define_jobs'
        from /usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.0/lib/wraith/save_images.rb:35:in `each'
        from /usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.0/lib/wraith/save_images.rb:35:in `define_jobs'
        from /usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.0/lib/wraith/save_images.rb:29:in `save_images'
        from /usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.0/lib/wraith/cli.rb:78:in `block in save_images'
        from /usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.0/lib/wraith/helpers/utilities.rb:4:in `within_acceptable_limits'
        from /usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.0/lib/wraith/cli.rb:75:in `save_images'
        from /usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.0/lib/wraith/cli.rb:124:in `block in capture'
        from /usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.0/lib/wraith/helpers/utilities.rb:4:in `within_acceptable_limits'
        from /usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.0/lib/wraith/cli.rb:120:in `capture'
        from /usr/local/lib/ruby/gems/2.1.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
        from /usr/local/lib/ruby/gems/2.1.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
        from /usr/local/lib/ruby/gems/2.1.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
        from /usr/local/lib/ruby/gems/2.1.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
        from /usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.0/bin/wraith:5:in `<top (required)>'
        from /usr/local/bin/wraith:23:in `load'
        from /usr/local/bin/wraith:23:in `<main>'

Official docker image

$ docker run -v $(pwd):/vtm bbcnews/wraith capture ./vtm/wraith-queue/hero_nl.yml
DEBUG: #################################################
DEBUG:   Command run:        capture ./vtm/wraith-queue/hero_nl.yml
DEBUG:   Wraith version:     4.0.0
DEBUG:   Ruby version:       ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
DEBUG:   ImageMagick:        Version: ImageMagick 6.8.9-9 Q16 x86_64 2016-11-26 http://www.imagemagick.org
DEBUG:   PhantomJS version:  2.1.1
DEBUG:   CasperJS version:   1.1.1
DEBUG: #################################################
Config validated. No serious issues found.
Creating Folders
SAVING IMAGES
/usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.0/lib/wraith/helpers/capture_options.rb:22:in `resize': undefined method `[]' for nil:NilClass (NoMethodError)
        from /usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.0/lib/wraith/save_images.rb:38:in `block in define_jobs'
        from /usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.0/lib/wraith/save_images.rb:35:in `each'
        from /usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.0/lib/wraith/save_images.rb:35:in `define_jobs'
        from /usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.0/lib/wraith/save_images.rb:29:in `save_images'
        from /usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.0/lib/wraith/cli.rb:78:in `block in save_images'
        from /usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.0/lib/wraith/helpers/utilities.rb:4:in `within_acceptable_limits'
        from /usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.0/lib/wraith/cli.rb:75:in `save_images'
        from /usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.0/lib/wraith/cli.rb:124:in `block in capture'
        from /usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.0/lib/wraith/helpers/utilities.rb:4:in `within_acceptable_limits'
        from /usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.0/lib/wraith/cli.rb:120:in `capture'
        from /usr/local/lib/ruby/gems/2.1.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
        from /usr/local/lib/ruby/gems/2.1.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
        from /usr/local/lib/ruby/gems/2.1.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
        from /usr/local/lib/ruby/gems/2.1.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
        from /usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.0/bin/wraith:5:in `<top (required)>'
        from /usr/local/bin/wraith:23:in `load'
        from /usr/local/bin/wraith:23:in `<main>'

Ignore this message. There was more then one fault in my config yaml file.

Maybe it's an idea to show more useful error messages if there is an incorrect formatting of the domains, or the paths? Makes this a lot more user-friendly 👍 :-)

Closing this issue.

What was the issue? I'm getting this error.

Also, I'm getting this line:

Config validated. No serious issues found.

I figured out my problem.

The configs/history.yaml came with this stanza out of the box:

# (required) The paths to capture. This particular config is using casperjs, so we can take screenshots of selectors rather than the entire page.
paths:
  clickable_guide:
    path: /news/entertainment-arts-27221191
    selector: '.idt__news' # (optional) selector to take a screenshot of

However, when I changed it to this, it caused the error:

# (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_page:
    path: /

Changing it to this stopped the error:

paths:
  home-page: /