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

Fix connect to connect_to_playwright_server #74

Merged

Conversation

Migoo
Copy link
Contributor

@Migoo Migoo commented Jul 12, 2024

Hello,
I'm trying to use Plawright with docker as a websocker.

When passing a websocket url (eg: ws://localhost:8888/ws) there is an error when connecting to browser.

Minitest::UnexpectedError: Playwright::Error: Cannot read properties of undefined (reading 'launch')

here is how Playwright driver is added to Capybara:

Capybara.register_driver(:playwright) do |app|
  Capybara::Playwright::Driver.new(app,
                                   browser_type: :chromium,
                                   headless: false)
end

class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
  driven_by(
      :playwright,
      using: :chromium,
      options: {
        playwright_server_endpoint_url: 'ws://localhost:8888/ws'
      } 
    )
end

adding ?browser=#{@browser_type} fix the issue and I'm able to use Playwright with Capybara and docker.

Thanks for helping !

@YusukeIwaki YusukeIwaki merged commit f52551f into YusukeIwaki:main Jul 25, 2024
11 of 12 checks passed
@YusukeIwaki
Copy link
Owner

@Migoo Hi, thank you for your contribution! :)

capybara-playwright-driver 0.5.2 includes this fix. Please try it.

@lewispb
Copy link

lewispb commented Aug 28, 2024

This PR breaks endpoint URLs that include a query string already.

Generated URLs look like:

http://example.com/?token=xxx?browser=chromium

instead of

http://example.com/?token=xxx&browser=chromium

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

Successfully merging this pull request may close these issues.

3 participants