Hi to all,
Recenty I’ve downloaded Katalon and started to use it for automatized test so I don’t have so much experience within this tool so sorry for some possible “stupid” questions
So, in this case I’ve used Spy web option and this whole part f.e. DCI STORE was recognized as div_DCI4Store. I need to check in every case is this service status Active, if it’s not then error should be displayed.
I’ve tried to use objects Verify Element Text, Verify text present but it can’t be executed correctly.
Thanks in advance.
Try this on the latest version of Katalon Studio. When you record using the Web Recorder, right click on the text and choose Katalon Studio > Verify Text Present. If that still doesn’t work then I think you should post the HTML of the page (using inspection tool) so that a locator to the object can be recommended.
@luka.samac I don’t think verifyTextPresent is a specific enough test to determine if one specific “DCI…” element is active, as if one is and one is not, verifyTextPresent will test positive and you cannot guarantee which one was truly Active. I think a better test would be to check the text of the specific “DCI…” element and for that you will need to review the HTML.
I also haven’t found verifyElementText overly useful so I generally use verifyMatch as in:
WebUI.verifyMatch(WebUI.getAttribute(findTestObject(‘myPage/input_TestDate’), “value”), GlobalVariable.gScreenDisplayDate, false)
WebUI.verifyMatch(WebUI.getText(findTestObject(‘myPage/p_TestDate’)), GlobalVariable.gScreenDisplayDate, false)
but if you are just going for the text of the appropriate “DCI…” button, I think it would be better than the verifyTextPresent too.
Hi guys, thank you both for your comments.
I’ve solved it somehow, at the end I’ve used VerifyElementText. I’ve inspected a page, find exact location of this phrase, copied Xpath position inside object locator, and that worked.
I have a question, if I want to verify the particular text is present on the web page …what should I use…could you please help.
If the text can be anywhere on the page, then:
the boolean false is a flag if you want to you Regex (Regular Expression). In other words, you need something similar to your text but not exact. You should use the false unless you know specifically that you need to use Regex–because you need to know the components that make up Regex.
I use Regex to get the seconds on our page timestamp. Notice the asterisk after the Date and the Regex value is true.
WebUI.verifyTextPresent('Last Updated by ' + GlobalVariable.gUserName + ' on ' + GlobalVariable.gFormattedDate + ' .*', true)
If you want to get the text of a specific element, then you can use:
If your element is a textarea or input, there is also the possibility of the below:
WebUI.verifyElementAttributeValue(findTestObject('yourTO'), "value", 'yourElementsText', 10)
If you need to use Regex with the last two statements, then you could combine two statements as one: verifyMatch and getText or getAttribute.