All posts by Juan Lebrijo

Updating Chromedriver when system chrome is updated

I use Capybara for testing, with chrome extension. From time to time Ubuntu asks to update chrome to a newest version. This breaks compatibilty with chromedriver version for testing purposes.

You experienced an error like this:

In this link you have all webdriver versions matching with your actual browser version.

I downloaded and installed to solve the problem. Here the commands:

sudo mv chromedriver-linux64/chromedriver /usr/local/bin/
sudo chown root:root /usr/local/bin/chromedriver
sudo chmod +x /usr/local/bin/chromedriver
rm -r chromedriver*

Hope it workd for you.

Happy coding!!

Initializing a Ruby Hash

Researching in the Hash ruby class, I needed to initialize values to 0. It is really easy, passing default value to construnctor:

store =
store[:candles] +=3

Then we can accumulate candles from the creation of the key without the “undefined ‘+’ for nil:NilClass” error.

New class Data for structs

Ruby 3.2 came with a new class Data to defile structs:

Measure = Data.define(:amount, :unit)
# Positional arguments constructor is provided
distance =, 'km')
#=> #
# Keyword arguments constructor is provided
weight = 50, unit: 'kg')
#=> #
# Alternative form to construct an object:
speed = Measure[10, 'mPh']
#=> #
# Works with keyword arguments, too:
area = Measure[amount: 1.5, unit: 'm^2']
#=> #
# Argument accessors are provided:
distance.amount #=> 100
distance.unit #=> "km"

Basically the same as Struct, but remember that Struct has arguments writers.