Matt Westlake
Matt Westlake

Reputation: 3651

why is page object name erroring in ruby?

So here is my delema... I'm trying to get page object up and running, something I've done a thousand times before, but i'm getting a name error now. Is it just too early in the morning or am I missing something here? It keeps throwing a NameError

class LoginPage
  include PageObject

  text_field(:user, :id => 'username')
  text_field(:pass, :id => 'password')
  button(:login_button, :name => 'login')


  def login (username, password)
    self.user = username
    self.pass = password
    self.login_button.click
  end

end

Run cucumber

uninitialized constant LoginPage::PageObject (NameError)

env.rb has

require 'page-object'

see screen shot

enter image description here

Upvotes: 1

Views: 1719

Answers (1)

mcfinnigan
mcfinnigan

Reputation: 11638

I suspect your require should actually be

require 'page_object'

You may even need to include a path to help it resolve it, but try replacing the hyphen with an underscore first and see whether that works.

Upvotes: 1

Related Questions