Toast message in mobile testing - SeeTest

168 views Asked by At

I am automating on Mobile using SeeTest Automation Tool, and I need to validate the Toast Message. How to do it? I am using Selenium WebDriver and C#.

1

There are 1 answers

0
Darshan N S On

Inspect the toast element using SeeTest Studio. Add the inspected toast message as ToastMessage in Object repository. Use below code to verify toast message:

            Assert.IsTrue(
            client.WaitForElement(Zone, ToastMessage, 0, 30000),
            "ToastMessage is not displayed"
        );

Tis will wait for 30 seconds for the toast message to appear. If not the test will fail.

You can also make use of client.isElementFound method also. But since a toast message will appear for few seconds and disappear, WaitForElement is more suitable for this.