YusukeIwaki / puppeteer-ruby

A Ruby port of Puppeteer
Apache License 2.0
284 stars 41 forks source link

Firefox 129 compatability #335

Closed ronakjain90 closed 1 day ago

ronakjain90 commented 4 weeks ago

Hi, Thank you for this open source project. I have noticed that this gem currently doesn't work with firefox, where as I can see that there are some firefox integration tests which are not passing. Would you be able to confirm if Firefox works, what version is currently supported.

I can confirm that the node version of puppeteer does works with firefox. And puppeteer-rb does works with chromium.

Step To Reproduce / Observed behavior

irb(main):013* browser = Puppeteer.launch(
irb(main):014*           product: 'firefox',
irb(main):015*           headless: true,
irb(main):023*          executable_path: '/home/deploy/.cache/puppeteer/firefox/linux-stable_129.0/firefox/firefox',
irb(main):024> )
/home/deploy/core/shared/bundle/ruby/3.2.0/gems/puppeteer-ruby-0.45.3/lib/puppeteer/browser_runner.rb:190:in `rescue in wait_for_ws_endpoint': Timed out after 30000 ms while trying to connect to the browser! Only Chrome at revision r706915 is guaranteed to work. (Puppeteer::TimeoutError)
/home/deploy/core/shared/bundle/ruby/3.2.0/gems/timeout-0.4.0/lib/timeout.rb:43:in `rescue in handle_timeout': execution expired (Timeout::Error)
/home/deploy/core/shared/bundle/ruby/3.2.0/gems/puppeteer-ruby-0.45.3/lib/puppeteer/browser_runner.rb:180:in `readline': execution expired (Timeout::ExitException)

Expected behavior

Firefox works similar to chromium.

Environment

Ubuntu 22.04.4 LTS Ruby 3.2.2 Firefox 127

ryanckulp commented 3 weeks ago

PS our company pay up to $1,500 for this improvement.

whimboo commented 2 weeks ago

Note that for CDP the following prefs were set some time ago: https://github.com/YusukeIwaki/puppeteer-ruby/commit/a1881bb89acff5bbe71522a9c2d7e844ab948e4c. These should not be set for Firefox when running with WebDriver BiDi. So please check if removing these prefs will give a better experience when running Puppeteer-Ruby with our WebDriver BiDi implementation in Firefox.

whimboo commented 2 weeks ago

But please note that WebDriver BiDi is a complete different protocol and it will require a certain amount of work to get it added. We are happy to assist from our side when issues come up with its implementation, in case it's wanted for this project.

ronakjain90 commented 2 weeks ago

Hi @whimboo - Thanks for responding, as recommended I removed 'fission.bfcacheInParent': false and 'fission.webContentIsolationStrategy': 0 preferences, but it still has the same issue. Somehow it's trying to establish a web socket connection with Firefox which timeout. I think this project doesn't uses WebDriver BiDi (at least from code grep). I have also tried to run this project with older version of firefox (96), but that didn't help either.

RichardMwenjira commented 2 weeks ago

While the Node.js version of Puppeteer supports Firefox, the Ruby version currently has issues with it. I use Chromium with Puppeteer Ruby or switch to Node.js Puppeteer for Firefox compatibility.

YusukeIwaki commented 3 days ago

It seems Puppeteer for Firefox uses WebDriverBiDi by default, and CDP for Firefox is no longer supported in future.

And also Firefox already announced the deprecation of CDP support.

As you already noticed, I'm not afford to maintain this library enough to support Firefox using BiDi. I will try to fix puppeteer-ruby's compatibility for the latest Firefox just with CDP.

whimboo commented 2 days ago

That's understandable. Thank you for the details.