javaappiumautotest

Application launch without elements


When I starting application without appium I get this form: enter image description here

When I use appium for application launching elements are disappearing: enter image description here Anybody know why it happens?

Java code:

    String appPackage = "appPName";
    String appActivity = "appAName";

    DesiredCapabilities cap = new DesiredCapabilities();
    cap.setCapability("platformName", "Android");
    cap.setCapability("deviceName", "Custom Phone");
    cap.setCapability("platformVersion", "6.0");
    cap.setCapability("appPackage", appPackage);
    cap.setCapability("appActivity", appActivity);
    cap.setCapability("autoGrantPermissions", "true");

    System.out.println("---------------------------------Create session---------------------------------");
    URL device_url = new URL("http://localhost:4723/wd/hub");
    try
    {
        driver = new AndroidDriver(device_url, cap);
    }
    catch(Exception ex)
    {
        System.out.println(ex.getMessage());
    }
    System.out.println("----------------------------------Is the application installed?--------------------------------");
    applicationInstalled = driver.isAppInstalled(appPackage);

    System.out.println("Application installed status: " + applicationInstalled);
    System.out.println("------------------------------------------------------------------");   
    driver.quit();

Solution

  • Use below capabilities and try.

      capabilities.setCapability(MobileCapabilityType.FULL_RESET, false);
      capabilities.setCapability(MobileCapabilityType.NO_RESET, true);
    

    Also, please don't try re-install the app every time you initialize the driver.