简体   繁体   中英

How can i get JSON data from a PUSH notification in Appium?

I am trying to automate a mobile application, using android, java and appium.

I am receiving a PUSH notification, which contains data from a JSON. Is there any way to get that data using appium, or something like that?

Im using this method to get the notifications:

((AndroidDriver) driver).openNotifications();

ArrayList<MobileElement> allnotifications = (ArrayList<MobileElement>) driver.findElements(By.id("android:id/title"));

for (MobileElement m : allnotifications) {
    System.out.println(m.getText());
    if(m.getText().contains("Zona Kit2-P1:  armado totalmente")){
        System.out.println("Notificación de Armado Encontrada Corretamente");
        break;
    }
}

Is there a way to do this?

Thanks!

Using Appium, only the UI can be tested. If you want to get your data from a JSON object you can use the rest assured library

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM