I think you need to look up how Ruby handles scope.  

http://en.wikibooks.org/wiki/Ruby_Programming/Syntax/Variables_and_Constants#Instance_Variables

Google is your friend.

On Tuesday, March 26, 2013 11:01:42 AM UTC-4, mc060200778 wrote:
>
> i have one common script Browser.rb which is used to initialize and open 
> my web application in chrome browser. i called it once in my main script 
> (AddCustomer.rb) and it opens browser and go to required url. In my 
> Browser.rb script i initialized as follow 
>
> *  def setup*
> *    @browser = Watir::Browser.new:chrome *
> *    @browser.goto ("http://testserver:8080/";)  #The URL should come from 
> the excel file.*
> *    @browser.window.maximize*
>
> *  end*
>
> The problem is that variable *@browser *does not work for other scripts 
> which i am calling in my main script (AddCustomer.rb) and hence object are 
> identifiable. *how can i resolve this issue?*
> *Please advise.*
> *
> *
>
> On Tue, Mar 26, 2013 at 6:03 PM, Oscar Rieken <[email protected]<javascript:>
> > wrote:
>
>> I would also suggest picking up the ruby pickaxe book
>> http://pragprog.com/book/ruby4/programming-ruby-1-9-2-0
>>
>> http://mislav.uniqpath.com/poignant-guide/
>>
>>  and actually learning ruby here are a few places that may help as well
>> http://tryruby.org/levels/1/challenges/0(free)
>>
>> http://www.codeschool.com/
>> http://www.codecademy.com/ (free)
>>
>>
>>
>>
>> On Tue, Mar 26, 2013 at 9:37 AM, Željko Filipin 
>> <[email protected]<javascript:>
>> > wrote:
>>
>>> On Tue, Mar 26, 2013 at 2:32 PM, Sohail Mirza <[email protected]<javascript:>
>>> > wrote:
>>>  
>>>> i meant how can i call a script into another script.
>>>
>>>
>>> "require" is what you are looking for:
>>>
>>> http://rubylearning.com/satishtalim/including_other_files_in_ruby.html
>>>
>>> Željko
>>>
>>> -- 
>>> -- 
>>> Before posting, please read http://watir.com/support. In short: search 
>>> before you ask, be nice.
>>>  
>>> [email protected] <javascript:>
>>> http://groups.google.com/group/watir-general
>>> [email protected] <javascript:>
>>>  
>>> --- 
>>> 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] <javascript:>.
>>> 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] <javascript:>
>> http://groups.google.com/group/watir-general
>> [email protected] <javascript:>
>>  
>> --- 
>> 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] <javascript:>.
>> 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