GetText of object

GetText of object

Home Forums Ask Expert GetText of object

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #31496
    Kirill Bulatnikov
    Participant

      Hello Aqu, thanks for your forum activity!

      In your case it will be enough to use Exist method for error message, I suppose. So if you expecting text “Invalid Username” just check if you already have object with matching Text property in repository (or create it manually). Then when you will need to use Exist method for this object and it report successful step in case if this object appears on the screen.

      Hope that helps.
      Thanks,
      ZAPTEST Team

      #31497
      Asif Qureshi
      Participant

        Hi,

        Thank you for your quick response.

        I had been trying with “Exist” method initially, but I am kind of stuck in there as well. Let me explain it to you.

        -> If NOT Application(“Invalid_Username_Message”).View(“View”).Object(“Invalid username i provided.”).Exist
        this statement returns “Run time error”
        The reason is that on UI, message was “Invalid username is provided” while I wanted to test the false scenario so I typed -> “Invalid username i provided”

        What I want to do is:
        1. Statement 1
        2. Statement 2
        3. Statement 3 (It fails, so log errors, and move to next Statement)
        4. Statement 4
        5. etc

        Capture4.PNG

        #31504
        Sasha ZAP
        Moderator

          Hello aqu,

          Basically the Exist method enables ZAPTEST to recognize the object, if there is no such object the Exist will fail.
          If you wish to do a GetText upon any message that appears in a specific place in the UI you should do the following:
          1. Set the object’s rectangle in the GUI Map to cover all appeared messages’ length.
          2. In the Object’s Property Set the “Recognition Type” property so it will be “Image”.
          3. Set a variable that will get the value the GetText method will capture and set a condition statement (If…Then) to check the text and send a report accordingly.

          If the GetText will capture more text then necessary you can always use the InStr method to check only a fragment of this text.

          P.S. Please download, install and use the latest ZAPTEST version (v17.4.0) which has number of new features and new fixes.

          Thanks,
          ZAPTEST Team

        Viewing 3 posts - 1 through 3 (of 3 total)
        • You must be logged in to reply to this topic.

        Virtual Expert

        ZAPTEST

        ZAPTEST Logo