Cannot do save_screenshot give NotSupportedByDriver in Capybara/Poltergeist
Asked Answered
R

1

10

I am running Capybara with Poltergeist and I have a step:

Given(/^take a screenshot$/) do
  page.save_screenshot("/tmp/page.png", :full => true)
end

And it keeps saying:

Capybara::Driver::Base#save_screenshot (Capybara::NotSupportedByDriverError)
./features/step_definitions/job_steps.rb:19:in `/^take a screenshot$/'
features/jobs_board/user_management.feature:9:in `And take a screenshot'

Any ideas where to look? My config in env.rb looks like this:

Capybara.javascript_driver = :poltergeist
Capybara.current_driver = :poltergeist
Roquefort answered 20/1, 2014 at 15:27 Comment(0)
R
20

Figured it out. I needed to add:

Capybara.default_driver = :poltergeist 

And change

require 'poltergeist'

to

require 'capybara/poltergeist'
Roquefort answered 20/1, 2014 at 16:13 Comment(1)
i had problems in mac os x and had to use Capybara.javascript_driver = :poltergeist, then some version update (not sure which), meant i had to duse Capybara.default_driver = :poltergeistViglione

© 2022 - 2024 — McMap. All rights reserved.