0

I am new to appium, i configured appium with selenium it is working fine I am able to open the browser in my device and able to edit and do all the commands. But unable to open specified app, i gave the location correctly but it throws an error

A new session could not be created. (Original error: Bad app: E:\Appium\Apps\Recycle_Buddy\Recylebuddy.apk. App paths need to be absolute, or relative to the appium server install dir, or a URL to compressed file, or a special app name. cause: Error: Error locating the app: ENOENT, stat 'E:\Appium\Apps\Recycle_Buddy\Recylebuddy.apk') (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 46 milliseconds Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:33:15.31Z' System info: host: 'CYWD031', ip: '192.168.2.84', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_171'

In appium server following error occurs

info: --> POST /wd/hub/session {"desiredCapabilities":{"app":"E:\Appium\Apps\Recycle_Buddy\Recylebuddy.apk","appActivity":"com.myrecylebuddy.ui.splash.SplashActivity","appPackage":"com.myrecyclebuddy","browserName":"","deviceName":"4529a900","platformName":"Android","udid":"","version":"6.0.1"},"capabilities":{"desiredCapabilities":{"app":"E:\Appium\Apps\Recycle_Buddy\Recylebuddy.apk","appActivity":"com.myrecylebuddy.ui.splash.SplashActivity","appPackage":"com.myrecyclebuddy","browserName":"","deviceName":"4529a900","platformName":"Android","udid":"","version":"6.0.1"},"firstMatch":[{"browserName":"","platformName":"android"}]}} info: Client User-Agent string: Apache-HttpClient/4.5.3 (Java/1.8.0_171) info: [debug] The following desired capabilities were provided, but not recognized by appium. They will be passed on to any other services running on this server. : version info: [debug] Using local app from desired caps: E:\Appium\Apps\Recycle_Buddy\Recylebuddy.apk info: [debug] Got configuration error, not starting session info: [debug] Cleaning up appium session error: Failed to start an Appium session, err was: Error: Bad app: E:\Appium\Apps\Recycle_Buddy\Recylebuddy.apk. App paths need to be absolute, or relative to the appium server install dir, or a URL to compressed file, or a special app name. cause: Error: Error locating the app: ENOENT, stat 'E:\Appium\Apps\Recycle_Buddy\Recylebuddy.apk' info: [debug] Error: Bad app: E:\Appium\Apps\Recycle_Buddy\Recylebuddy.apk. App paths need to be absolute, or relative to the appium server install dir, or a URL to compressed file, or a special app name. cause: Error: Error locating the app: ENOENT, stat 'E:\Appium\Apps\Recycle_Buddy\Recylebuddy.apk' at [object Object]. (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android-common.js:56:13) at C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\device.js:82:16 at FSReqWrap.oncomplete (fs.js:95:15) info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Bad app: E:\Appium\Apps\Recycle_Buddy\Recylebuddy.apk. App paths need to be absolute, or relative to the appium server install dir, or a URL to compressed file, or a special app name. cause: Error: Error locating the app: ENOENT, stat 'E:\Appium\Apps\Recycle_Buddy\Recylebuddy.apk')","origValue":"Bad app: E:\Appium\Apps\Recycle_Buddy\Recylebuddy.apk. App paths need to be absolute, or relative to the appium server install dir, or a URL to compressed file, or a special app name. cause: Error: Error locating the app: ENOENT, stat 'E:\Appium\Apps\Recycle_Buddy\Recylebuddy.apk'"},"sessionId":null} info: <-- POST /wd/hub/session 500 2.157 ms - 700

This is my code

package demo;

import java.net.MalformedURLException;

import java.net.URL;

import java.io.File;

import org.junit.Test;

import org.openqa.selenium.By;

import org.openqa.selenium.remote.DesiredCapabilities;

import io.appium.java_client.MobileElement;

import io.appium.java_client.android.AndroidDriver;

import io.appium.java_client.remote.MobileCapabilityType;

public class StartChrome {

    private static AndroidDriver<MobileElement> driver;

    @Test

    public void test1() throws MalformedURLException{

         File appDir= new File("E:/Appium/Apps/Recycle_Buddy");

            File APP= new File(appDir,"Recylebuddy.apk");

    DesiredCapabilities capabilities= new DesiredCapabilities();

     capabilities.setCapability(MobileCapabilityType.BROWSER_NAME,"" );

capabilities.setCapability(MobileCapabilityType.PLATFORM,Platform.ANDROID);

    capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME,"Android");

      capabilities.setCapability(MobileCapabilityType.APP, 
APP.getAbsolutePath());

     capabilities.setCapability(MobileCapabilityType.DEVICE_NAME,"4529a900");

         capabilities.setCapability(MobileCapabilityType.UDID, "");

       capabilities.setCapability(MobileCapabilityType.VERSION,"6.0.1");

       capabilities.setCapability("appPackage", "com.myrecyclebuddy");

       capabilities.setCapability("appActivity", 
"com.myrecylebuddy.ui.splash.SplashActivity");

         driver = new AndroidDriver<MobileElement>(new 
URL("http://127.0.0.1:47334/wd/hub"), capabilities);


driver.findElement(By.id("com.myrecyclebuddy:id/email")).sendKeys("vinu@custo
mer.com");


driver.findElement(By.id("com.myrecyclebuddy:id/password")).sendKeys("qwerty@
123");





    driver.findElement(By.id("com.myrecyclebuddy:id/loginButton")).click();





    driver.quit();

    }

}
  • Please add the appropriate snippet of code to your original post to show how you are attempting to launch the app. – Bill Hileman May 31 '18 at 13:36
  • Possibly related: stackoverflow.com/questions/34459794/… – trashpanda May 31 '18 at 13:36
  • Either the app does not exist or it is corrupt, would be my guess. Your code looks okay. – Bill Hileman Jun 1 '18 at 13:32
0

In most of the automation testing company we usually don't follow the same structure i.e. writing the script on the same page where we are initiating the driver and passing the capabilities. But since you are new to automation its a practice for you. Please try the below code and hopefully it will work. Please revert in case if it wont along with the errors. Please change the capabilities as per requirement.

public class StartChrome {

private AndroidDriver driver;

    @Test
    public void ftest1() throws MalformedURLException {
     DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability("appium-version", "1.0");
        capabilities.setCapability("platformName", "Android");
        capabilities.setCapability("platformVersion", "6.0.1");
        capabilities.setCapability("deviceName", "Nexus");
        capabilities.setCapability("app", "E:/Appium/Apps/Recycle_Buddy/Recylebuddy.apk");
        capabilities.setCapability("appPackage", "com.myrecyclebuddy");
        capabilities.setCapability("appActivity", "com.myrecylebuddy.ui.splash.SplashActivity");
        driver = new AndroidDriver(new URL("http://0.0.0.0:4723/wd/hub"), capabilities);

driver.findElement(By.id("com.myrecyclebuddy:id/email")).sendKeys("vinu@customer.com");

driver.findElement(By.id("com.myrecyclebuddy:id/password")).sendKeys("qwerty@123");

driver.findElement(By.id("com.myrecyclebuddy:id/loginButton")).click();

driver.quit();

    }

    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.