Hi guys i'm doing some automations scripts with Watir and trying to create a ruby class to make it better but i'm having this error:

> 
> examen.rb:6:in 'enterEmail': undefined method 'text\_field' for # (NoMethodError)
> 
> 
> 

This is part of my conflictive code:

```
require 'watir-webdriver'
class LoginPage 
  def enterEmail (email)
    text_field(:user, :id => 'user_email').set email
  end
end

```

The problem that i see is: i did not define the 'text\_field()' method in my class just because is a Watir method... Anyone knows how can i use the watir method in the classes that i create?
['https://Stackoverflow.com/questions/30365008', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3247357/']
`text_field` is an instance method of The `Watir::Browser` class. If you want to use it, you have to call it on an instance of that class.

```
class LoginPage
  def initialize()
    @b = Watir::Browser.new
  end 

  def enterEmail (email)
    @b.text_field(:user, :id => 'user_email').set email
  end
end

```
Indeed, your class does not have any `text_field` method. This method is a defined on `Watir::Browser` instance. In your example, haven't created one.

```
class LoginPage 
  def initialize
    @browser = Watir::Browser.new
    @browser.goto "http://example.com"
  end

  def enterEmail (email)
    @browser.text_field(:user, :id => 'user_email').set email
  end
end

```