oesmith / puffing-billy

A rewriting web proxy for testing interactions between your browser and external sites. Works with ruby + rspec.
MIT License
659 stars 170 forks source link

Fix removed `Selenium::WebDriver::Remote::Capabilities.firefox` method #336

Closed gustavosobral closed 1 year ago

gustavosobral commented 1 year ago

The selenium-webdriver browser class methods for Capabilities were deprecated on version 4.8 (https://github.com/SeleniumHQ/selenium/blob/trunk/rb/CHANGES#L123) and on version 4.11.0 it got removed (https://github.com/SeleniumHQ/selenium/pull/12417)

At the moment if we are using selenium-webdriver 4.11 and :selenium_billy or :selenium_headless_billy drivers we run into the following error:

NoMethodError:
  undefined method `firefox' for Selenium::WebDriver::Remote::Capabilities:Class

             Selenium::WebDriver::Remote::Capabilities.firefox(accept_insecure_certs: true)

According to my research, Selenium::WebDriver::Firefox::Options has accept_insecure_certs as true for default since version 4.5: https://github.com/SeleniumHQ/selenium/blob/trunk/rb/CHANGES#L181 / https://github.com/SeleniumHQ/selenium/blob/selenium-4.5.0/rb/lib/selenium/webdriver/firefox/options.rb#L61.

I also added specs to make sure Firefox stays working.

gustavosobral commented 1 year ago

The build is failing on Ruby 2.6 but Ruby 2.6 has reached EOL since 2022-04-12 (https://www.ruby-lang.org/en/downloads/branches/). I'm not sure if we can just drop 2.6 support moving forward?

I'm trying replicate the issue locally but even installing Ruby 2.6 on a M1 MacBook has proven to be a bit troublesome.

I have a proposal PR dropping Ruby 2.6 support here https://github.com/oesmith/puffing-billy/pull/337, let me know what do you think.

ronwsmith commented 1 year ago

Released in v4.0.0