1

Need your help with selendroid. Am a new to it and still learning the tricks.

Tried with the basic selendroid app example and the same with Skype apk, it worked perfectly. However, when tried with other app's apk like tripadvisor and dropbox, I keep getting error.

Following is my code and the error from console . Am using the version details from the manifest xml.

On further exploration - I compared the manifest xml file of skype, dropbox, etc ... and see permission tag with protection level as 'Signature' for dropbox, tripadvisor. However the same is not present in the skype manifest file. Could this be hindering with our code.

If so, is there any workaround?

Any help with this is much appreciated.

Code -

package testSelendroid;

import java.net.URL;

import io.selendroid.SelendroidCapabilities;
import io.selendroid.SelendroidDriver;
import io.selendroid.device.DeviceTargetPlatform;

import org.openqa.selenium.WebDriver;

public class selendroidNativeAppTest {


public static void main(String Args[])
{
    WebDriver driver = null ;

    //Below versions from Manifest files
    //com.skype.raider:3.2.0.6673
    //com.dropbox.android:2.3.8
    //io.selendroid.testapp:0.10.0

    SelendroidCapabilities caps = new SelendroidCapabilities("com.dropbox.android:2.3.8") ;
    System.out.println("I am here");
    caps.setPlatformVersion(DeviceTargetPlatform.ANDROID19);
    System.out.println("I just reached here");
    caps.setEmulator(true);
    System.out.println("Passed emulator");
    //caps.setCapability(CapabilityType.BROWSER_NAME, "Android");
    //caps.setCapability("app-package", "com.tripadvisor.tripadvisor:8.7.1-release");

    try {
        System.out.println("Let me try");
        driver = new SelendroidDriver(new URL("http://localhost:4444/wd/hub"), caps);
        System.out.println("Driver ...");
        driver.switchTo().window("NATIVE_APP");
        System.out.print("Got the app");
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }  

}
}

Console -

I am here
I just reached here
Passed emulator
Let me try
org.openqa.selenium.SessionNotCreatedException: Error occurred while starting selendroid-server on the device
io.selendroid.exceptions.SelendroidException: Error occurred while starting selendroid-server on the device
    at io.selendroid.android.impl.AbstractDevice.startSelendroid(AbstractDevice.java:235)
    at io.selendroid.server.model.SelendroidStandaloneDriver.createNewTestSession(SelendroidStandaloneDriver.java:290)
    at io.selendroid.server.handler.CreateSessionHandler.handle(CreateSessionHandler.java:42)
    at io.selendroid.server.SelendroidServlet.handleRequest(SelendroidServlet.java:142)
    at io.selendroid.server.BaseServlet.handleHttpRequest(BaseServlet.java:70)
    at org.webbitserver.netty.NettyHttpControl.nextHandler(NettyHttpControl.java:78)
    at org.webbitserver.netty.NettyHttpControl.nextHandler(NettyHttpControl.java:62)
    at org.webbitserver.handler.PathMatchHandler.handleHttpRequest(PathMatchHandler.java:33)
    at org.webbitserver.netty.NettyHttpControl.nextHandler(NettyHttpControl.java:78)
    at org.webbitserver.netty.NettyHttpControl.nextHandler(NettyHttpControl.java:62)
    at org.webbitserver.handler.DateHeaderHandler.handleHttpRequest(DateHeaderHandler.java:21)
    at org.webbitserver.netty.NettyHttpControl.nextHandler(NettyHttpControl.java:78)
    at org.webbitserver.netty.NettyHttpControl.nextHandler(NettyHttpControl.java:62)
    at org.webbitserver.handler.ServerHeaderHandler.handleHttpRequest(ServerHeaderHandler.java:25)
    at org.webbitserver.netty.NettyHttpControl.nextHandler(NettyHttpControl.java:78)
    at org.webbitserver.netty.NettyHttpControl.nextHandler(NettyHttpControl.java:67)
    at org.webbitserver.netty.NettyHttpChannelHandler$2.run(NettyHttpChannelHandler.java:72)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.Throwable: android.util.AndroidException: INSTRUMENTATION_FAILED: io.selendroid.com.dropbox.android/io.selendroid.ServerInstrumentation
    at com.android.commands.am.Am.runInstrument(Am.java:865)
    at com.android.commands.am.Am.onRun(Am.java:282)
    at com.android.internal.os.BaseCommand.run(BaseCommand.java:47)
    at com.android.commands.am.Am.main(Am.java:76)
    at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
    at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:243)
    at dalvik.system.NativeStart.main(Native Method)

Details:
INSTRUMENTATION_STATUS: id=ActivityManagerService
INSTRUMENTATION_STATUS: Error=Unable to find instrumentation target package: com.dropbox.android
INSTRUMENTATION_STATUS_CODE: -1
android.util.AndroidException: INSTRUMENTATION_FAILED: io.selendroid.com.dropbox.android/io.selendroid.ServerInstrumentation
    at com.android.commands.am.Am.runInstrument(Am.java:865)
    at com.android.commands.am.Am.onRun(Am.java:282)
    at com.android.internal.os.BaseCommand.run(BaseCommand.java:47)
    at com.android.commands.am.Am.main(Am.java:76)
    at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
    at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:243)
    at dalvik.system.NativeStart.main(Native Method)

    ... 20 more

Command duration or timeout: 320.45 seconds
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'ECXIPSAGT6504', ip: '172.25.2.91', os.name: 'Windows Server 2008 R2', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_51'
Driver info: io.selendroid.SelendroidDriver
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:193)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:595)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:126)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:139)
    at io.selendroid.SelendroidDriver.<init>(SelendroidDriver.java:63)
    at testSelendroid.selendroidNativeAppTest.main(selendroidNativeAppTest.java:36)
Caused by: io.selendroid.exceptions.SelendroidException: Error occurred while starting selendroid-server on the device
io.selendroid.exceptions.SelendroidException: Error occurred while starting selendroid-server on the device
    at io.selendroid.android.impl.AbstractDevice.startSelendroid(AbstractDevice.java:235)
    at io.selendroid.server.model.SelendroidStandaloneDriver.createNewTestSession(SelendroidStandaloneDriver.java:290)
    at io.selendroid.server.handler.CreateSessionHandler.handle(CreateSessionHandler.java:42)
    at io.selendroid.server.SelendroidServlet.handleRequest(SelendroidServlet.java:142)
    at io.selendroid.server.BaseServlet.handleHttpRequest(BaseServlet.java:70)
    at org.webbitserver.netty.NettyHttpControl.nextHandler(NettyHttpControl.java:78)
    at org.webbitserver.netty.NettyHttpControl.nextHandler(NettyHttpControl.java:62)
    at org.webbitserver.handler.PathMatchHandler.handleHttpRequest(PathMatchHandler.java:33)
    at org.webbitserver.netty.NettyHttpControl.nextHandler(NettyHttpControl.java:78)
    at org.webbitserver.netty.NettyHttpControl.nextHandler(NettyHttpControl.java:62)
    at org.webbitserver.handler.DateHeaderHandler.handleHttpRequest(DateHeaderHandler.java:21)
    at org.webbitserver.netty.NettyHttpControl.nextHandler(NettyHttpControl.java:78)
    at org.webbitserver.netty.NettyHttpControl.nextHandler(NettyHttpControl.java:62)
    at org.webbitserver.handler.ServerHeaderHandler.handleHttpRequest(ServerHeaderHandler.java:25)
    at org.webbitserver.netty.NettyHttpControl.nextHandler(NettyHttpControl.java:78)
    at org.webbitserver.netty.NettyHttpControl.nextHandler(NettyHttpControl.java:67)
    at org.webbitserver.netty.NettyHttpChannelHandler$2.run(NettyHttpChannelHandler.java:72)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.Throwable: android.util.AndroidException: INSTRUMENTATION_FAILED: io.selendroid.com.dropbox.android/io.selendroid.ServerInstrumentation
    at com.android.commands.am.Am.runInstrument(Am.java:865)
    at com.android.commands.am.Am.onRun(Am.java:282)
    at com.android.internal.os.BaseCommand.run(BaseCommand.java:47)
    at com.android.commands.am.Am.main(Am.java:76)
    at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
    at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:243)
    at dalvik.system.NativeStart.main(Native Method)

Details:
INSTRUMENTATION_STATUS: id=ActivityManagerService
INSTRUMENTATION_STATUS: Error=Unable to find instrumentation target package: com.dropbox.android
INSTRUMENTATION_STATUS_CODE: -1
android.util.AndroidException: INSTRUMENTATION_FAILED: io.selendroid.com.dropbox.android/io.selendroid.ServerInstrumentation
    at com.android.commands.am.Am.runInstrument(Am.java:865)
    at com.android.commands.am.Am.onRun(Am.java:282)
    at com.android.internal.os.BaseCommand.run(BaseCommand.java:47)
    at com.android.commands.am.Am.main(Am.java:76)
    at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
    at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:243)
    at dalvik.system.NativeStart.main(Native Method)

    ... 20 more
Scoffield
  • 11
  • 4

1 Answers1

0

Check the SelendroidCapabilities id. First run the server then go to Browser and run localhost URL at 4444 port

And if the Server returns the valid JSON then check the application ID and paste it into your SelendroidCapabilities("com.dropbox.android:2.3.8")

Then run the JAVA project. You will get rid from this problem. If you still find any problem. tell me Best luck