Skip to content
This repository has been archived by the owner on Sep 17, 2021. It is now read-only.
sreepad edited this page Aug 18, 2016 · 4 revisions

text api should be used as below in screen objects.

text(:logical_name,locator)

logical_name is a name to uniquely represent a button.

locator could be name, id, accessibility id ,xpath etc.. locators are assigned to object by developers during design. For example, xpath locator should be defined as follows, "xpath~//UICheckBox".

####Below methods are automatically created by using the above text method

Below method is used to click the text

logical_name  

Below method checks for the existence of the text. returns true or false

logical_name?  

Below method returns the text for the given text element

logical_name_text  

Below method returns the value for the given text element

logical_name_value  

below method first creates dynamic xpath and
checks if the text (based on dynamic xpath locator strategy) that is sent as argument exists on the screen . returns true or false

logical_name_dynamic?(argument)  

####Example

If I have a 'Welcome' text on the screen, assuming 'UITextField' as xpath, I would call the api/method as below

text(:welcome_text,"xpath~//UITextField")

####Below methods are automatically generated welcome_text

welcome_text?  

welcome_text_text  

welcome_text_value  

welcome_text_dynamic?(text)  

Usage:

class Login

  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

      # DSL to check existence of welcome text

          def check_welcome_text
              welcome_text? # This will return true or false based on existence of Welcome text.
          end

      # DSL to retrieve text of the attribute text.

          def get_welcome_text
              welcome_text_text # This will return text of attribute 'text'.
          end

      # DSL to retrieve text for value attribute.

          def value_welcome_text
              welcome_text_value  # This will return the text of 'value' attribute.
          end  


text(:welcome_guest,"xpath~//UITextField")

      # DSL to check if the text that is sent as argument exists on the screen. Returns true or false
        def dynamic_welcome_guest(Welcome_text)
              welcome_text_dynamic?(welcome_text)  # This will return true or false based welcome text exists on the screen.
          end
end
Clone this wiki locally