Look at this: 
http://groups.google.com/group/watir-general/browse_thread/thread/707c0ac677e10af2


Date: Tue, 11 Oct 2011 16:18:03 -0400
Subject: Re: [wtr-general] Re: Trying to use SafariWatir and receiving an error 
when keying value into a text_field
From: [email protected]
To: [email protected]

Ok,

I made the correct to the script to initialize the browser variable.  I ran my 
script again and it seems it is broken at the password field.

Line from my script:
 puts "Key in correct password."

  $browser.text_field(:type, 'password').set user_pswd

ree-1.8.7-2010.02/lib/ruby/gems/1.8/gems/safariwatir-0.4.0/lib/safariwatir/locators.rb:85:in
 `method_missing': Watir::Exception::MissingWayOfFindingObjectException

    from 
/Users/josephfleck/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/gems/1.8/gems/safariwatir-0.4.0/lib/safariwatir/locators.rb:10:in
 `send'
    from 
/Users/josephfleck/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/gems/1.8/gems/safariwatir-0.4.0/lib/safariwatir/locators.rb:10:in
 `locator'

    from 
/Users/josephfleck/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/gems/1.8/gems/safariwatir-0.4.0/lib/safariwatir/scripter.rb:534:in
 `operate_by_locator'
    from 
/Users/josephfleck/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/gems/1.8/gems/safariwatir-0.4.0/lib/safariwatir.rb:149:in
 `operate'

    from 
/Users/josephfleck/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/gems/1.8/gems/safariwatir-0.4.0/lib/safariwatir/scripter.rb:303:in
 `focus'
    from 
/Users/josephfleck/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/gems/1.8/gems/safariwatir-0.4.0/lib/safariwatir.rb:525:in
 `set'

    from /Users/josephfleck/Documents/workspace/test/Add_Discussion_Safari.rb:43

I have also tried 

 puts "Key in correct password."
  $browser.text_field(:id, 'password').set user_pswd


/Users/josephfleck/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/gems/1.8/gems/safariwatir-0.4.0/lib/safariwatir/scripter.rb:661:in
 `execute': Unable to locate TextField, using :id and "password" 
(Watir::Exception::UnknownObjectException)

    from 
/Users/josephfleck/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/gems/1.8/gems/safariwatir-0.4.0/lib/safariwatir/scripter.rb:303:in
 `focus'
    from 
/Users/josephfleck/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/gems/1.8/gems/safariwatir-0.4.0/lib/safariwatir.rb:525:in
 `set'

    from /Users/josephfleck/Documents/workspace/test/Add_Discussion_Safari.rb:43

It can find the email address field just find using (the below) without any 
problems.

#Typing in user name into User Name field

  puts "Key in correct username."
  $browser.text_field(:name, 'username').set user_Ideer

The script works just fine in Firefox and Chrome but using safariwatir it stops 
here.

Thank you,

Joe

On Tue, Oct 11, 2011 at 1:49 PM, Željko Filipin <[email protected]> 
wrote:

On 11. 10. 2011., at 18:15, Joe Fl <[email protected]> wrote:

> undefined method `text_field' for nil:NilClass (NoMethodError)

>



That means @browser variable is not initialized, if I understood yourcode.





> Do I need the require 'watir' along with the require 'safariwatir'

> request in my script?



No. I am not sure that you can even install watir on mac.



Zeljko



--

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]






-- 

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]
                                          

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

Reply via email to