2
@BeforeSuite
public void setUp() throws Exception {
    //Start selendroid-standalone during test
    SelendroidConfiguration config = new SelendroidConfiguration();

    // Add the selendroid-test-app to the standalone server
    config.addSupportedApp("F:\\Seleandriod\\OFCOne.apk");

    //start the standalone server
    SelendroidLauncher selendroidServer = new SelendroidLauncher(config);
    selendroidServer.launchSelendroid();

    // Create the selendroid capabilities
    SelendroidCapabilities capa = new SelendroidCapabilities();

    // Specify to use selendroid's test app
    capa.setAut("io.selendroid.androiddriver:0.11.0");

    // Specify to use the Android device API 19
    capa.setPlatformVersion(DeviceTargetPlatform.ANDROID19);

    // Don't request simulator, use real device
    capa.setEmulator(false);

    //capa.wait(10000000);

    // Create instance of Selendroid Driver
    driver = new SelendroidDriver(capa);

We are using HYBRID cordova app, the execution fails at the line where SelendroidDriver(capa); is getting initialized with the following error:

"The requested application under test is not configured in selendroid server"

We are using selendroid-standalone-0.11.0-with-dependencies version.

We have run on command line:

java -jar selendroid-standalone-0.11.0-with-dependencies -aut OFCOne.apk

Its giving following error:

"SEVERE: Error building server: The base package name of the apk resigned-OFCOne.apk cannot be extracted."

please give me some suggestion to resolve this error.

  • Just making sure config.addSupportedApp("F:\\Seleandriod\\OFCOne.apk"); <- Is this the selendroid testapp, or is it your own app? If it is your own app capa.setAut("io.selendroid.androiddriver:0.11.0"); <- This should be your app's id. – Madis Kangro Jul 08 '15 at 07:35
  • yes ("F:\\Seleandriod\\OFCOne.apk"); is our own app and if u refer to my above code we are already calling capa.setAut("io.selendroid.androiddriver:0.11.0"); but still it doesnt seem to work. what else might be wrong? – Abhishek Math Jul 08 '15 at 11:31
  • You should be calling your own app id. Also there might be an issue if you have the app already installed on your phone. capa.setAut("io.selendroid.androiddriver:0.11.0"); <- This is the android driver app id, but it has to be id of the app your testing. Hence why are you getting "The requested application under test is not configured in selendroid server" error. – Madis Kangro Jul 09 '15 at 07:10
  • 1. i have tried even after uninstalling the app from my phone however it's still give the same error 2. The app id io.selendroid.androiddriver:0.11.0 is displayed for my app on the hub status http://localhost:4444/wd/hub/status {"supportedApps":[{"appId":"io.selendroid.androiddriver:0.11.0","mainActivity":"io.selendroid.androiddriver.WebViewActivity","basePackage":"io.selendroid.androiddriver"}], – Abhishek Math Jul 09 '15 at 08:44
  • "supportedApps":[{"mainActivity":"io.selendroid.testapp.HomeScreenActivity","appId":"io.selendroid.testapp:0.12.0","basePackage":"io.selendroid.testapp"},{"mainActivity":"io.selendroid.androiddriver.WebViewActivity","appId":"io.selendroid.androiddriver:0.13.0","basePackage":"io.selendroid.androiddriver"}]},"status":0} My hub status. There is the androiddriver id and my app id (which currently is the selendroid test app i downloaded from the site). The problem might be also that you are using an older selendroid standalone version. 0.15 is currently out, so you might wanna try with that also. – Madis Kangro Jul 09 '15 at 08:58
  • i have tried with selendroid standalone version. 0.15 earlier but with this verision the server startup itself fails. however both 0.15 and 0.11 seem to work fine with native test apps. i am facing issues specifically with cordova hybrid android app. – Abhishek Math Jul 09 '15 at 09:25
  • Ah i forgot the small detail. Cordova Hybrid apps require some newer selendroid standalone servers. Try selendroid server standalone 0.14. They fixed some issues with newer cordova apps. fixed support for Cordova 3.6.x apps https://github.com/selendroid/selendroid/releases/ Give it a shot and let me know if it worked or not – Madis Kangro Jul 09 '15 at 10:52
  • tried with the version 0.14 and 0.13 and also 0.15 gives me following error during selendroidsever startup Jul 09, 2015 4:45:31 PM io.selendroid.standalone.SelendroidLauncher launchServer SEVERE: Error building server: The base package name of the apk resigned-OFCOne.apk cannot be extracted. Exception in thread "main" io.selendroid.server.common.exceptions.SelendroidException: The base package name of the apk resigned-OFCOne.apk cannot be extracted. – Abhishek Math Jul 09 '15 at 11:17
  • our cordova android version is 3.6.4 does that have to do anything with this issue? – Abhishek Math Jul 09 '15 at 11:29
  • It should work with selendroid versions 0.14 and up. Hmm could you do me a favour and run this command from the command line. aapt dump badging "F:\\Seleandriod\\OFCOne.apk" what output do you get. – Madis Kangro Jul 09 '15 at 11:40
  • when i run the above command i get following error application: label='OFCOne' icon='res/drawable-mdpi-v4/sf__icon.png' application-debuggable launchable-activity: name='com.salesforce.androidsdk.ui.sfhybrid.SalesforceDroidGapActivity' label='OFCOne' icon='' ERROR getting 'name' attribute: attribute is not a string value – Abhishek Math Jul 09 '15 at 12:03
  • This seems the be cause of the problem, but not sure how to get rid of it. – Madis Kangro Jul 09 '15 at 12:07

2 Answers2

0
  capa.setAut("io.selendroid.androiddriver:0.11.0");

Here should be your appId not the appId for the selendroid. Most probably your appId will be your_app_package_name:version. Using http://localhost:4444/wd/hub/status you can get your appId and the first appId is not your appId it is the appId for selendroid server driver app being installed on your device. The second appId will be your appId. Please use it instead what you have used in he above line of code.

Sandeep Singh
  • 745
  • 4
  • 20
0

I just have met the same issue. The reason is wrong path to your .apk file. And I not sure about absolute path, I used relative path

config.addSupportedApp("src/resources/myapp.apk");

Hope this help!

Huy Hóm Hỉnh
  • 597
  • 7
  • 18