I’m using:
io.appium 6.1.0
selenium-java 3.11.0
guava 24.0-jre.
Try this:
String xmlFormat = driver.getPageSource();
if(xmlFormat.contains(“Your Toast Message Here”)){
System.out.println("Toast message displayed: "+yourToastMessage);
}
- The first line of instruction will give the xml format of the app page. In this, I got the toast message in one of the tags. It works for me.
You can put the getPageSource instruction after the desired activity, and since toast messages generally have 2 seconds of timeOut, so the above method will work.