I am trying to add an assertion on the shown toast message in my scenario, Is there a way to stop the screen to find the element of a toast message?
No, currently there is no way to pause the application with Appium. I doubt this would help you, cause the pause command probably would also come too late.
Maybe this is a functional issue, because if the message disappears so fast how can the user observe it? I would expect the message to show for X seconds, this should be long enough for an automated test to observe it.
Maybe you have some waits in your test that prevent it from polling just after the action that triggers the message. I don't have experience with Appium, but Selenium is so fast that things only show for milliseconds would be enough time to get the element and its text. I would expect this to be similar in Appium, so I would analyse your test execution step by step.
Alternatively, discuss this with the developers, make the toast message timeout configurable and change this for your test environment.
You can use below steps to capture that kind of elements
Install the selenium IDE in your browser and do the particular test manually and record it using selenium IDE.
When the message appear in the page click on that message before disappear.
Selenium IDE will capture that element and store it when you click on that element. (you will get notification)
You can use that captured xpath or id for your automation.