I have the following code
require 'watir-wedriver'
browsers = ['chrome', 'safari']
browsers.each do |browserName|
browser = Watir::Browser.new :browserName
# more code here
end
browserName doesn’t work here since the command is interpreting it literally (i.e., it’s reading browser = Watir::Browser.new :browserName instead of browser = Watir::Browser.new :chrome followed by browser = Watir::Browser.new :safari.
How can I make that variable expand there?