require 'watir' browsers = ["ie", "firefox"]
browsers.each do |b| Watir::Browser.default = b browser = Watir::Browser.new browser.goto "url" end This would work if you were looking to literally run both tests inside of one script, and could also involve multi-threading to run them simultaneous, however, I think the best approach is to put your browser selection in a the Watir YAML file and use a batch to set the default browser, run the test, edit the default browser and save the YAML file again, and then run the test(s) again. Create the file 'options.yml' with contents: # This file specifies options affecting all tests. # These options can also be set using environment variables prefixed with 'watir_ # These environment variables will override settings from this file. # 'ie' (Watir::IE) or 'firefox' (FireWatir::Firefox) browser: ie #browser: firefox # These options only affect IE. # speed options are fast, slow, and zippy speed: zippy #visible: false visible: true Include the following code in your script(s): Watir.options_file = 'options.yml' Now, whenever you change the default browser designation in your options.yml file, your scripts will use that browser. Hope that helps. Adam On Jan 3, 10:36 am, Oleg <ol.shevche...@gmail.com> wrote: > Hi All. > Please give me advice how can I run IE and FF tests in the one ruby > script. > I tried the following, but in the second part opens browser > initialized firstly (IE in this example) > > require 'watir' > Watir::Browser.default = 'ie' > browser = Watir::Browser.new > browser.goto "url" > ... > require 'firewatir' > Watir::Browser.default = 'firefox' > browser = Watir::Browser.new > browser.goto "url" > ... -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com