I want to make a monkey patch for a selenium ruby gem.
Here is the article that I am following.
However, when I do define my own code:
module Selenium
module WebDriver
module Driver
module CookieManagement
# This is the same as Driver.get, but I just want it to save all the domains it goes to in an easily accessible variable
def get_and_save(url)
puts "You've asked me to get, so I am getting"
get(url)
end
end
end
end
end
I get an error:
Uncaught exception: Driver is not a module
I understand that this happens because I already have a Driver class defined, so that's ok. But then how does it not happen to the dude in the article and more importantly, what's the accepted workaround then?
UPDATE
I guess my bad for not including the line of code where I do include that causes the above error.
Selenium::WebDriver::Driver.include Selenium::WebDriver::Driver::CookieManagement
Also, it's plain ruby. No rails involved.