Hi,

I can't figure this out. I am trying to verify a links exists on a page, 
after user logs in, using .exists? method. It works when I 
use @browser.link(:text => "Sign Out") . to define the element but i want 
define link using PageObjedt gem using link(:signout, :text => 'Sign Out')

Any ideas as to why this should happen?

Thanks,

Barry.

ERROR:
  Scenario: Registered user logs in to account 
    And a user exists                          
    When I enter my login details             
    Then I should have access to my account    
      undefined method `exists?' for []:Array (NoMethodError)
      ./features/step_definitions/login_page.rb:18:in `sign_out_link_exists'
      ./features/step_definitions/login_steps.rb:14:in `/^I should have 
access to my account$/'
      features/login.feature:14:in `Then I should have access to my account'



CLASS FILE:

class LoginPage
  include PageObject
  include DataMagic

  text_field(:email, :id => 'email')
  text_field(:password, :id => 'password')
  button(:signin, :id => 'loginBtn')
  link(:signout, :text => 'Sign Out')

  page_url "#{ENV['BaseUrl']}/user/signin"

  def login(data = {})
    populate_page_with data_for(:login_page, data)
    signin
  end

  def sign_out_link_exists
    signout.exists?
    #@browser.link(:text => "Sign Out").exists?
  end
end


STEP DEF:
Then /^I should have access to my account$/ do
  (on(LoginPage).sign_out_link_exists).should be_true
end

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