Hello,
I am receiving the following error message:
in `text_field': wrong number of arguments (1 for 2) (ArgumentError)
from /Users/josephfleck/Documents/workspace/test/helper_methods.rb:
32:in `login'
from /Users/josephfleck/Documents/workspace/test/
Add_Discussion_Safari.rb:27
I have created a helper class for the actions that will be done over
and over. I created the script in Firefox and it works fine there but
when I run it with require "safariwatir" it crashes once it reaches
the text_box field.
Code from script:
# the rubygems
require "rubygems"
# Safariwatir controller
require "safariwatir"
#Open Class tab navigation
require 'tab_navigation'
#require 'LogOut.rb'
require 'helper_methods'
test_site = "http://0.0.0.0:3000/public/sign_in"
user_Ideer = "[email protected]"
user_pswd = "abcd1234"
#open browser
puts "Open Safari and Url"
#
$browser = Watir::Safari.start(""+test_site+"")
# <<<<< Login helper >>>>>>>>>
lgo = Helper_methods.new($browser)
lgo.login(user_Ideer,user_pswd)
Code from helper:
def initialize(browser)
@browser = browser
end
#<<<<<<< Login Method >>>>>>>>>>>>>>>>>>>>>>>
def login(user_Ideer,user_pswd)
puts "Email :#{user_Ideer}, Password : #{user_pswd}"
#open browser
# puts "Open Firefox and Url"
# $browser = Watir::Browser.start(""+test_site+"")
#Typing in user name into User Name field
puts "Key in correct username."
@browser.text_field(:name =>'username').set user_Ideer
#Typing in password into Password field
puts "Key in correct password."
@browser.text_field(:name =>'password').set user_pswd
#Click in Sign In button
puts "Click the sign in Button"
@browser.button(:id =>'sign_in_button').click
end
Any help would be appreciated.
Thank you,
Joe
--
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]