Skip to content
This repository has been archived by the owner on Nov 27, 2020. It is now read-only.
This repository has been archived by the owner on Nov 27, 2020. It is now read-only.

Error with page.driver.debug #47

Closed
gmile opened this issue Apr 18, 2012 · 2 comments
Closed

Error with page.driver.debug #47

gmile opened this issue Apr 18, 2012 · 2 comments
Labels

Comments

@gmile
Copy link

gmile commented Apr 18, 2012

I have an issue using page.driver.debug in my tests.

I double-checked if I am providing an inspector: true key-value pair to the test. Here's what it looks like (though not sure how this might help):

scenario 'User removes product from favorites', js: true, inspector: true do
  favorite = Factory :favorite, user: user

  visit("/products/#{favorite.variant.permalink}/")

  click_link 'Remove from favorites'

  page.should     have_content('Add to favorites')
  page.should_not have_content('Remove from favorites')
end

And here's an error:

Failure/Error: page.driver.debug
     NoMethodError:
       private method `open' called for nil:NilClass
     # /home/gmile/.rvm/gems/ruby-1.9.3-p125@christ/gems/poltergeist-0.6.0/lib/capybara/poltergeist/driver.rb:107:in `debug'
     # ... the rest of stack trace is related to rspec and app specific files ...

I will be providing any additional info if needed.

P.S. just in case this might be a relevant info: I am using Ubuntu 11.10 and phantomjs 1.5

@jonleighton
Copy link
Contributor

You need to setup Poltergeist with inspector: true, not provide it as metadata to your RSpec test. Example:

Capybara.register_driver :poltergeist do |app|
  Capybara::Poltergeist::Driver.new(app, inspector: true)
end

However, probably we should raise an error if someone calls page.driver.debug if the driver wasn't started with inspector: true, so I'll leave this open to track that.

@dnesteryuk
Copy link
Contributor

Added this pull request to show more clear error in this case:

#119

tricknotes pushed a commit to tricknotes/poltergeist that referenced this issue Dec 6, 2013
I would like to clarify how to enable the debug mode.
At first was adding a :inspector => true meta tag to my examples.
I've found the answer in this issue
teampoltergeist#47

At least one person more made the same mistake, so maybe its useful.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants