还未发布过话题
  • 环境:MAC 机,apache-maven-3.3.3,appium-1.4.8.dmg

  • #1 楼 @henry
    driver.context("WEBVIEW_com.。。。");执行不了。
    driver.context("WEB_VIEW");可以执行。
    但是 Activity 上有复数个 webview。打印出 contexts 的内容,只有一个 web view,??
    是移动端混合型 App(hybrid app),各位有遇到这个问题的吗

    info: --> GET /wd/hub/session/3920d29c-9de2-4908-a663-73a30f423f33/contexts {}
    info: [debug] Getting a list of available webviews
    info: [debug] executing cmd: /Users/Desktop/android-sdk-macosx/platform-tools/adb -s R32CA05X1CJ shell "cat /proc/net/unix"
    info: [debug] WEBVIEW_9615 mapped to pid 9615
    info: [debug] Getting process name for webview
    info: [debug] executing cmd: /Users/Desktop/android-sdk-macosx/platform-tools/adb -s R32CA05X1CJ shell "ps"
    info: [debug] Parsed pid: 9615 pkg: com.systemdirector.ent.smt
    info: [debug] from: u0_a302,9615,136,1669508,128240,ffffffff,00000000,S,com.systemdirector.ent.smt
    info: [debug] returning process name: com.systemdirector.ent.smt
    info: [debug] Available contexts: NATIVE_APP,WEBVIEW_com.systemdirector.ent.smt
    info: [debug] ["WEBVIEW_com.systemdirector.ent.smt"]
    info: [debug] Available contexts: NATIVE_APP,WEBVIEW_com.systemdirector.ent.smt
    info: [debug] Responding to client with success: {"status":0,"value":["NATIVE_APP","WEBVIEW_com.systemdirector.ent.smt"],"sessionId":"3920d29c-9de2-4908-a663-73a30f423f33"}
    info: <-- GET /wd/hub/session/3920d29c-9de2-4908-a663-73a30f423f33/contexts 200 218.819 ms - 130 {"status":0,"value":["NATIVE_APP","WEBVIEW_com.systemdirector.ent.smt"],"sessionId":"3920d29c-9de2-4908-a663-73a30f423f33"}
    info: --> POST /wd/hub/session/3920d29c-9de2-4908-a663-73a30f423f33/context {"name":"WEBVIEW_com.systemdirector.ent.smt"}
    info: [debug] Getting a list of available webviews
    info: [debug] executing cmd: /Users/Desktop/android-sdk-macosx/platform-tools/adb -s R32CA05X1CJ shell "cat /proc/net/unix"
    info: [debug] WEBVIEW_9615 mapped to pid 9615
    info: [debug] Getting process name for webview
    info: [debug] executing cmd: /Users/Desktop/android-sdk-macosx/platform-tools/adb -s R32CA05X1CJ shell "ps"
    info: [debug] Parsed pid: 9615 pkg: com.systemdirector.ent.smt
    info: [debug] from: u0_a302,9615,136,1669508,128240,ffffffff,00000000,S,com.systemdirector.ent.smt
    info: [debug] returning process name: com.systemdirector.ent.smt
    info: [debug] Available contexts: NATIVE_APP,WEBVIEW_com.systemdirector.ent.smt
    info: [debug] ["WEBVIEW_com.systemdirector.ent.smt"]
    info: [debug] Available contexts: NATIVE_APP,WEBVIEW_com.systemdirector.ent.smt
    info: [debug] Responding to client with success: {"status":0,"value":null,"sessionId":"3920d29c-9de2-4908-a663-73a30f423f33"}
    info: <-- POST /wd/hub/session/3920d29c-9de2-4908-a663-73a30f423f33/context 200 149.636 ms - 76 {"status":0,"value":null,"sessionId":"3920d29c-9de2-4908-a663-73a30f423f33"}
    info: --> GET /wd/hub/session/3920d29c-9de2-4908-a663-73a30f423f33/orientation {}
    info: [debug] Proxying command to 127.0.0.1:9515
    info: [debug] Making http request with opts: {"url":"http://127.0.0.1:9515/wd/hub/session/11ed082b6b9a7dd33d791bad558c5bce/orientation,method:GET"}
    info: [debug] Proxied response received with status 501: "unimplemented command: session/11ed082b6b9a7dd33d791bad558c5bce/orientation"
    info: <-- GET /wd/hub/session/3920d29c-9de2-4908-a663-73a30f423f33/orientation 501 7.323 ms - 75
    info: --> DELETE /wd/hub/session/3920d29c-9de2-4908-a663-73a30f423f33 {}
    info: Shutting down appium session
    info: [debug] Pressing the HOME button
    info: [debug] executing cmd: /Users/Desktop/android-sdk-macosx/platform-tools/adb -s R32CA05X1CJ shell "input keyevent 3"
    info: [debug] Stopping logcat capture
    info: [debug] Logcat terminated with code null, signal SIGTERM
    info: [debug] Deleting Chrome session
    info: [debug] Making http request with opts: {"url":"http://127.0.0.1:9515/wd/hub/session/11ed082b6b9a7dd33d791bad558c5bce,method:DELETE"}
    info: [debug] Cleaning up Chromedriver
    info: [debug] Killing chromedriver and waiting for close
    info: [debug] Chromedriver exited with code null
    info: debug
    info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"shutdown"}
    info: [debug] [BOOTSTRAP] [debug] Got command of type SHUTDOWN
    info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":"OK, shutting down"}
    info: [debug] [BOOTSTRAP] [debug] Closed client connection
    info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
    info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=.
    info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
    info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
    info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
    info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
    info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 0
    info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
    info: [debug] [UIAUTOMATOR STDOUT] Test results for WatcherResultPrinter=.
    info: [debug] [UIAUTOMATOR STDOUT] Time: 42.512
    info: [debug] [UIAUTOMATOR STDOUT] OK (1 test)
    info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1
    info: [debug] Sent shutdown command, waiting for UiAutomator to stop...
    info: [debug] UiAutomator shut down normally
    info: [debug] Cleaning up android objects
    info: [debug] Cleaning up appium session
    info: [debug] Responding to client with success: {"status":0,"value":null,"sessionId":"3920d29c-9de2-4908-a663-73a30f423f33"}
    info: <-- DELETE /wd/hub/session/3920d29c-9de2-4908-a663-73a30f423f33 200 764.713 ms - 76 {"status":0,"value":null,"sessionId":"3920d29c-9de2-4908-a663-73a30f423f33"}

  • 解决了:)
    我的错误信息,如下:
    error: [REMOTE] Could not connect to WebKitRemoteDebugger server

    info: [debug] Responding to client with error: {"status":13,"value":{"message":"An unknown server-side error occurred while processing the command. (Original error: connect ECONNREFUSED)","code":"ECONNREFUSED","errno":"ECONNREFUSED","syscall":"connect","origValue":"connect ECONNREFUSED"},"sessionId":"7cfd54c0-8795-4d54-a6f4-65a969df7f58"}

    解决方法:
    1,使用 brew 安装最新的 ios-webkit-debug-proxy。在终端运行一下命令:

    brew install ios-webkit-debug-proxy
    2,启动代理:

    将 udid 替换成你的设备的 udid。确保端口 27753 没有被占用

    remote-debugger 将会使用这个端口。

    ios_webkit_debug_proxy -c 0e4b2f612b65e98c1d07d22ee08678130d345429:27753 -d

    具体参照:https://testerhome.com/topics/3144

  • 我的错误信息和你一样,如下:
    info: [debug] Couldn't find ideviceinstaller, trying built-in at /Volumes/Appium/Appium.app/Contents/Resources/node_modules/appium/build/libimobiledevice-macosx/ideviceinstaller
    error: Could not initialize ideviceinstaller; make sure it is installed and works on your system

    我的解决方法是安装 ideviceinstaller,安装方法如下:
    brew install --HEAD ideviceinstaller

    希望对你有用。

  • 解决了吗?能共享一下解决方法吗?