Yeah, that's why I stated I wasn't sure what they were considering a
failure.


On Fri, Sep 20, 2013 at 9:52 AM, Oscar Rieken <[email protected]> wrote:

> To me this doesn't sound like a good test I would probably do something
> more like
>
>
> before do
>    b = (ENV['BROWSER'] ||= 'firefox').downcase
>   @browser = Watir::Browser.new b.to_sym
> end
>
> it "has the correct title" do
>   @browser.goto "place"
>   expect(@browser.title).to eql "something"
> end
>
> then just run it with
> rspec BROWSER=chrome
> rspec BROWSER=ie
> rspec
>
> to me this makes more sense because , sorry if the code doesn't actually
> work did this from memory
>
>
> On Fri, Sep 20, 2013 at 9:08 AM, Dan <[email protected]> wrote:
>
>> Not sure what you're considering a failure, but you'll want to use some
>> exception handling in that case.  See below for an example.  :none is not a
>> valid browser so, it'll fail to initialize it, but keep going with some
>> exception handling.
>>
>> require 'watir-webdriver'
>> browsers = [:none,:firefox,:chrome,:safari].each do |br|
>> begin
>> b = Watir::Browser.new br
>> b.goto("google.com")
>> puts b.title
>> b.close
>> rescue => e
>> puts e.message
>> next
>> end
>> end
>>
>> On Thursday, September 19, 2013 6:47:54 PM UTC-4, Ankita@Adslot wrote:
>>>
>>> Hi Dan
>>>
>>> Thanks for your reply. This does work if the script runs without any
>>> failure, but, in case any failure happens script stops and does not execute
>>> on other browsers.
>>>
>>> I wanted something where even if script fails on one browser, it still
>>> runs on others to complete the test.
>>>
>>> Your help is much appreciated!
>>>
>>> On Thursday, September 19, 2013 11:07:48 PM UTC+10, Dan wrote:
>>>>
>>>> Not sure what framework you're using or whatever, but you can do this
>>>> pretty easy with a loop.  Below is the basic concept.
>>>>
>>>> require 'watir-webdriver'
>>>> browsers = [:firefox,:chrome,:safari].**each do |br|
>>>> b = Watir::Browser.new br
>>>> b.goto("google.com")
>>>> puts b.title
>>>> b.close
>>>> end
>>>>
>>>> On Wednesday, September 18, 2013 11:57:44 PM UTC-4, Ankita@Adslotwrote:
>>>>>
>>>>> Hi
>>>>>
>>>>> Just wondering if there is a way I could automate my script to run on
>>>>> three different browsers one after another...
>>>>>
>>>>> wanted something like
>>>>>
>>>>> Open Browser1 - firefox
>>>>> Run script
>>>>> Close Browser
>>>>> <output>
>>>>> Open Browser2 - ie
>>>>> Run script
>>>>> Close Browser
>>>>> <output>
>>>>> OpenBrowser3- phantomjs
>>>>> Run script
>>>>> Close Browser
>>>>>  <output>
>>>>>
>>>>>
>>>>> I know we could initiate browser of our choice through command prompt
>>>>> and then run the script but just wondering if there is something which
>>>>> could automate the process rather then running the test manually 3 times
>>>>> with three different browsers?
>>>>>
>>>>  --
>> --
>> 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]
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Watir General" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>>
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>  --
> --
> 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]
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "Watir General" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/watir-general/C9ufcIGfIPY/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
-- 
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]

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to