Hi,
I apologise, as I was not clear at all.
browser.rb
require 'watir'
class Browser
def start_browser (url)
@ie = Watir::IE.new
@ie.goto(url)
@ie.maximize()
end
end
logon.rb
class Login
def login (username, password)
@ie.link(:text, 'Log in').click
@ie.text_field(:name, 'userid').set(username)
@ie.text_field(:name, 'password').set(password)
@ie.button(:value,'Log in').click
end
end
test_1.rb
require 'browser'
require 'logon'
Browser.new.start_browser("http://gbahevm07l15:9081/wps/portal")
Login.new.login("aidy","12345")
the error I actually get is this
'login': undefined method `link' for nil:NilClass (NoMethodError)
Now, if I remove the classes: Browser + Login, but keep the methods.
And in test_1.rb, I do this
start_browser("http://gbahevm07l15:9081/wps/portal")
login("aidy","12345")
the test runs fine.
Thank You
Aidy