def text_field(name,locator)

        # generates method for setting text into text field.
        # There is no return value for this method.
        # @example setting username field.
        # DSL for entering text in username text field.
        # def set_username_text_field(username)
        #   self.username=username   # This method will enter text into username text field.
        # end
        define_method("#{name}=") do |text|
          ScreenObject::AppElements::TextField.new(locator).text=(text)
        end

        # generates method for comparing expected and actual text.
        # this will return text of text attribute of the object.
        # @example retrieve text of the 'username' text field.
        # text_field(:username,"xpath~//UITextField")
        # DSL to retrieve text of the attribute text.
        # def get_welcome_text
        #   username_text # This will return text containing in text field attribute.
        # end
        define_method("#{name}") do
          ScreenObject::AppElements::TextField.new(locator).text
        end

        # generates method for clear pre populated text from the text field.
        # this will not return any value.
        # @example clear text of the username text field.
        # text_field(:username,"xpath~//UITextField")
        # DSL to clear the text of the text field.
        # def clear_text
        #   clear_username # This will clear the pre populated user name text field.
        # end
        define_method("clear_#{name}") do
          ScreenObject::AppElements::TextField.new(locator).clear
        end

        # generates method for checking if text_field exists on the screen.
        # this will return true or false based on if text field is available or not
        # @example check if 'username' text field is displayed on the page
        # text_field(:username,"xpath~//UITextField")
        # # DSL for clicking the username text.
        # def exists_username
        #   username? # This will return if object exists on the screen.
        # end
        define_method("#{name}?") do
          ScreenObject::AppElements::TextField.new(locator).exists?
        end

        # generates method for retrieving text of the value attribute of the object.
        # this will return text of value attribute of the object.
        # @example retrieve text of the 'username' text_field.
        # text_field(:username,"xpath~//UITextField")
        # DSL to retrieve text of the attribute text.
        # def get_username_text
        #   username_value # This will return text of value of attribute 'text'.
        # end
        define_method("#{name}_value") do
          ScreenObject::AppElements::TextField.new(locator).value
        end


        # generates method for checking if button is enabled.
        # this method will return true if button is enabled otherwise false.
        # @example check if 'Submit' button enabled on the screen.
        # button(:login_button,"xpath~//UIButtonField")
        # DSL to check if button is enabled or not
        # def enable_login_button
        # login_button_enabled? # This will return true or false if button is enabled or disabled.
        # end
        define_method("#{name}_enabled?") do
          ScreenObject::AppElements::TextField.new(locator).enabled?
        end

      end
def text_field(name,locator)

        # generates method for setting text into text field.
        # There is no return value for this method.
        # @example setting username field.
        # DSL for entering text in username text field.
        # def set_username_text_field(username)
        #   self.username=username   # This method will enter text into username text field.
        # end
        define_method("#{name}=") do |text|
          ScreenObject::AppElements::TextField.new(locator).text=(text)
        end

        # generates method for comparing expected and actual text.
        # this will return text of text attribute of the object.
        # @example retrieve text of the 'username' text field.
        # text_field(:username,"xpath~//UITextField")
        # DSL to retrieve text of the attribute text.
        # def get_welcome_text
        #   username_text # This will return text containing in text field attribute.
        # end
        define_method("#{name}") do
          ScreenObject::AppElements::TextField.new(locator).text
        end

        # generates method for clear pre populated text from the text field.
        # this will not return any value.
        # @example clear text of the username text field.
        # text_field(:username,"xpath~//UITextField")
        # DSL to clear the text of the text field.
        # def clear_text
        #   clear_username # This will clear the pre populated user name text field.
        # end
        define_method("clear_#{name}") do
          ScreenObject::AppElements::TextField.new(locator).clear
        end

        # generates method for checking if text_field exists on the screen.
        # this will return true or false based on if text field is available or not
        # @example check if 'username' text field is displayed on the page
        # text_field(:username,"xpath~//UITextField")
        # # DSL for clicking the username text.
        # def exists_username
        #   username? # This will return if object exists on the screen.
        # end
        define_method("#{name}?") do
          ScreenObject::AppElements::TextField.new(locator).exists?
        end

        # generates method for retrieving text of the value attribute of the object.
        # this will return text of value attribute of the object.
        # @example retrieve text of the 'username' text_field.
        # text_field(:username,"xpath~//UITextField")
        # DSL to retrieve text of the attribute text.
        # def get_username_text
        #   username_value # This will return text of value of attribute 'text'.
        # end
        define_method("#{name}_value") do
          ScreenObject::AppElements::TextField.new(locator).value
        end


        # generates method for checking if button is enabled.
        # this method will return true if button is enabled otherwise false.
        # @example check if 'Submit' button enabled on the screen.
        # button(:login_button,"xpath~//UIButtonField")
        # DSL to check if button is enabled or not
        # def enable_login_button
        # login_button_enabled? # This will return true or false if button is enabled or disabled.
        # end
        define_method("#{name}_enabled?") do
          ScreenObject::AppElements::TextField.new(locator).enabled?
        end

      end
text_field class generates all the methods related to different operations that can be performed on the text_field object on the screen.