需要你的selendroid帮助。我是新手,还在学习技巧。
尝试使用基本的selendroid应用程序示例和Skype apk相同,它运行得很好。 但是,当尝试使用其他应用程序的apk如tripadvisor和dropbox时,我一直都会收到错误。
以下是我的代码和来自控制台的错误。我使用了清单xml中的版本详细信息。
进一步探索 - 我比较了skype,dropbox等的清单xml文件,并将保护级别的权限标记看作dropbox,tripadvisor的“签名”。但是,skype清单文件中不存在相同的内容。这可能会妨碍我们的代码。
如果有,是否有解决方法?
非常感谢任何帮助。
代码 -
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();
}
}
}
控制台 -
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
答案 0 :(得分:0)
检查SelendroidCapabilities ID。 首先运行服务器,然后转到浏览器并在4444端口运行localhost URL
如果服务器返回有效的JSON,请检查应用程序ID并将其粘贴到您的 SelendroidCapabilities(&#34; com.dropbox.android:2.3.8&#34)
然后运行JAVA项目。 你将摆脱这个问题。 如果你仍然发现任何问题。告诉我 祝你好运