def text(name,locator)


        # generates method for clicking button.
        # this method will not return any value.
        # @example click on 'Submit' button.
        # button(:login_button,"xpath~//UIButtonField")
        # def click_login_button
        #  login_button # This will click on the button.
        # end
        define_method(name) do
          ScreenObject::AppElements::Text.new(locator).tap
        end

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

        # generates method for clicking on text object.
        # this will NOT return any value.
        # @example check if 'Welcome' text is displayed on the page
        # text(:welcome_text,"xpath~//UITextField")
        # DSL for clicking the Welcome text.
        # def click_welcome_text
        #   welcome_text # This will click on the Welcome text on the screen.
        # end
        define_method("#{name}") do
          ScreenObject::AppElements::Text.new(locator).click
        end

        # generates method for retrieving text of the object.
        # this will return value of text attribute of the object.
        # @example retrieve text of 'Welcome' object on the page.
        # text(:welcome_text,"xpath~//UITextField")
        # DSL to retrieve text of the attribute text.
        # def get_welcome_text
        #   welcome_text_text # This will return text of value of attribute 'text'.
        # end
        define_method("#{name}_text") do
          ScreenObject::AppElements::Text.new(locator).text
        end

        # generates method for checking dynamic text object.
        # this will return true or false based on object is displayed or not.
        # @example check if 'Welcome' text is displayed on the page
        # @param [text] is the actual text of the button containing.
        # suppose 'Welcome guest' text appears on the screen for non logged in user and it changes when user logged in on the screen and appears as 'Welcome <guest_name>'. this would be treated as dynamic text since it would be changing based on guest name.
        # DSL to check if the text that is sent as argument exists on the screen. Returns true or false
        # text(:welcome_guest,"xpath~//UITextField")
        # def dynamic_welcome_guest(Welcome_<guest_name>)
        # welcome_text_dynamic?(welcome_<guest_name>)  # This will return true or false based welcome text exists on the screen.
        # end
        define_method("#{name}_dynamic?") do |text|
          ScreenObject::AppElements::Text.new(locator).dynamic_text_exists?(text)
        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 'Welcome' text.
        # text(:welcome_text,"xpath~//UITextField")
        # DSL to retrieve text of the attribute text.
        # def get_welcome_text
        #   welcome_text_value # This will return text of value of attribute 'text'.
        # end
        define_method("#{name}_value") do
          ScreenObject::AppElements::Text.new(locator).value
        end

        # generates method for checking dynamic text object.
        # this will return actual test for an object.
        # @example check if 'Welcome' text is displayed on the page
        # @param [text] is the actual text of the button containing.
        # suppose 'Welcome guest' text appears on the screen for non logged in user and it changes when user logged in on the screen and appears as 'Welcome <guest_name>'. this would be treated as dynamic text since it would be changing based on guest name.
        # DSL to check if the text that is sent as argument exists on the screen. Returns true or false
        # text(:welcome_guest,"xpath~//UITextField")
        # def dynamic_welcome_guest(Welcome_<guest_name>)
        # welcome_text_dynamic?(welcome_<guest_name>)  # This will return true or false based welcome text exists on the screen.
        # end
        define_method("#{name}_dynamic_text") do |text|
          ScreenObject::AppElements::Text.new(locator).dynamic_text(text)
        end

      end
def text(name,locator)


        # generates method for clicking button.
        # this method will not return any value.
        # @example click on 'Submit' button.
        # button(:login_button,"xpath~//UIButtonField")
        # def click_login_button
        #  login_button # This will click on the button.
        # end
        define_method(name) do
          ScreenObject::AppElements::Text.new(locator).tap
        end

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

        # generates method for clicking on text object.
        # this will NOT return any value.
        # @example check if 'Welcome' text is displayed on the page
        # text(:welcome_text,"xpath~//UITextField")
        # DSL for clicking the Welcome text.
        # def click_welcome_text
        #   welcome_text # This will click on the Welcome text on the screen.
        # end
        define_method("#{name}") do
          ScreenObject::AppElements::Text.new(locator).click
        end

        # generates method for retrieving text of the object.
        # this will return value of text attribute of the object.
        # @example retrieve text of 'Welcome' object on the page.
        # text(:welcome_text,"xpath~//UITextField")
        # DSL to retrieve text of the attribute text.
        # def get_welcome_text
        #   welcome_text_text # This will return text of value of attribute 'text'.
        # end
        define_method("#{name}_text") do
          ScreenObject::AppElements::Text.new(locator).text
        end

        # generates method for checking dynamic text object.
        # this will return true or false based on object is displayed or not.
        # @example check if 'Welcome' text is displayed on the page
        # @param [text] is the actual text of the button containing.
        # suppose 'Welcome guest' text appears on the screen for non logged in user and it changes when user logged in on the screen and appears as 'Welcome <guest_name>'. this would be treated as dynamic text since it would be changing based on guest name.
        # DSL to check if the text that is sent as argument exists on the screen. Returns true or false
        # text(:welcome_guest,"xpath~//UITextField")
        # def dynamic_welcome_guest(Welcome_<guest_name>)
        # welcome_text_dynamic?(welcome_<guest_name>)  # This will return true or false based welcome text exists on the screen.
        # end
        define_method("#{name}_dynamic?") do |text|
          ScreenObject::AppElements::Text.new(locator).dynamic_text_exists?(text)
        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 'Welcome' text.
        # text(:welcome_text,"xpath~//UITextField")
        # DSL to retrieve text of the attribute text.
        # def get_welcome_text
        #   welcome_text_value # This will return text of value of attribute 'text'.
        # end
        define_method("#{name}_value") do
          ScreenObject::AppElements::Text.new(locator).value
        end

        # generates method for checking dynamic text object.
        # this will return actual test for an object.
        # @example check if 'Welcome' text is displayed on the page
        # @param [text] is the actual text of the button containing.
        # suppose 'Welcome guest' text appears on the screen for non logged in user and it changes when user logged in on the screen and appears as 'Welcome <guest_name>'. this would be treated as dynamic text since it would be changing based on guest name.
        # DSL to check if the text that is sent as argument exists on the screen. Returns true or false
        # text(:welcome_guest,"xpath~//UITextField")
        # def dynamic_welcome_guest(Welcome_<guest_name>)
        # welcome_text_dynamic?(welcome_<guest_name>)  # This will return true or false based welcome text exists on the screen.
        # end
        define_method("#{name}_dynamic_text") do |text|
          ScreenObject::AppElements::Text.new(locator).dynamic_text(text)
        end

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