13
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

RSpec実行時にCapybara::NotSupportedByDriverErrorエラーが出るとき→js: trueになっているかを確認する

Posted at

RSpecを実行したら下記のようなエラーが出た場合。

     Failure/Error: page.save_screenshot('test.png')

     Capybara::NotSupportedByDriverError:
       Capybara::Driver::Base#save_screenshot

     # /usr/local/bundle/gems/capybara-3.29.0/lib/capybara/driver/base.rb:51:in `save_screenshot'
     # /usr/local/bundle/gems/capybara-3.29.0/lib/capybara/session.rb:724:in `block in save_screenshot'
     # /usr/local/bundle/gems/capybara-3.29.0/lib/capybara/session.rb:724:in `tap'
     # /usr/local/bundle/gems/capybara-3.29.0/lib/capybara/session.rb:724:in `save_screenshot'

js: trueになっているかを確認。

RSpec.describe 'XXX', type: :system do
RSpec.describe 'XXX', js: true, type: :system do

ここが抜けていたためエラーになっていました。
地味な見落としでした。

js: trueにすることで、Capybara.javascript_driver(デフォルトでは:selenium)が利用されます。

13
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?