I am about to ask a very basic question here because I have been stuck on this for a long time 🙁
I have set a repository name “Invalid_Username_Message” and inside it I have to verify if label has text “Invalid Username” (I have named that label as “Invalid_Username_Message” as well)
I am trying to print the message in a message box like below:
msgbox Application(“Invalid_Username_Message”).View(“View”).Object(“Invalid_UserName_Message”).GetText
but I am getting message box every time.
I have following use case here:
1. SignIn with empty username
2. User should be able to see a message box “Invalid Username”
3. If user doesn’t see this message, test should be failed, but next statement should get pointer (I don’t want to close my test here, i want to continue next test cases)
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.
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
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.
You must activate your account before using it, please open the email that was sent to the email address that you used to set-up your account and confirm your email address.
Check you SPAM folder if you do not see the email.
Virtual Expert
ZAPTEST
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
Cookie
Duration
Description
cookielawinfo-checkbox-analytics
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional
11 months
The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy
11 months
The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.