How to capture a message from webpage

Hello,

I have to capture an alert message which generate in my webpage whenever i save some details. The page looks like below.

Here I have to capture the message Add-Fax-123412341234-successful and show it in console? Is there a way for this?

Hi Neethu,

First, make the message as your object, make your locator as xpath or class as seen in the source.

I want to confirm this part, are you going to just print it on console?? if so, then do the code below:

//Check if the message is present
WebUI.verfiyElementVisible(findTestObject("your_message"))
or
WebUI.verifyElementPresent(findTestObject("your_message"), 30)

//to get the text or to capture it
String message = WebUI.getText(findTestObject("your_message"))
println message

The output of println will be displayed in the console. . .

Hope that helps. . . :slight_smile:

hello @neethu73
You can click the relevant message field and get the meso content with getText method.

https://docs.katalon.com/katalon-studio/docs/webui-get-text.html#description-

You can proceed by verifying that the text is on the page:
WebUI.verify Text Present (“Message”, false)
this code will return true or false in the console.

Thank you @Arnel @emine