Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capybara always want Selenium #2783

Open
chmich opened this issue Oct 26, 2024 · 0 comments
Open

Capybara always want Selenium #2783

chmich opened this issue Oct 26, 2024 · 0 comments

Comments

@chmich
Copy link

chmich commented Oct 26, 2024

Note: This is for issues with Capybara. If you have a howto type question, please ask on the mailing list as requested in the README: http://groups.google.com/group/ruby-capybara

Meta

Capybara Version: 3.40
Driver: Playwright

Expected Behavior

Capybara.default_driver = :any-other-than-selenium should switch-off Selenium, like described in the docs. More Details are on a playwright-issue.

I want to get rid of Selenium because it is slowing down my tests. See Results on my last comments.

Actual Behavior

/bin/zsh -c "bash -c '/Users/christian/.rvm/bin/rvm ruby-3.2.2@ad-playwright do /Users/christian/.rvm/rubies/ruby-3.2.2/bin/ruby -x /Users/christian/projects/Finitia/arc_digital/bin/bundle exec /Users/christian/.rvm/rubies/ruby-3.2.2/bin/ruby /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/bin/rspec /Users/christian/projects/Finitia/arc_digital/spec/system/playwright_projects_spec.rb --require teamcity/spec/runner/formatter/teamcity/formatter --format Spec::Runner::Formatter::TeamcityFormatter --example '\"'\"'pw example can browse'\"'\"''"
Testing started at 11:52 ...
Run options: include {:full_description=>/pw\ example\ can\ browse/}

Randomized with seed 45554

RSpec::Core::MultipleExceptionError: cannot load such file -- selenium/webdriver

undefined method `save_screenshot' for #<Playwright::Page:0x000000011c3fb278 @impl=#<page@d131ed63e4da7c8c551f38cabb9e4b45>, @capybara_all_responses={}, @capybara_last_response=nil, @capybara_frames=[], @event_emitter_proxy=#<Playwright::EventEmitterProxy:0x000000011c3fafd0 @api=#<Playwright::Page:0x000000011c3fb278 ...>, @impl=#<page@d131ed63e4da7c8c551f38cabb9e4b45>, @listeners={"dialog"=>#<Proc:0x000000011c3fad50 /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/playwright-ruby-client-1.47.0/lib/playwright/event_emitter_proxy.rb:35 (lambda)>, "download"=>#<Proc:0x000000011c3f8cf8 /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/playwright-ruby-client-1.47.0/lib/playwright/event_emitter_proxy.rb:35 (lambda)>, "response"=>#<Proc:0x000000011c3f87a8 /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/playwright-ruby-client-1.47.0/lib/playwright/event_emitter_proxy.rb:35 (lambda)>, "framenavigated"=>#<Proc:0x000000011c3f6098 /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/playwright-ruby-client-1.47.0/lib/playwright/event_emitter_proxy.rb:35 (lambda)>, "load"=>#<Proc:0x000000011c3f5c38 /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/playwright-ruby-client-1.47.0/lib/playwright/event_emitter_proxy.rb:35 (lambda)>}, @__event_emitter={"dialog"=>#<Set: {#<Playwright::EventEmitterCallback:0x000000011c3f8ff0 @proc=#<Proc:0x000000011c3fb098 /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/capybara-playwright-driver-0.5.2/lib/capybara/playwright/page.rb:20 (lambda)>>}>, "download"=>#<Set: {#<Playwright::EventEmitterCallback:0x000000011c3f8960 @proc=#<Proc:0x000000011c3f8f28 /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/capybara-playwright-driver-0.5.2/lib/capybara/playwright/page.rb:23 (lambda)>>}>, "response"=>#<Set: {#<Playwright::EventEmitterCallback:0x000000011c3f63e0 @proc=#<Proc:0x000000011c3f88c0 /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/capybara-playwright-driver-0.5.2/lib/capybara/playwright/page.rb:29 (lambda)>>}>, "framenavigated"=>#<Set: {#<Playwright::EventEmitterCallback:0x000000011c3f5e90 @proc=#<Proc:0x000000011c3f6250 /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/capybara-playwright-driver-0.5.2/lib/capybara/playwright/page.rb:32 (lambda)>>}>, "load"=>#<Set: {#<Playwright::EventEmitterCallback:0x000000011c3f5a80 @proc=#<Proc:0x000000011c3f5da0 /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/capybara-playwright-driver-0.5.2/lib/capybara/playwright/page.rb:35 (lambda)>>}>}, @__event_emitter_callback={"dialog/74300"=>#<Playwright::EventEmitterCallback:0x000000011c3f8ff0 @proc=#<Proc:0x000000011c3fb098 /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/capybara-playwright-driver-0.5.2/lib/capybara/playwright/page.rb:20 (lambda)>>, "download/74380"=>#<Playwright::EventEmitterCallback:0x000000011c3f8960 @proc=#<Proc:0x000000011c3f8f28 /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/capybara-playwright-driver-0.5.2/lib/capybara/playwright/page.rb:23 (lambda)>>, "response/74460"=>#<Playwright::EventEmitterCallback:0x000000011c3f63e0 @proc=#<Proc:0x000000011c3f88c0 /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/capybara-playwright-driver-0.5.2/lib/capybara/playwright/page.rb:29 (lambda)>>, "framenavigated/74540"=>#<Playwright::EventEmitterCallback:0x000000011c3f5e90 @proc=#<Proc:0x000000011c3f6250 /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/capybara-playwright-driver-0.5.2/lib/capybara/playwright/page.rb:32 (lambda)>>, "load/74620"=>#<Playwright::EventEmitterCallback:0x000000011c3f5a80 @proc=#<Proc:0x000000011c3f5da0 /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/capybara-playwright-driver-0.5.2/lib/capybara/playwright/page.rb:35 (lambda)>>}>>

  0) pw example can browse
     Got 0 failures and 2 other errors:

     0.1) Failure/Error: example.run

          LoadError:
            cannot load such file -- selenium/webdriver
          # /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
          # /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/zeitwerk-2.6.8/lib/zeitwerk/kernel.rb:38:in `require'
          # ./spec/playwright_helper.rb:39:in `block (4 levels) in <top (required)>'
          # /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/playwright-ruby-client-1.47.0/lib/playwright/playwright_api.rb:121:in `block in wrap_block_call'
          # /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/playwright-ruby-client-1.47.0/lib/playwright/channel_owners/browser_type.rb:20:in `launch'
          # /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/playwright-ruby-client-1.47.0/lib/playwright_api/browser_type.rb:109:in `launch'
          # ./spec/playwright_helper.rb:36:in `block (3 levels) in <top (required)>'
          # /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/playwright-ruby-client-1.47.0/lib/playwright.rb:96:in `create'
          # ./spec/playwright_helper.rb:34:in `block (2 levels) in <top (required)>'

     0.2) Failure/Error: example.run

          NoMethodError:
            undefined method `save_screenshot' for #<Playwright::Page:0x000000011c3fb278 @impl=#<page@d131ed63e4da7c8c551f38cabb9e4b45>, @capybara_all_responses={}, @capybara_last_response=nil, @capybara_frames=[], @event_emitter_proxy=#<Playwright::EventEmitterProxy:0x000000011c3fafd0 @api=#<Playwright::Page:0x000000011c3fb278 ...>, @impl=#<page@d131ed63e4da7c8c551f38cabb9e4b45>, @listeners={"dialog"=>#<Proc:0x000000011c3fad50 /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/playwright-ruby-client-1.47.0/lib/playwright/event_emitter_proxy.rb:35 (lambda)>, "download"=>#<Proc:0x000000011c3f8cf8 /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/playwright-ruby-client-1.47.0/lib/playwright/event_emitter_proxy.rb:35 (lambda)>, "response"=>#<Proc:0x000000011c3f87a8 /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/playwright-ruby-client-1.47.0/lib/playwright/event_emitter_proxy.rb:35 (lambda)>, "framenavigated"=>#<Proc:0x000000011c3f6098 /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/playwright-ruby-client-1.47.0/lib/playwright/event_emitter_proxy.rb:35 (lambda)>, "load"=>#<Proc:0x000000011c3f5c38 /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/playwright-ruby-client-1.47.0/lib/playwright/event_emitter_proxy.rb:35 (lambda)>}, @__event_emitter={"dialog"=>#<Set: {#<Playwright::EventEmitterCallback:0x000000011c3f8ff0 @proc=#<Proc:0x000000011c3fb098 /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/capybara-playwright-driver-0.5.2/lib/capybara/playwright/page.rb:20 (lambda)>>}>, "download"=>#<Set: {#<Playwright::EventEmitterCallback:0x000000011c3f8960 @proc=#<Proc:0x000000011c3f8f28 /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/capybara-playwright-driver-0.5.2/lib/capybara/playwright/page.rb:23 (lambda)>>}>, "response"=>#<Set: {#<Playwright::EventEmitterCallback:0x000000011c3f63e0 @proc=#<Proc:0x000000011c3f88c0 /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/capybara-playwright-driver-0.5.2/lib/capybara/playwright/page.rb:29 (lambda)>>}>, "framenavigated"=>#<Set: {#<Playwright::EventEmitterCallback:0x000000011c3f5e90 @proc=#<Proc:0x000000011c3f6250 /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/capybara-playwright-driver-0.5.2/lib/capybara/playwright/page.rb:32 (lambda)>>}>, "load"=>#<Set: {#<Playwright::EventEmitterCallback:0x000000011c3f5a80 @proc=#<Proc:0x000000011c3f5da0 /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/capybara-playwright-driver-0.5.2/lib/capybara/playwright/page.rb:35 (lambda)>>}>}, @__event_emitter_callback={"dialog/74300"=>#<Playwright::EventEmitterCallback:0x000000011c3f8ff0 @proc=#<Proc:0x000000011c3fb098 /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/capybara-playwright-driver-0.5.2/lib/capybara/playwright/page.rb:20 (lambda)>>, "download/74380"=>#<Playwright::EventEmitterCallback:0x000000011c3f8960 @proc=#<Proc:0x000000011c3f8f28 /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/capybara-playwright-driver-0.5.2/lib/capybara/playwright/page.rb:23 (lambda)>>, "response/74460"=>#<Playwright::EventEmitterCallback:0x000000011c3f63e0 @proc=#<Proc:0x000000011c3f88c0 /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/capybara-playwright-driver-0.5.2/lib/capybara/playwright/page.rb:29 (lambda)>>, "framenavigated/74540"=>#<Playwright::EventEmitterCallback:0x000000011c3f5e90 @proc=#<Proc:0x000000011c3f6250 /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/capybara-playwright-driver-0.5.2/lib/capybara/playwright/page.rb:32 (lambda)>>, "load/74620"=>#<Playwright::EventEmitterCallback:0x000000011c3f5a80 @proc=#<Proc:0x000000011c3f5da0 /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/capybara-playwright-driver-0.5.2/lib/capybara/playwright/page.rb:35 (lambda)>>}>>
          # ./spec/playwright_helper.rb:39:in `block (4 levels) in <top (required)>'
          # /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/playwright-ruby-client-1.47.0/lib/playwright/playwright_api.rb:121:in `block in wrap_block_call'
          # /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/playwright-ruby-client-1.47.0/lib/playwright/channel_owners/browser_type.rb:20:in `launch'
          # /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/playwright-ruby-client-1.47.0/lib/playwright_api/browser_type.rb:109:in `launch'
          # ./spec/playwright_helper.rb:36:in `block (3 levels) in <top (required)>'
          # /Users/christian/.rvm/gems/ruby-3.2.2@ad-playwright/gems/playwright-ruby-client-1.47.0/lib/playwright.rb:96:in `create'
          # ./spec/playwright_helper.rb:34:in `block (2 levels) in <top (required)>'
1 example, 1 failure, 0 passed
Finished in 1.611605 seconds

Randomized with seed 45554

Process finished with exit code 1

When i then add the gem selenium-webdriver, Capybara is satisfied and the test is passing (with Playwright).

Best Regards, Chris

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant