系统信息:
当我运行android-sdk \ extras \ google \ webdriver \ TestAnAndroidWebApp
我收到错误消息:测试运行失败:由于“进程崩溃”导致仪表运行失败。
执行第'WebElement searchBox = driver.findElement(By.name(“q”));'
行时,测试失败public void testGoogleWorks() {
driver.getWebView().getSettings().setUserAgentString("Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.8 (KHTML, like Gecko) Chrome/17.0.928.0 Safari/535.8");
Log.d(getName(), "xxxxxxxxx");
driver.get("http://www.google.com.hk");
Log.d(getName(), driver.getCurrentUrl());
WebElement searchBox = driver.findElement(By.name("q"));
Log.d(getName(),searchBox.getTagName());
//Log.d(getName(),searchBox.getText());
//searchBox.sendKeys("Android Rocks!");
//searchBox.submit();
//String title = driver.getTitle();
//assertTrue("Got title: " + title, title.contains("Google"));
//assertTrue(driver.findElements(By.partialLinkText("Android")).size() > 1);
}
logcat:
11-11 05:53:02.140: W/dalvikvm(521): JNI WARNING: jarray 0x4051a360 points to non-array object (Ljava/lang/String;)
11-11 05:53:02.140: I/dalvikvm(521): "WebViewCoreThread" prio=5 tid=10 NATIVE
11-11 05:53:02.140: I/dalvikvm(521): | group="main" sCount=0 dsCount=0 obj=0x405dcaf8 self=0x2bcfb8
11-11 05:53:02.140: I/dalvikvm(521): | sysTid=530 nice=-1 sched=0/0 cgrp=default handle=2903008
11-11 05:53:02.140: I/dalvikvm(521): | schedstat=( 13138242077 3658568912 366 )
11-11 05:53:02.140: I/dalvikvm(521): at android.webkit.BrowserFrame.stringByEvaluatingJavaScriptFromString(Native Method)
11-11 05:53:02.150: I/dalvikvm(521): at android.webkit.BrowserFrame.stringByEvaluatingJavaScriptFromString(Native Method)
11-11 05:53:02.181: I/dalvikvm(521): at android.webkit.BrowserFrame.loadUrl(BrowserFrame.java:246)
11-11 05:53:02.181: I/dalvikvm(521): at android.webkit.WebViewCore.loadUrl(WebViewCore.java:1570)
11-11 05:53:02.181: I/dalvikvm(521): at android.webkit.WebViewCore.access$1400(WebViewCore.java:53)
11-11 05:53:02.181: I/dalvikvm(521): at android.webkit.WebViewCore$EventHub$1.handleMessage(WebViewCore.java:956)
11-11 05:53:02.181: I/dalvikvm(521): at android.os.Handler.dispatchMessage(Handler.java:99)
11-11 05:53:02.181: I/dalvikvm(521): at android.os.Looper.loop(Looper.java:123)
11-11 05:53:02.181: I/dalvikvm(521): at android.webkit.WebViewCore$WebCoreThread.run(WebViewCore.java:629)
11-11 05:53:02.181: I/dalvikvm(521): at java.lang.Thread.run(Thread.java:1019)
11-11 05:53:02.181: E/dalvikvm(521): VM aborting
以下完整日志:
11-11 05:52:11.550: D/AndroidRuntime(473): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
11-11 05:52:11.550: D/AndroidRuntime(473): CheckJNI is ON
11-11 05:52:12.350: D/AndroidRuntime(473): Calling main entry com.android.commands.pm.Pm
11-11 05:52:12.381: D/AndroidRuntime(473): Shutting down VM
11-11 05:52:12.400: D/dalvikvm(473): GC_CONCURRENT freed 101K, 71% free 297K/1024K, external 0K/0K, paused 1ms+1ms
11-11 05:52:12.400: D/dalvikvm(473): Debugger has detached; object registry had 1 entries
11-11 05:52:12.443: I/AndroidRuntime(473): NOTE: attach of thread 'Binder Thread #3' failed
11-11 05:52:13.060: D/AndroidRuntime(483): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
11-11 05:52:13.060: D/AndroidRuntime(483): CheckJNI is ON
11-11 05:52:13.930: D/AndroidRuntime(483): Calling main entry com.android.commands.pm.Pm
11-11 05:52:14.003: D/AndroidRuntime(483): Shutting down VM
11-11 05:52:14.010: D/dalvikvm(483): GC_CONCURRENT freed 101K, 71% free 297K/1024K, external 0K/0K, paused 1ms+1ms
11-11 05:52:14.010: D/dalvikvm(483): Debugger has detached; object registry had 1 entries
11-11 05:52:14.021: I/AndroidRuntime(483): NOTE: attach of thread 'Binder Thread #3' failed
11-11 05:52:14.840: D/AndroidRuntime(493): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
11-11 05:52:14.840: D/AndroidRuntime(493): CheckJNI is ON
11-11 05:52:17.101: D/AndroidRuntime(493): Calling main entry com.android.commands.am.Am
11-11 05:52:17.241: I/ActivityManager(70): Force stopping package simple.app uid=10036
11-11 05:52:17.311: I/ActivityManager(70): Start proc simple.app for added application simple.app: pid=501 uid=10036 gids={3003, 1015}
11-11 05:52:21.352: D/dalvikvm(501): GC_CONCURRENT freed 1448K, 61% free 2683K/6727K, external 1625K/2137K, paused 19ms+26ms
11-11 05:52:22.524: D/dalvikvm(501): GC_CONCURRENT freed 376K, 57% free 2903K/6727K, external 1625K/2137K, paused 15ms+21ms
11-11 05:52:23.501: D/dalvikvm(501): GC_CONCURRENT freed 748K, 59% free 2825K/6727K, external 1625K/2137K, paused 14ms+21ms
11-11 05:52:24.291: D/dalvikvm(501): GC_CONCURRENT freed 690K, 59% free 2777K/6727K, external 1625K/2137K, paused 32ms+19ms
11-11 05:52:25.142: D/dalvikvm(501): GC_CONCURRENT freed 536K, 58% free 2869K/6727K, external 1625K/2137K, paused 14ms+14ms
11-11 05:52:26.011: I/TestRunner(501): started: testGoogleWorks(simple.app.test.SimpleGoogleTest)
11-11 05:52:26.150: I/TestRunner(501): finished: testGoogleWorks(simple.app.test.SimpleGoogleTest)
11-11 05:52:26.150: I/TestRunner(501): passed: testGoogleWorks(simple.app.test.SimpleGoogleTest)
11-11 05:52:26.201: I/ActivityManager(70): Force stopping package simple.app uid=10036
11-11 05:52:26.201: I/Process(70): Sending signal. PID: 501 SIG: 9
11-11 05:52:26.280: D/AndroidRuntime(493): Shutting down VM
11-11 05:52:26.331: I/AndroidRuntime(493): NOTE: attach of thread 'Binder Thread #3' failed
11-11 05:52:26.350: D/dalvikvm(493): GC_CONCURRENT freed 111K, 71% free 298K/1024K, external 0K/0K, paused 3ms+16ms
11-11 05:52:26.350: D/jdwp(493): Got wake-up signal, bailing out of select
11-11 05:52:26.350: D/dalvikvm(493): Debugger has detached; object registry had 1 entries
11-11 05:52:27.571: D/AndroidRuntime(513): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
11-11 05:52:27.580: D/AndroidRuntime(513): CheckJNI is ON
11-11 05:52:29.420: D/AndroidRuntime(513): Calling main entry com.android.commands.am.Am
11-11 05:52:29.550: I/ActivityManager(70): Force stopping package simple.app uid=10036
11-11 05:52:29.620: I/ActivityManager(70): Start proc simple.app for added application simple.app: pid=521 uid=10036 gids={3003, 1015}
11-11 05:52:32.103: D/dalvikvm(521): GC_CONCURRENT freed 1449K, 61% free 2682K/6727K, external 1625K/2137K, paused 15ms+23ms
11-11 05:52:32.830: D/dalvikvm(521): GC_CONCURRENT freed 376K, 57% free 2901K/6727K, external 1625K/2137K, paused 14ms+16ms
11-11 05:52:33.760: D/dalvikvm(521): GC_CONCURRENT freed 748K, 59% free 2823K/6727K, external 1625K/2137K, paused 14ms+15ms
11-11 05:52:34.410: D/dalvikvm(521): GC_CONCURRENT freed 690K, 59% free 2775K/6727K, external 1625K/2137K, paused 14ms+15ms
11-11 05:52:35.070: D/dalvikvm(521): GC_CONCURRENT freed 536K, 58% free 2866K/6727K, external 1625K/2137K, paused 28ms+14ms
11-11 05:52:35.730: I/TestRunner(521): started: testGoogleWorks(simple.app.test.SimpleGoogleTest)
11-11 05:52:35.780: I/ActivityManager(70): Starting: Intent { act=android.intent.action.MAIN flg=0x10000000 cmp=simple.app/.SimpleAppActivity } from pid 521
11-11 05:52:36.900: D/dalvikvm(521): GC_CONCURRENT freed 746K, 60% free 2703K/6727K, external 1625K/2137K, paused 15ms+95ms
11-11 05:52:38.220: I/ActivityManager(70): Displayed simple.app/.SimpleAppActivity: +2s319ms
11-11 05:52:39.621: D/testGoogleWorks(521): xxxxxxxxx
11-11 05:52:41.241: W/InputManagerService(70): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@4057d348 (uid=10013 pid=136)
11-11 05:52:43.522: D/dalvikvm(136): GC_EXPLICIT freed 12K, 52% free 2878K/5895K, external 4652K/5293K, paused 186ms
11-11 05:52:49.310: D/dalvikvm(521): GC_CONCURRENT freed 121K, 54% free 3104K/6727K, external 2002K/2137K, paused 28ms+30ms
11-11 05:53:01.191: D/testGoogleWorks(521): http://www.google.com.hk/
11-11 05:53:01.390: D/dalvikvm(521): GC_FOR_MALLOC freed 254K, 49% free 3475K/6727K, external 2002K/2137K, paused 103ms
11-11 05:53:01.590: D/dalvikvm(521): GC_FOR_MALLOC freed 69K, 47% free 3834K/7111K, external 2002K/2137K, paused 69ms
11-11 05:53:01.782: D/dalvikvm(521): GC_FOR_MALLOC freed 44K, 44% free 4225K/7495K, external 2002K/2137K, paused 68ms
11-11 05:53:02.140: W/dalvikvm(521): JNI WARNING: jarray 0x4051a360 points to non-array object (Ljava/lang/String;)
11-11 05:53:02.140: I/dalvikvm(521): "WebViewCoreThread" prio=5 tid=10 NATIVE
11-11 05:53:02.140: I/dalvikvm(521): | group="main" sCount=0 dsCount=0 obj=0x405dcaf8 self=0x2bcfb8
11-11 05:53:02.140: I/dalvikvm(521): | sysTid=530 nice=-1 sched=0/0 cgrp=default handle=2903008
11-11 05:53:02.140: I/dalvikvm(521): | schedstat=( 13138242077 3658568912 366 )
11-11 05:53:02.140: I/dalvikvm(521): at android.webkit.BrowserFrame.stringByEvaluatingJavaScriptFromString(Native Method)
11-11 05:53:02.150: I/dalvikvm(521): at android.webkit.BrowserFrame.stringByEvaluatingJavaScriptFromString(Native Method)
11-11 05:53:02.181: I/dalvikvm(521): at android.webkit.BrowserFrame.loadUrl(BrowserFrame.java:246)
11-11 05:53:02.181: I/dalvikvm(521): at android.webkit.WebViewCore.loadUrl(WebViewCore.java:1570)
11-11 05:53:02.181: I/dalvikvm(521): at android.webkit.WebViewCore.access$1400(WebViewCore.java:53)
11-11 05:53:02.181: I/dalvikvm(521): at android.webkit.WebViewCore$EventHub$1.handleMessage(WebViewCore.java:956)
11-11 05:53:02.181: I/dalvikvm(521): at android.os.Handler.dispatchMessage(Handler.java:99)
11-11 05:53:02.181: I/dalvikvm(521): at android.os.Looper.loop(Looper.java:123)
11-11 05:53:02.181: I/dalvikvm(521): at android.webkit.WebViewCore$WebCoreThread.run(WebViewCore.java:629)
11-11 05:53:02.181: I/dalvikvm(521): at java.lang.Thread.run(Thread.java:1019)
11-11 05:53:02.181: E/dalvikvm(521): VM aborting
11-11 05:53:02.350: I/DEBUG(31): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
11-11 05:53:02.350: I/DEBUG(31): Build fingerprint: 'generic/sdk/generic:2.3.3/GRI34/101070:eng/test-keys'
11-11 05:53:02.350: I/DEBUG(31): pid: 521, tid: 530 >>> simple.app <<<
11-11 05:53:02.350: I/DEBUG(31): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadd00d
11-11 05:53:02.350: I/DEBUG(31): r0 fffffec4 r1 deadd00d r2 00000026 r3 00000000
11-11 05:53:02.350: I/DEBUG(31): r4 800a45c0 r5 4051a360 r6 80085acc r7 002bd0f0
11-11 05:53:02.350: I/DEBUG(31): r8 44466b50 r9 43eb6e20 10 43eb6e08 fp 41edd8a0
11-11 05:53:02.350: I/DEBUG(31): ip 800a4720 sp 44466678 lr afd19375 pc 80045a4a cpsr 20000030
11-11 05:53:02.771: I/DEBUG(31): #00 pc 00045a4a /system/lib/libdvm.so
11-11 05:53:02.771: I/DEBUG(31): #01 pc 00037748 /system/lib/libdvm.so
11-11 05:53:02.780: I/DEBUG(31): #02 pc 00039a10 /system/lib/libdvm.so
11-11 05:53:02.790: I/DEBUG(31): #03 pc 0003a4ec /system/lib/libdvm.so
11-11 05:53:02.790: I/DEBUG(31): #04 pc 002989d6 /system/lib/libwebcore.so
11-11 05:53:02.803: I/DEBUG(31): #05 pc 002120a4 /system/lib/libwebcore.so
11-11 05:53:02.810: I/DEBUG(31): #06 pc 00113216 /system/lib/libwebcore.so
11-11 05:53:02.821: I/DEBUG(31): #07 pc 00212b70 /system/lib/libwebcore.so
11-11 05:53:02.830: I/DEBUG(31): #08 pc 002c716e /system/lib/libwebcore.so
11-11 05:53:02.830: I/DEBUG(31): #09 pc 002ca646 /system/lib/libwebcore.so
11-11 05:53:02.850: I/DEBUG(31): #10 pc 002d0bfa /system/lib/libwebcore.so
11-11 05:53:02.860: I/DEBUG(31): #11 pc 0010c7da /system/lib/libwebcore.so
11-11 05:53:02.871: I/DEBUG(31): #12 pc 0010c860 /system/lib/libwebcore.so
11-11 05:53:02.880: I/DEBUG(31): #13 pc 00110e6a /system/lib/libwebcore.so
11-11 05:53:02.880: I/DEBUG(31): #14 pc 00110fca /system/lib/libwebcore.so
11-11 05:53:02.901: I/DEBUG(31): #15 pc 0011c496 /system/lib/libwebcore.so
11-11 05:53:02.901: I/DEBUG(31): #16 pc 00017d74 /system/lib/libdvm.so
11-11 05:53:02.911: I/DEBUG(31): #17 pc 00048f54 /system/lib/libdvm.so
11-11 05:53:02.911: I/DEBUG(31): #18 pc 00041b16 /system/lib/libdvm.so
11-11 05:53:02.930: I/DEBUG(31): #19 pc 0001cfd4 /system/lib/libdvm.so
11-11 05:53:02.930: I/DEBUG(31): #20 pc 000220dc /system/lib/libdvm.so
11-11 05:53:02.930: I/DEBUG(31): #21 pc 00020fd0 /system/lib/libdvm.so
11-11 05:53:02.951: I/DEBUG(31): #22 pc 0005f430 /system/lib/libdvm.so
11-11 05:53:02.951: I/DEBUG(31): #23 pc 0005f656 /system/lib/libdvm.so
11-11 05:53:02.960: I/DEBUG(31): #24 pc 00053b4e /system/lib/libdvm.so
11-11 05:53:02.971: I/DEBUG(31): #25 pc 00011a7c /system/lib/libc.so
11-11 05:53:02.971: I/DEBUG(31): #26 pc 00011640 /system/lib/libc.so
11-11 05:53:02.971: I/DEBUG(31): code around pc:
11-11 05:53:02.971: I/DEBUG(31): 80045a28 447a4479 ed0cf7d1 20004c09 ee34f7d1
11-11 05:53:02.971: I/DEBUG(31): 80045a38 447c4808 6bdb5823 d0002b00 49064798
11-11 05:53:02.982: I/DEBUG(31): 80045a48 700a2226 eea0f7d1 000436b7 00045275
11-11 05:53:02.982: I/DEBUG(31): 80045a58 0005eb82 fffffec4 deadd00d b510b40e
11-11 05:53:02.990: I/DEBUG(31): 80045a68 4c0a4b09 447bb083 aa05591b 6b5bca02
11-11 05:53:02.990: I/DEBUG(31): code around lr:
11-11 05:53:03.001: I/DEBUG(31): afd19354 b0834a0d 589c447b 26009001 686768a5
11-11 05:53:03.001: I/DEBUG(31): afd19364 220ce008 2b005eab 1c28d003 47889901
11-11 05:53:03.001: I/DEBUG(31): afd19374 35544306 d5f43f01 2c006824 b003d1ee
11-11 05:53:03.010: I/DEBUG(31): afd19384 bdf01c30 000281a8 ffffff88 1c0fb5f0
11-11 05:53:03.020: I/DEBUG(31): afd19394 43551c3d a904b087 1c16ac01 604d9004
11-11 05:53:03.020: I/DEBUG(31): stack:
11-11 05:53:03.020: I/DEBUG(31): 44466638 00000015
11-11 05:53:03.020: I/DEBUG(31): 4446663c afd18407 /system/lib/libc.so
11-11 05:53:03.020: I/DEBUG(31): 44466640 afd4270c /system/lib/libc.so
11-11 05:53:03.020: I/DEBUG(31): 44466644 afd426b8 /system/lib/libc.so
11-11 05:53:03.030: I/DEBUG(31): 44466648 00000000
11-11 05:53:03.030: I/DEBUG(31): 4446664c afd19375 /system/lib/libc.so
11-11 05:53:03.030: I/DEBUG(31): 44466650 002bcfb8 [heap]
11-11 05:53:03.030: I/DEBUG(31): 44466654 afd183d9 /system/lib/libc.so
11-11 05:53:03.040: I/DEBUG(31): 44466658 002bd0f0 [heap]
11-11 05:53:03.040: I/DEBUG(31): 4446665c 0005eb82 [heap]
11-11 05:53:03.040: I/DEBUG(31): 44466660 4051a360 /dev/ashmem/dalvik-heap (deleted)
11-11 05:53:03.040: I/DEBUG(31): 44466664 80085acc /system/lib/libdvm.so
11-11 05:53:03.050: I/DEBUG(31): 44466668 002bd0f0 [heap]
11-11 05:53:03.060: I/DEBUG(31): 4446666c afd18437 /system/lib/libc.so
11-11 05:53:03.060: I/DEBUG(31): 44466670 df002777
11-11 05:53:03.060: I/DEBUG(31): 44466674 e3a070ad
11-11 05:53:03.060: I/DEBUG(31): #00 44466678 00000001
11-11 05:53:03.073: I/DEBUG(31): 4446667c 8003774d /system/lib/libdvm.so
11-11 05:53:03.081: I/DEBUG(31): #01 44466680 00000001
11-11 05:53:03.081: I/DEBUG(31): 44466684 80039a15 /system/lib/libdvm.so
11-11 05:53:08.532: I/BootReceiver(70): Copying /data/tombstones/tombstone_04 to DropBox (SYSTEM_TOMBSTONE)
11-11 05:53:08.612: D/Zygote(33): Process 521 terminated by signal (11)
11-11 05:53:08.630: E/InputDispatcher(70): channel '40795038 simple.app/simple.app.SimpleAppActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x8
11-11 05:53:08.630: E/InputDispatcher(70): channel '40795038 simple.app/simple.app.SimpleAppActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
11-11 05:53:08.641: I/ActivityManager(70): Process simple.app (pid 521) has died.
11-11 05:53:08.651: I/WindowManager(70): WIN DEATH: Window{40795038 simple.app/simple.app.SimpleAppActivity paused=false}
11-11 05:53:08.902: D/dalvikvm(70): GC_FOR_MALLOC freed 806K, 48% free 4535K/8647K, external 3125K/3903K, paused 91ms
11-11 05:53:08.931: W/ActivityManager(70): Crash of app simple.app running instrumentation ComponentInfo{simple.app.test/android.test.InstrumentationTestRunner}
11-11 05:53:08.941: D/AndroidRuntime(513): Shutting down VM
11-11 05:53:08.941: I/ActivityManager(70): Force stopping package simple.app uid=10036
11-11 05:53:09.001: I/AndroidRuntime(513): NOTE: attach of thread 'Binder Thread #3' failed
11-11 05:53:09.041: D/dalvikvm(513): GC_CONCURRENT freed 108K, 71% free 299K/1024K, external 0K/0K, paused 1ms+2ms
11-11 05:53:09.041: D/jdwp(513): Got wake-up signal, bailing out of select
11-11 05:53:09.041: D/dalvikvm(513): Debugger has detached; object registry had 1 entries
11-11 05:53:09.251: W/InputManagerService(70): Got RemoteException sending setActive(false) notification to pid 521 uid 10036
答案 0 :(得分:0)
我在这里得到了同样的错误,我修复了这个程序:
确保在UI线程上调用驱动程序,如下所示:
this.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
//load your driver here
}
});
确保您正在测试的活动或组件可见。
getActivity.finish()
并调用 this.finishOpenedActivities()
< / strong>在你的tearDown()方法中希望这可以帮助你......祝你好运