Appium [新手求助] appium-java 登录与退出测试,提示错误。

王李婷 · 2015年09月24日 · 最后由 回复于 2017年05月23日 · 2349 次阅读

我先描述下我的环境:Appium win7 java
测试的设备是:android 2.3
我遇到的问题是:测试用例仅执行到点击登陆按钮,appium 不会有任何问题。若我在登陆后进行登出测试,则 appium 报错。
报错信息如下:

info: [debug] Selendroid server is alive!
info: [debug] Listening for Selendroid logs
info: [debug] Creating Selendroid session
info: [debug] Making http request with opts: {"url":"http://localhost:8080/wd/hub/session","method":
"POST","json":{"desiredCapabilities":{"warnings":{},"desired":{"automationName":"Selendroid","platfo
rmVersion":"2.3","platform":"WINDOWS","app":"E:\\zhijin_work\\helloAppium\\apps\\EnjoyLearning1.1.ap
k","deviceName":"device","platformName":"Android","appActivity":"com.zj.learning.control.common.Logi
nActivity","udid":"7DF000029EDC0000","appPackage":"com.zj.learning"},"automationName":"Selendroid","
platformVersion":"2.3","platform":"WINDOWS","app":"E:\\zhijin_work\\helloAppium\\apps\\EnjoyLearning
1.1.apk","deviceName":"device","platformName":"Android","appActivity":"com.zj.learning.control.commo
n.LoginActivity","udid":"7DF000029EDC0000","appPackage":"com.zj.learning"}}}
info: [debug] Successfully started selendroid session
info: [debug] Waiting for pkg "com.zj.learning" and activity "com.zj.learning.control.common.LoginAc
tivity" to be focused
info: [debug] Getting focused package and activity
info: [debug] executing cmd: D:\Android\android-sdk\platform-tools\adb.exe -s 7DF000029EDC0000 shell
 "dumpsys window windows"
info: [debug] Overriding session id with "c4de4f22-11a9-2e40-a85d-19226e1708e1"
info: [debug] Device launched! Ready for commands
info: [debug] Setting command timeout to the default of 60 secs
info: [debug] Appium session started with sessionId c4de4f22-11a9-2e40-a85d-19226e1708e1
info: <-- POST /wd/hub/session 303 11351.597 ms - 74
info: --> GET /wd/hub/session/c4de4f22-11a9-2e40-a85d-19226e1708e1 {}
info: [debug] Proxying command to localhost:8080
info: [debug] Making http request with opts: {"url":"http://localhost:8080/wd/hub/session/c4de4f22-1
1a9-2e40-a85d-19226e1708e1","method":"GET"}
info: [debug] Proxied response received with status 200: {"value":{"automationName":"selendroid","pl
atform":"android","app":"E:\\zhijin_work\\helloAppium\\apps\\EnjoyLearning1.1.apk","acceptSslCerts":
true,"javascriptEnabled":true,"browserName":"selendroid","appActivity":"com.zj.learning.control.comm
on.LoginActivity","networkConnectionEnabled":true,"rotatable":true,"desired":{"automationName":"Sele
ndroid","platformVersion":"2.3","platform":"WINDOWS","app":"E:\\zhijin_work\\helloAppium\\apps\\Enjo
yLearning1.1.apk","deviceName":"device","platformName":"Android","appActivity":"com.zj.learning.cont
rol.common.LoginActivity","udid":"7DF000029EDC0000","appPackage":"com.zj.learning"},"udid":"7DF00002
9EDC0000","appPackage":"com.zj.learning","version":"0.15.0","platformVersion":"10","deviceName":"dev
ice","platformName":"android","handlesAlerts":true,"warnings":{},"takesScreenshot":true},"status":0,
"sessionId":"c4de4f22-11a9-2e40-a85d-19226e1708e1"}
info: <-- GET /wd/hub/session/c4de4f22-11a9-2e40-a85d-19226e1708e1 200 68.239 ms - 894
info: --> POST /wd/hub/session/c4de4f22-11a9-2e40-a85d-19226e1708e1/element {"using":"id","value":"u
 ser_login_et_username"}
info: [debug] Proxying command to localhost:8080
info: [debug] Making http request with opts: {"url":"http://localhost:8080/wd/hub/session/c4de4f22-1
1a9-2e40-a85d-19226e1708e1/element","method":"POST","json":{"using":"id","value":"user_login_et_username"}}
info: [debug] Proxied response received with status 200: {"value":{"ELEMENT":"5abcadb8-ff9f-5c63-544
a-9a48679db40b"},"status":0,"sessionId":"c4de4f22-11a9-2e40-a85d-19226e1708e1"}
info: <-- POST /wd/hub/session/c4de4f22-11a9-2e40-a85d-19226e1708e1/element 200 41.441 ms - 122
info: --> POST /wd/hub/session/c4de4f22-11a9-2e40-a85d-19226e1708e1/element/5abcadb8-ff9f-5c63-544a-
9a48679db40b/value {"id":"5abcadb8-ff9f-5c63-544a-9a48679db40b","value":["wangliting1220"]}
info: [debug] Setting text on element '5abcadb8-ff9f-5c63-544a-9a48679db40b': 'wangliting1220'
info: [debug] Making http request with opts: {"url":"http://localhost:8080/wd/hub/session/c4de4f22-1
1a9-2e40-a85d-19226e1708e1/element/5abcadb8-ff9f-5c63-544a-9a48679db40b/value","method":"POST","json
":{"value":["wangliting1220"]}}
info: [debug] Responding to client with success: {"status":0,"value":"","sessionId":"c4de4f22-11a9-2
e40-a85d-19226e1708e1"}
info: <-- POST /wd/hub/session/c4de4f22-11a9-2e40-a85d-19226e1708e1/element/5abcadb8-ff9f-5c63-544a-
9a48679db40b/value 200 1124.484 ms - 74 {"status":0,"value":"","sessionId":"c4de4f22-11a9-2e40-a85d-
19226e1708e1"}
info: --> POST /wd/hub/session/c4de4f22-11a9-2e40-a85d-19226e1708e1/element {"using":"id","value":"u
ser_login_et_pswd"}
info: [debug] Proxying command to localhost:8080
info: [debug] Making http request with opts: {"url":"http://localhost:8080/wd/hub/session/c4de4f22-1
1a9-2e40-a85d-19226e1708e1/element","method":"POST","json":{"using":"id","value":"user_login_et_pswd
"}}
info: [debug] Proxied response received with status 200: {"value":{"ELEMENT":"51aca496-7e10-eb03-175
0-fdb0a85799cf"},"status":0,"sessionId":"c4de4f22-11a9-2e40-a85d-19226e1708e1"}
info: <-- POST /wd/hub/session/c4de4f22-11a9-2e40-a85d-19226e1708e1/element 200 43.543 ms - 122
info: --> POST /wd/hub/session/c4de4f22-11a9-2e40-a85d-19226e1708e1/element/51aca496-7e10-eb03-1750-
fdb0a85799cf/value {"id":"51aca496-7e10-eb03-1750-fdb0a85799cf","value":["ting931220"]}
info: [debug] Setting text on element '51aca496-7e10-eb03-1750-fdb0a85799cf': 'ting931220'
info: [debug] Making http request with opts: {"url":"http://localhost:8080/wd/hub/session/c4de4f22-1
1a9-2e40-a85d-19226e1708e1/element/51aca496-7e10-eb03-1750-fdb0a85799cf/value","method":"POST","json
":{"value":["ting931220"]}}
info: [debug] Responding to client with success: {"status":0,"value":"","sessionId":"c4de4f22-11a9-2
e40-a85d-19226e1708e1"}
info: <-- POST /wd/hub/session/c4de4f22-11a9-2e40-a85d-19226e1708e1/element/51aca496-7e10-eb03-1750-
fdb0a85799cf/value 200 1322.564 ms - 74 {"status":0,"value":"","sessionId":"c4de4f22-11a9-2e40-a85d-
19226e1708e1"}
info: --> POST /wd/hub/session/c4de4f22-11a9-2e40-a85d-19226e1708e1/appium/device/hide_keyboard {}
info: [debug] executing cmd: D:\Android\android-sdk\platform-tools\adb.exe -s 7DF000029EDC0000 shell
 "dumpsys input_method"
info: [debug] executing cmd: D:\Android\android-sdk\platform-tools\adb.exe -s 7DF000029EDC0000 shell
 "input keyevent 4"
info: [debug] Responding to client with success: {"status":0,"value":null,"sessionId":"c4de4f22-11a9
-2e40-a85d-19226e1708e1"}
info: <-- POST /wd/hub/session/c4de4f22-11a9-2e40-a85d-19226e1708e1/appium/device/hide_keyboard 200
640.266 ms - 76 {"status":0,"value":null,"sessionId":"c4de4f22-11a9-2e40-a85d-19226e1708e1"}
info: --> POST /wd/hub/session/c4de4f22-11a9-2e40-a85d-19226e1708e1/element {"using":"id","value":"u
ser_login_btn_login"}
info: [debug] Proxying command to localhost:8080
info: [debug] Making http request with opts: {"url":"http://localhost:8080/wd/hub/session/c4de4f22-1
1a9-2e40-a85d-19226e1708e1/element","method":"POST","json":{"using":"id","value":"user_login_btn_log
in"}}
info: [debug] Proxied response received with status 200: {"value":{"ELEMENT":"d52e653d-2282-434b-c9d
f-4ab8fcf9337d"},"status":0,"sessionId":"c4de4f22-11a9-2e40-a85d-19226e1708e1"}
info: <-- POST /wd/hub/session/c4de4f22-11a9-2e40-a85d-19226e1708e1/element 200 44.301 ms - 122
info: --> POST /wd/hub/session/c4de4f22-11a9-2e40-a85d-19226e1708e1/element/d52e653d-2282-434b-c9df-
4ab8fcf9337d/click {"id":"d52e653d-2282-434b-c9df-4ab8fcf9337d"}
info: [debug] Proxying command to localhost:8080
info: [debug] Making http request with opts: {"url":"http://localhost:8080/wd/hub/session/c4de4f22-1
1a9-2e40-a85d-19226e1708e1/element/d52e653d-2282-434b-c9df-4ab8fcf9337d/click","method":"POST","json
":{"id":"d52e653d-2282-434b-c9df-4ab8fcf9337d"}}
info: [debug] Proxied response received with status 200: {"value":"","status":0,"sessionId":"c4de4f2
2-11a9-2e40-a85d-19226e1708e1"}
info: <-- POST /wd/hub/session/c4de4f22-11a9-2e40-a85d-19226e1708e1/element/d52e653d-2282-434b-c9df-
4ab8fcf9337d/click 200 679.751 ms - 74
info: [debug] [SELENDROID ERR] com.zj.learning.model.forum.Tag
info: [debug] [SELENDROID ERR]  at java.lang.Class.classForName(Native Method)
info: [debug] [SELENDROID ERR]  at java.lang.Class.forName(Class.java:234)
info: [debug] [SELENDROID ERR]  at java.lang.Class.forName(Class.java:181)
info: [debug] [SELENDROID ERR]  at com.zj.support.dao.b.a(Unknown Source)
info: [debug] [SELENDROID ERR]  at com.zj.support.dao.a.onCreate(Unknown Source)
info: [debug] [SELENDROID ERR]  at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLi
teOpenHelper.java:126)
info: [debug] [SELENDROID ERR]  at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLi`
teOpenHelper.java:187)
info: [debug] [SELENDROID ERR]  at com.zj.support.dao.c.a(Unknown Source)
info: [debug] [SELENDROID ERR]  at com.zj.support.a.a.a(Unknown Source)
info: [debug] [SELENDROID ERR]  at com.zj.support.a.b.a(Unknown Source)
info: [debug] [SELENDROID ERR]  at com.zj.support.a.b.doInBackground(Unknown Source)
info: [debug] [SELENDROID ERR]  at android.os.AsyncTask$2.call(AsyncTask.java:185)
info: [debug] [SELENDROID ERR]  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306
)
info: [debug] [SELENDROID ERR]  at java.util.concurrent.FutureTask.run(FutureTask.java:138)
info: [debug] [SELENDROID ERR]  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecu
tor.java:1088)
info: [debug] [SELENDROID ERR]  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExec
utor.java:581)
info: [debug] [SELENDROID ERR]  at java.lang.Thread.run(Thread.java:1019)
info: [debug] [SELENDROID ERR] com.zj.learning.model.forum.Tag
info: [debug] [SELENDROID ERR]  ... 17 more
info: [debug] [SELENDROID ERR] com.zj.learning.model.forum.Tag in loader dalvik.system.PathClassLoad
er[/system/framework/android.test.runner.jar:/data/app/com.zj.learning.selendroid-1.apk:/data/app/co
m.zj.learning-1.apk]
info: [debug] [SELENDROID ERR]  at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
info: [debug] [SELENDROID ERR]  at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
info: [debug] [SELENDROID ERR]  at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
info: [debug] [SELENDROID ERR]  ... 17 more
info: [debug] [SELENDROID] encode =  1

我具体描述一下我的情况:
若我只执行下面的代码,则能正常通过。

public void login() throws InterruptedException {
        driver.findElement(By.id("user_login_et_username")).sendKeys(
                "wangg1220");
        driver.findElement(By.id("user_login_et_pswd")).sendKeys("ting930");
        driver.hideKeyboard();
        driver.findElement(By.id("user_login_btn_login")).click();
    }

而当我执行下面的代码时,则会提示如上错误。

@Test
    public void login() throws InterruptedException {
        driver.findElement(By.id("user_login_et_username")).sendKeys(
                "wangg1220");
        driver.findElement(By.id("user_login_et_pswd")).sendKeys("ting930");
        driver.hideKeyboard();
        driver.findElement(By.id("user_login_btn_login")).click();
        Thread.sleep(60000);
        loout();
    }

    public void loout() throws InterruptedException {
        String cuString = driver.currentActivity();
        System.out.println("cuString" + cuString);
        driver.findElement(By.id("main_rbtn_course_me")).click();//
        // 找到“我的”id進行点击
        driver.swipe(75, 50, 75, 200, 2);//
        driver.findElement(By.id("user_exit_btn")).click();
    }

我现在不清楚到底是我代码写的有问题还是开发的代码问题。
这个 apk 是开发打包给我的,我正常安装使用不会有任何问题,但当我通过代码安装时,就会出现上面的错误。
请大神指教!

共收到 16 条回复 时间 点赞

没有人遇到过类似的问题吗?我现在主要是出现问题的原因不明确。

排版啊,童鞋。。。这日志看得蛋疼。。。

从日志上看,执行完 driver.findElement(By.id("user_login_btn_login")).click(); 后 SELENDROID 就报错了。

selendroid 是入侵式,会重签名的。你看下是不是 login 后的 activity 对重签名有做检查什么的?
你也可以留一下 logcat 里面打印的信息,看有什么报错信息。

@chenhengjie123 sorry,着急发帖,没认真排版。
开发打给我的 apk 直接安装没有问题,当我通过 appium 安装这个 apk 后,我在手机上使用就会报错。
这个项目是有一个依赖包的,我们做了混淆,然后打成的包。可能就是您说的这个重签名导致的,如果是这样,有什么解决方案吗?

#4 楼 @wanglitingmitty 你先尝试单独进行重签名,然后安装,看是不是真的是重签名导致的。
如果是,只能选其他不需要重签名的框架,例如 appium 的 uiautomator 模式。

@wanglitingmitty 好的,我试试,谢谢

@chenhengjie123 我尝试了一下 将 login 里的代码注释掉,然后进行测试。
遇到了两种不同的情况:
情况一:设备:联想 lepad,系统版本:android 2.3
执行结果通过,但当我在 session 未被 shut down 进行登录后,会提示下面的错误。

info: [debug] [SELENDROID] encode =  1
info: [debug] [SELENDROID ERR] com.zj.learning.model.forum.Tag
info: [debug] [SELENDROID ERR]  at java.lang.Class.classForName(Native Method)
info: [debug] [SELENDROID ERR]  at java.lang.Class.forName(Class.java:234)
info: [debug] [SELENDROID ERR]  at java.lang.Class.forName(Class.java:181)
info: [debug] [SELENDROID ERR]  at com.zj.support.dao.b.a(Unknown Source)
info: [debug] [SELENDROID ERR]  at com.zj.support.dao.a.onCreate(Unknown Source)
info: [debug] [SELENDROID ERR]  at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLi
teOpenHelper.java:126)
info: [debug] [SELENDROID ERR]  at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLi
teOpenHelper.java:187)
info: [debug] [SELENDROID ERR]  at com.zj.support.dao.c.a(Unknown Source)
info: [debug] [SELENDROID ERR]  at com.zj.support.a.a.a(Unknown Source)
info: [debug] [SELENDROID ERR]  at com.zj.support.a.b.a(Unknown Source)
info: [debug] [SELENDROID ERR]  at com.zj.support.a.b.doInBackground(Unknown Source)
info: [debug] [SELENDROID ERR]  at android.os.AsyncTask$2.call(AsyncTask.java:185)
info: [debug] [SELENDROID ERR]  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306
)
info: [debug] [SELENDROID ERR]  at java.util.concurrent.FutureTask.run(FutureTask.java:138)
info: [debug] [SELENDROID ERR]  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecu
tor.java:1088)
info: [debug] [SELENDROID ERR]  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExec
utor.java:581)
info: [debug] [SELENDROID ERR]  at java.lang.Thread.run(Thread.java:1019)
info: [debug] [SELENDROID ERR] com.zj.learning.model.forum.Tag
info: [debug] [SELENDROID ERR]  ... 17 more
info: [debug] [SELENDROID ERR] com.zj.learning.model.forum.Tag in loader dalvik.system.PathClassLoad
er[/system/framework/android.test.runner.jar:/data/app/com.zj.learning.selendroid-1.apk:/data/app/co
m.zj.learning-1.apk]
info: [debug] [SELENDROID ERR]  at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)

info: [debug] [SELENDROID ERR]  at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
info: [debug] [SELENDROID ERR]  at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
info: [debug] [SELENDROID ERR]  ... 17 more

情况二:设备:魅族 3 系统版本: flyme os 3.7 对应 android 版本 4.4
当我运行测试用例时,提示如下错误:

info: <-- GET /wd/hub/session/d32056c7-ded5-9da4-9921-40316d9eb9a5 200 441.379 ms - 764
info: [debug] [SELENDROID] 100000
info: [debug] [SELENDROID] 100000
info: [debug] [SELENDROID] 100000
info: [debug] [SELENDROID] add task, s = 1
info: [debug] [SELENDROID] rem task, s = 0
info: [debug] [SELENDROID] 100000
info: [debug] [SELENDROID] 100000
info: [debug] [SELENDROID] add task, s = 1
info: [debug] [SELENDROID] rem task, s = 0
info: [debug] [SELENDROID] 100000
info: [debug] [SELENDROID] 100000
info: [debug] [SELENDROID] 100000
info: [debug] [SELENDROID] 100000
info: [debug] [SELENDROID] Setting airplane_mode_on has moved from android.provider.Settings.System
to android.provider.Settings.Global, returning read-only value.
info: [debug] [SELENDROID ERR] ENOENT (No such file or directory)
info: [debug] [SELENDROID ERR]  at libcore.io.IoBridge.open(IoBridge.java:409)
info: [debug] [SELENDROID ERR]  at java.io.FileOutputStream.<init>(FileOutputStream.java:88)
info: [debug] [SELENDROID ERR]  at java.io.FileOutputStream.<init>(FileOutputStream.java:73)
info: [debug] [SELENDROID ERR]  at java.io.FileWriter.<init>(FileWriter.java:42)
info: [debug] [SELENDROID ERR]  at com.wandoujia.ads.sdk.legacy.util.p.run(SourceFile:241)
info: [debug] [SELENDROID ERR]  at java.lang.Thread.run(Thread.java:841)
info: [debug] [SELENDROID ERR] ENOENT (No such file or directory)
info: [debug] [SELENDROID ERR]  at libcore.io.Posix.open(Native Method)
info: [debug] [SELENDROID ERR]  at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
info: [debug] [SELENDROID ERR]  at libcore.io.IoBridge.open(IoBridge.java:393)
info: [debug] [SELENDROID ERR]  ... 5 more
info: [debug] [SELENDROID ERR] SELECT * FROM background_scan
info: [debug] [SELENDROID ERR]  at android.database.sqlite.SQLiteConnection.nativePrepareStatement(N
ative Method)
info: [debug] [SELENDROID ERR]  at android.database.sqlite.SQLiteConnection.acquirePreparedStatement
(SQLiteConnection.java:889)
info: [debug] [SELENDROID ERR]  at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection
.java:500)
info: [debug] [SELENDROID ERR]  at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:
588)
info: [debug] [SELENDROID ERR]  at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:5
8)
info: [debug] [SELENDROID ERR]  at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37)
info: [debug] [SELENDROID ERR]  at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDire
ctCursorDriver.java:44)
info: [debug] [SELENDROID ERR]  at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLite
Database.java:1314)
info: [debug] [SELENDROID ERR]  at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDat
abase.java:1161)
info: [debug] [SELENDROID ERR]  at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:
1032)
info: [debug] [SELENDROID ERR]  at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:
1200)
info: [debug] [SELENDROID ERR]  at com.tencent.assistant.db.helper.SQLiteDatabaseWrapper.query(ProGu
ard:134)
info: [debug] [SELENDROID ERR]  at com.tencent.assistant.db.table.f.b(ProGuard:112)
info: [debug] [SELENDROID ERR]  at com.tencent.nucleus.manager.backgroundscan.d.c(ProGuard:189)
info: [debug] [SELENDROID ERR]  at com.tencent.nucleus.manager.backgroundscan.BackgroundReceiver.onR
eceive(ProGuard:17)
info: [debug] [SELENDROID ERR]  at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:
765)
info: [debug] [SELENDROID ERR]  at android.os.Handler.handleCallback(Handler.java:733)
info: [debug] [SELENDROID ERR]  at android.os.Handler.dispatchMessage(Handler.java:95)
info: [debug] [SELENDROID ERR]  at android.os.Looper.loop(Looper.java:136)
info: [debug] [SELENDROID ERR]  at android.app.ActivityThread.main(ActivityThread.java:5032)
info: [debug] [SELENDROID ERR]  at java.lang.reflect.Method.invokeNative(Native Method)
info: [debug] [SELENDROID ERR]  at java.lang.reflect.Method.invoke(Method.java:515)
info: [debug] [SELENDROID ERR]  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(Zygote
Init.java:785)
info: [debug] [SELENDROID ERR]  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
info: [debug] [SELENDROID ERR]  at dalvik.system.NativeStart.main(Native Method)
info: [debug] [SELENDROID] add task, s = 1
info: [debug] [SELENDROID] rem task, s = 0
info: [debug] [SELENDROID] 100000
info: [debug] [SELENDROID] 100000
info: [debug] [SELENDROID] Setting adb_enabled has moved from android.provider.Settings.System to an
droid.provider.Settings.Global, returning read-only value.
info: [debug] [SELENDROID] Setting adb_enabled has moved from android.provider.Settings.System to an
droid.provider.Settings.Global, returning read-only value.
info: [debug] [SELENDROID] O1 begin scan directory /storage/emulated/0/.UTSystemConfig
info: [debug] [SELENDROID] O1 end scan directory /storage/emulated/0/.UTSystemConfig
info: [debug] [SELENDROID] O1 begin scan directory /storage/emulated/0/.SystemConfig
info: [debug] [SELENDROID] O1 end scan directory /storage/emulated/0/.SystemConfig
info: [debug] [SELENDROID] 100000
info: [debug] [SELENDROID] 100000
info: [debug] [SELENDROID] 100000
info: [debug] [SELENDROID] 100000
info: [debug] [SELENDROID ERR] Couldn't read row 0, col 0 from CursorWindow.  Make sure the Cursor i
s initialized correctly before accessing data from it.
info: [debug] [SELENDROID ERR]  at android.database.CursorWindow.nativeGetLong(Native Method)
info: [debug] [SELENDROID ERR]  at android.database.CursorWindow.getLong(CursorWindow.java:507)
info: [debug] [SELENDROID ERR]  at android.database.AbstractWindowedCursor.getLong(AbstractWindowedC
ursor.java:75)
info: [debug] [SELENDROID ERR]  at android.database.AbstractCursor.moveToPosition(AbstractCursor.jav
a:220)
info: [debug] [SELENDROID ERR]  at android.database.AbstractCursor.moveToNext(AbstractCursor.java:24
5)
info: [debug] [SELENDROID ERR]  at com.tencent.assistant.db.table.z.a(ProGuard:163)
info: [debug] [SELENDROID ERR]  at com.tencent.assistantv2.st.k.a(ProGuard:76)
info: [debug] [SELENDROID ERR]  at com.tencent.assistantv2.st.g.run(ProGuard:181)
info: [debug] [SELENDROID ERR]  at android.os.Handler.handleCallback(Handler.java:733)
info: [debug] [SELENDROID ERR]  at android.os.Handler.dispatchMessage(Handler.java:95)
info: [debug] [SELENDROID ERR]  at android.os.Looper.loop(Looper.java:136)
info: [debug] [SELENDROID ERR]  at android.os.HandlerThread.run(HandlerThread.java:61)
info: [debug] [SELENDROID ERR] com.zj.learning
info: [debug] [SELENDROID ERR]  at android.app.ApplicationPackageManager.getApplicationInfo(Applicat
ionPackageManager.java:230)
info: [debug] [SELENDROID ERR]  at com.android.server.AppOpsService$5.onReceive(AppOpsService.java:2
062)
info: [debug] [SELENDROID ERR]  at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:
765)
info: [debug] [SELENDROID ERR]  at android.os.Handler.handleCallback(Handler.java:733)
info: [debug] [SELENDROID ERR]  at android.os.Handler.dispatchMessage(Handler.java:95)
info: [debug] [SELENDROID ERR]  at android.os.Looper.loop(Looper.java:136)
info: [debug] [SELENDROID ERR]  at com.android.server.ServerThread.initAndLoop(SystemServer.java:121
7)
info: [debug] [SELENDROID ERR]  at com.android.server.SystemServer.main(SystemServer.java:1307)
info: [debug] [SELENDROID ERR]  at java.lang.reflect.Method.invokeNative(Native Method)
info: [debug] [SELENDROID ERR]  at java.lang.reflect.Method.invoke(Method.java:515)
info: [debug] [SELENDROID ERR]  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(Zygote
Init.java:785)
info: [debug] [SELENDROID ERR]  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
info: [debug] [SELENDROID ERR]  at dalvik.system.NativeStart.main(Native Method)
info: [debug] [SELENDROID] 100000
info: [debug] [SELENDROID ERR] Couldn't read row 0, col 0 from CursorWindow.  Make sure the Cursor i
s initialized correctly before accessing data from it.
info: [debug] [SELENDROID ERR]  at android.database.CursorWindow.nativeGetLong(Native Method)
info: [debug] [SELENDROID ERR]  at android.database.CursorWindow.getLong(CursorWindow.java:507)
info: [debug] [SELENDROID ERR]  at android.database.AbstractWindowedCursor.getLong(AbstractWindowedC
ursor.java:75)
info: [debug] [SELENDROID ERR]  at android.database.AbstractCursor.moveToPosition(AbstractCursor.jav
a:220)
info: [debug] [SELENDROID ERR]  at android.database.AbstractCursor.moveToNext(AbstractCursor.java:24
5)
info: [debug] [SELENDROID ERR]  at com.tencent.assistant.db.table.z.a(ProGuard:163)
info: [debug] [SELENDROID ERR]  at com.tencent.assistantv2.st.k.a(ProGuard:76)
info: [debug] [SELENDROID ERR]  at com.tencent.assistantv2.st.g.run(ProGuard:181)
info: [debug] [SELENDROID ERR]  at android.os.Handler.handleCallback(Handler.java:733)
info: [debug] [SELENDROID ERR]  at android.os.Handler.dispatchMessage(Handler.java:95)
info: [debug] [SELENDROID ERR]  at android.os.Looper.loop(Looper.java:136)
info: [debug] [SELENDROID ERR]  at android.os.HandlerThread.run(HandlerThread.java:61)

@chenhengjie123 我在想,是不是我使用 appium 的方法不正确或者我的配置不正确。
我先安装了 jdk,eclipse-adt、sdk,然后安装 node,然后在线安装了 appium,appium-doctor 检查没有问题,所以,我就直接开始写代码了。项目中 java-client 用的是 3.2,selenium 用的是 2.47。

#9 楼 @wanglitingmitty appium 版本多少?
selendroid 模式我没怎么用过,这些错误也看不太懂。帮你找下 @lihuazhang

PS:排版啊童鞋,日志用代码块啊!

@chenhengjie123 appium 版本是 V1.4。
我试了一下官方的 contactmanager.apk 及代码,测试通过。环境应该是没有问题。
麻烦您了💋

大神们看看我的错误,error: {"status":7,"value":{"message":"An element could not be located on the page using the given search parameters.","origValue":"No element found"}

info: --> POST /wd/hub/session/8265b651-40cf-cb83-2919-28e85c16ffd4/element/d2246795-7cf1-6cc8-8834-
a1db4ceddfcf/click {"id":"d2246795-7cf1-6cc8-8834-a1db4ceddfcf"}
info: [debug] Proxying command to localhost:8080
info: [debug] Making http request with opts: {"url":"http://localhost:8080/wd/hub/session/8265b651-4
0cf-cb83-2919-28e85c16ffd4/element/d2246795-7cf1-6cc8-8834-a1db4ceddfcf/click","method":"POST","json
":{"id":"d2246795-7cf1-6cc8-8834-a1db4ceddfcf"}}
info: [debug] Proxied response received with status 200: {"value":"","status":0,"sessionId":"8265b65
1-40cf-cb83-2919-28e85c16ffd4"}
info: <-- POST /wd/hub/session/8265b651-40cf-cb83-2919-28e85c16ffd4/element/d2246795-7cf1-6cc8-8834-
a1db4ceddfcf/click 200 637.581 ms - 74
info: --> POST /wd/hub/session/8265b651-40cf-cb83-2919-28e85c16ffd4/touch/perform {"actions":[{"acti
on":"press","options":{"x":75,"y":200}},{"action":"wait","options":{"ms":1000}},{"action":"moveTo","
options":{"x":80,"y":800}},{"action":"release","options":{}}]}
info: [debug] Proxying command to localhost:8080
info: [debug] Making http request with opts: {"url":"http://localhost:8080/wd/hub/session/8265b651-4
0cf-cb83-2919-28e85c16ffd4/touch/perform","method":"POST","json":{"actions":[{"action":"press","opti
ons":{"x":75,"y":200}},{"action":"wait","options":{"ms":1000}},{"action":"moveTo","options":{"x":80,
"y":800}},{"action":"release","options":{}}]}}
info: [debug] Proxied response received with status 404: undefined
info: <-- POST /wd/hub/session/8265b651-40cf-cb83-2919-28e85c16ffd4/touch/perform 404 47.564 ms - -

现在出现的这个问题,可能是由于我执行 swipe 方法导致的,谁遇到过相同的?
我的代码:

driver.findElement(By.id("main_rbtn_course_me")).click();
Thread.sleep(1000);
driver.swipe(75, 200, 80, 800, 1000);//
driver.findElement(By.id("user_exit_btn")).click();
}
匿名 #14 · 2015年11月05日

Proxied response received with status 404: undefined

我也碰到了这个问题,登录和登出写在 2 个 test 下(像你这样)就报这样的错误,但是我尝试着写在同一个 test 下就执行成功了,不知道什么原因,同求高手解答

王李婷 回复

我也碰到了这个问题,你有没有解决办法呢?
Proxied response received with status 404: undefined

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册