Can I get text into a variable and use later in web testing?

I want to Get text into a variable as expected value and after some steps want to use it after some steps.
How to do add the variable and give it to value?
please help.
Thanks
Shruti

See: https://docs.katalon.com/display/KD/[WebUI]+Get+Text

Thanks Dave , I want to get text from a string and need to compare it with my text, can you help me out.

See: https://docs.katalon.com/display/KD/[WebUI]+Verify+Match

Thanks Dave for your reply,

I have another query regarding methods.

I want to create a common method to login on website and want to call that from my test cases.
How can i do that?

Thanks in advance,
Shruti

There are many ways to you can achieve this:
- Create a common test case and then call it in your main test cases. Please refer to sample WebUI project in Katalon Studio for this solution.
- Create a custom keyword and then use it as well:https://docs.katalon.com/display/KD/Define+custom+keywords

Hope it helps.

Regards

Vinh Nguyen said:

There are many ways to you can achieve this:
- Create a common test case and then call it in your main test cases. Please refer to sample WebUI project in Katalon Studio for this solution.
- Create a custom keyword and then use it as well:https://docs.katalon.com/display/KD/Define+custom+keywords

Hope it helps.

Regards

thank you, i will try this. Just want to know if i create a package in Keywords, i need to import also that package to my test case . i tried however dint get success.

i got to know that with Test Listeners also i can do .
well i will try now both the ways.

Vinh Nguyen said:

There are many ways to you can achieve this:
- Create a common test case and then call it in your main test cases. Please refer to sample WebUI project in Katalon Studio for this solution.
- Create a custom keyword and then use it as well:https://docs.katalon.com/display/KD/Define+custom+keywords

Hope it helps.

Regards

Hi Vinh,
I am trying the first option you had given,
i have written a login method in common test case however not able to run it, pls check the below screenshot:

method call issue.JPG

Hi Vinh,
I have corrected the mistake , pls ignore the previous comment.
Now performing same steps as provided in sample project however still not able to achieve this.
I am experiencing browser is opening multiple time in test and hence its not able to find the object.

Refer below screen shot,

issuewithmethod.JPG