capybara-screenshot
capybara-screenshot copied to clipboard
screenshot_and_save_page only creating the html file in cucumber
My screenshot_and_save_page is only creating the html file. Doing nothing special in the cucumber test just calling that method.
maybe somebody has a solution.
You're not using a JavaScript driver so no image screenshot. Tag your scenario with @javascript, install a driver like selenium or poltergeist and you'll get your image :)
Any solution here? I'm using rspec and capybara-screenshot and not doing anything particularly special and only getting the html output.
For me, the issue was how I was registering drivers. This eventually put me on the right path: https://github.com/mattheworiordan/capybara-screenshot/issues/211#issuecomment-321857907
require "spec_helper"
require "rspec/rails"
require "selenium-webdriver"
require "capybara/rspec"
require "capybara-screenshot/rspec"
Capybara.register_driver :selenium do |app|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
chromeOptions: { args: %w(headless disable-gpu) }
)
Capybara::Selenium::Driver.new app,
browser: :chrome,
desired_capabilities: capabilities
end
Capybara.javascript_driver = :selenium
Sorry for the delay @alexbannon. Does this issue only happen with headless chrome then? If you are able to provide me with a reproducible bit of code (i.e. ideally a simple app), then I can drop in this gem and work on a more permanent fix.
If so, this is the same issue as https://github.com/mattheworiordan/capybara-screenshot/issues/211 right?
Yep looks like it's the same. Feel free to close as a duplicate.