How to identify the labels in web testing

Hello,

I have a label/text get displayed as “Number of item found 0” when I have nothing return in my search. I have to capture this particular label. when i tried to capture this using web spy, its coming as “span_Number of item found 0”. object properties are shown in pic attached. Now in my script i have to verify whether this label is displayed or not. I have used verify element clickable, present etc. but nothing working. Every time it returns, element present even if this label is not displayed. Is there any other way to identify this label, "span_Number of item found 0"

Hi @neethu73

Did you try verifyElementVisible() ?

https://docs.katalon.com/katalon-studio/docs/webui-verify-element-visible.html

Regards !

Thanks it works. one more doubt,

Returns

Param Type Description
Boolean * true: the element is present and visible.
* false: the element is NOT present.

can we assign the returned value ‘true’ or ‘false’ to a variable (Boolean type) ? i kept a variable name in output but nothing got assigned.

Hi @neethu73

Did you do something like

def isPresent = WebUi.verifyElementVisible(TestObject);

It is supposed to assign the boolean value to your variable. Please post more information like screenshot and log files in case it really did not, because then it’s a bug.

Regards !

Hi @ThanhTo,

please find the log screenshot. I tried to capture the result to a Boolean variable ‘ispresent’. i tried to print the value of ‘isprsent’ but nothing returned. Please correct me if my steps mentioned in the screen is incorrect.

regards,
Neethu

Hi @neethu73

I think it is printed in Console Tab next to the Log View tab ? If not could you show me the content of that Console Tab ?

Regards !

Hello,

please find the content of the console tab.

Hello,

I think its coming fine, i am able to print both true and false in console, the below screen is for false condition

previous one was for true

thanks again!!

1 Like