You should take a look at some basic ruby tutorials, google for the Pickaxe
book which is free and available online. You need to pass the variable into
your class or initialize it in the class, you're currently using a
combination of instance variable - @ie - inside your class and ie :



require 'watir'

ie = Watir::IE.new

#Open the application

ie.goto "https://google.com";

class Fun

 def initialize browser
    @ie = browser
end

 def as
  @ie.text_field(:name,"q").set "#textdata"
 end

end

fun1= Fun.new ie
fun1.as


Charley Baker
blog: http://blog.charleybaker.org/
Lead Developer, Watir, http://wtr.rubyforge.org
QA Architect, Gap Inc Direct


On Mon, Jul 27, 2009 at 5:48 AM, Akash S <akash1...@gmail.com> wrote:

>
> Hi All,
>
> I am very new to watir, i am using watir for automation
>
> i have written following code for opening browser
>
> require "Watir"
>
> ie = Watir::IE.new
>
> #Open the application
>
> ie.goto "https://google.com";
>
> enter some text in Fun class ,
>
> class Fun
>  def as
>   @ie.text_field(:name,"q").set "#textdata"
>  end
>
> end
>
> now  when i call this, it throws error. so  i want to know to access
> ie object in some other class or script
>
> fun1= Fun.new
>
> fun1.as
>
> Thanks in advance
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to