I'm just now getting around to checking this out. Is it possible to specify the URL in a YAML file? If so, I would go about this and what do I put in my script?
On Jan 5, 7:36 am, Adam Reed <[email protected]> wrote: > There are definitely a couple of options. You could have two > different options files, ie_options.yml and ff_options.yml, and then > set the options file before instantiating the browser object. You > could also pass a parameter (virtually the same as what I have done > above, just not called from an Array), or require a different library > that sets the options file via command line/batch (-r library.rb). > > Personally, I set the options file to the browser that I want, run all > of my tests, and then change the options file to the second browser > and run the tests again. > > Between Ruby conventions and Windows batch/shell script methods, there > are plenty of ways you could address it. If this is something you > just need one time with one script, the first method (or Željko's) > would be easier. > > On Jan 5, 2:51 am, Alastair Montgomery <[email protected]> wrote: > > > > > > > > > The options file looks like a good solution for my needs thanks for > > pointing that out. > > I'm guessing we could pass the name of the options file as a parameter > > to your script, that way you wouldn't need to edit the file between > > runs, just have an IE and Firefox version? > > > On Jan 4, 8:35 pm, Adam Reed <[email protected]> wrote: > > > > 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 WatirYAMLfile and use a batch to set the > > > default browser, run the test, edit the default browser and save the > > >YAMLfile 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 <[email protected]> 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. [email protected] http://groups.google.com/group/watir-general [email protected]
