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

Fixed websocket URL to work with windows google-chrome browser on WSL v1 #327

Merged
merged 1 commit into from
Apr 5, 2024

Conversation

rschwass
Copy link
Contributor

On WSLv1 when you set the "executable_path" to a windows browser the websocket url has a carriage return in it and it breaks the code.

/usr/lib/ruby/3.0.0/uri/rfc3986_parser.rb:67:in split': bad URI(is not URI?): "ws://127.0.0.1:59359/devtools/browser/7be24a1d-1c2e-4839-a3a9-2516e01e1d20\r" (URI::InvalidURIError)
from /usr/lib/ruby/3.0.0/uri/rfc3986_parser.rb:72:in parse' from /usr/lib/ruby/3.0.0/uri/common.rb:171:in parse'
from /var/lib/gems/3.0.0/gems/puppeteer-ruby-0.45.3/lib/puppeteer/web_socket.rb:24:in initialize' from /var/lib/gems/3.0.0/gems/puppeteer-ruby-0.45.3/lib/puppeteer/web_socket.rb:60:in new'
from /var/lib/gems/3.0.0/gems/puppeteer-ruby-0.45.3/lib/puppeteer/web_socket.rb:60:in initialize' from /var/lib/gems/3.0.0/gems/puppeteer-ruby-0.45.3/lib/puppeteer/web_socket_transport.rb:5:in new'
from /var/lib/gems/3.0.0/gems/puppeteer-ruby-0.45.3/lib/puppeteer/web_socket_transport.rb:5:in create' from /var/lib/gems/3.0.0/gems/puppeteer-ruby-0.45.3/lib/puppeteer/browser_runner.rb:167:in setup_connection'
from /var/lib/gems/3.0.0/gems/puppeteer-ruby-0.45.3/lib/puppeteer/launcher/chrome.rb:76:in launch' from /var/lib/gems/3.0.0/gems/puppeteer-ruby-0.45.3/lib/puppeteer/puppeteer.rb:78:in launch'
from /var/lib/gems/3.0.0/gems/puppeteer-ruby-0.45.3/lib/puppeteer.rb:86:in public_send' from /var/lib/gems/3.0.0/gems/puppeteer-ruby-0.45.3/lib/puppeteer.rb:86:in block (3 levels) in module:Puppeteer'
from get-pin.rb:5:in get_browser' from get-pin.rb:34:in

'`

my change fixes that

@YusukeIwaki YusukeIwaki merged commit f4f8b3e into YusukeIwaki:main Apr 5, 2024
1 of 8 checks passed
@YusukeIwaki
Copy link
Owner

@rschwass Thank you for you contribution. Now puppeteer-ruby 0.45.4 includes this fix. Could you try it?

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.

2 participants