• Airtest

  • 可以考虑把 app 路径写入文件, python 读文件里面的 app 路径来实现吧

  • 没安装证书?

    —— 来自 TesterHome 官方 安卓客户端

  • 报错感觉不太像是编码问题

    —— 来自 TesterHome 官方 安卓客户端

  • 感觉这个跟 post 请求没关系,看看有没有在文件开头加上 #coding=utf-8

    —— 来自 TesterHome 官方 安卓客户端

  • 没少,是要导入两个库

    import win32com.client
    import wmi
    
  • wmi1 = win32com.client.GetObject('winmgmts:')
    c = wmi.WMI()
    for p in wmi1.InstancesOf('win32_process'):
        if p.Name == 'chromedriver.exe':
            for process in c.win32_Process(ProcessId=p.Properties_('ProcessId')):
                process.Terminate()
    

    代码有点乱,windows 下亲测这样可以成功

  • #26 楼 @budian非常感谢,完美解决

    —— 来自 TesterHome 官方 安卓客户端

  • 不是卡在那里,我等待了 20s 还是不行

  • 怎么杀掉 chromedriver.exe?那我的 H5 页面不也关闭了吗

  • #19 楼 @swmvp 我用的就是 2.26 的版本还是不行

    —— 来自 TesterHome 官方 安卓客户端

  • 木有呀。。

  • 还试过其他人建议说的:先切换回 nactive_app 然后再切换回 webview 还是不行

    —— 来自 TesterHome 官方 安卓客户端

  • #14 楼 @D6666666 我后来换了版本也不行

    —— 来自 TesterHome 官方 安卓客户端

  • 差不多就是这样子,我是 click 之后,立马 print contexts 和 current_context 都 ok,就是页面加载完之后在页面操作怎么都不行。。。

  • info: [debug] Pushing unlock helper app to device...
    info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s bbc561b8 install "D:\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk"
    info: Starting App
    info: [debug] Attempting to kill all 'uiautomator' processes
    info: [debug] Getting all processes with 'uiautomator'
    info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s bbc561b8 shell "ps 'uiautomator'"
    info: [debug] No matching processes found
    info: [debug] Running bootstrap
    info: [debug] spawning: E:\android-sdk-windows\platform-tools\adb.exe -s bbc561b8 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap -e pkg com.tencent.mm -e disableAndroidWatchers false
    info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
    info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
    info: [debug] [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:
    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: 1
    info: [debug] [BOOTSTRAP] [debug] Socket opened on port 4724
    info: [debug] [BOOTSTRAP] [debug] Appium Socket Server Ready
    info: [debug] [BOOTSTRAP] [debug] Loading json...
    info: [debug] Waking up device if it's not alive
    info: [debug] Pushing command to appium work queue: ["wake",{}]
    info: [debug] [BOOTSTRAP] [debug] Registered crash watchers.
    info: [debug] [BOOTSTRAP] [debug] Client connected
    info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"wake","params":{}}
    info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
    info: [debug] [BOOTSTRAP] [debug] Got command action: wake
    info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":true}
    info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s bbc561b8 shell "dumpsys window"
    info: [debug] Screen already unlocked, continuing.
    info: [debug] Pushing command to appium work queue: ["getDataDir",{}]
    info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"getDataDir","params":{}}
    info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
    info: [debug] [BOOTSTRAP] [debug] Got command action: getDataDir
    info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":"\/data\/local\/tmp"}
    info: [debug] dataDir set to: /data/local/tmp
    info: [debug] Pushing command to appium work queue: ["compressedLayoutHierarchy",{"compressLayout":false}]
    info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"compressedLayoutHierarchy","params":{"compressLayout":false}}
    info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
    info: [debug] [BOOTSTRAP] [debug] Got command action: compressedLayoutHierarchy
    info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":false}
    info: [debug] Getting device API level
    info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s bbc561b8 shell "getprop ro.build.version.sdk"
    info: [debug] Device is at API Level 21
    info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s bbc561b8 shell "am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n com.tencent.mm/.ui.LauncherUI"
    info: [debug] Waiting for pkg "com.tencent.mm" and activity ".ui.LauncherUI" to be focused
    info: [debug] Getting focused package and activity
    info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s bbc561b8 shell "dumpsys window windows"
    info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s bbc561b8 shell "getprop ro.build.version.release"
    info: [debug] Device is at release version 5.0
    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 5821155f-c340-4d3d-ad20-9f5ee64e3b86
    info: <-- POST /wd/hub/session 303 8293.583 ms - 74
    info: --> GET /wd/hub/session/5821155f-c340-4d3d-ad20-9f5ee64e3b86 {}
    info: [debug] Responding to client with success: {"status":0,"value":{"platform":"LINUX","browserName":"Android","platformVersion":"5.0","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"unicodeKeyboard":true,"deviceName":"bbc561b8","chromeOptions":{"androidProcess":"com.tencent.mm:tools"},"resetKeyboard":true,"appPackage":"com.tencent.mm","platformName":"Android","appActivity":".ui.LauncherUI"},"unicodeKeyboard":true,"deviceName":"bbc561b8","chromeOptions":{"androidProcess":"com.tencent.mm:tools"},"resetKeyboard":true,"appPackage":"com.tencent.mm","platformName":"Android","appActivity":".ui.LauncherUI"},"sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86"}
    info: <-- GET /wd/hub/session/5821155f-c340-4d3d-ad20-9f5ee64e3b86 200 1.124 ms - 751 {"status":0,"value":{"platform":"LINUX","browserName":"Android","platformVersion":"5.0","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"unicodeKeyboard":true,"deviceName":"bbc561b8","chromeOptions":{"androidProcess":"com.tencent.mm:tools"},"resetKeyboard":true,"appPackage":"com.tencent.mm","platformName":"Android","appActivity":".ui.LauncherUI"},"unicodeKeyboard":true,"deviceName":"bbc561b8","chromeOptions":{"androidProcess":"com.tencent.mm:tools"},"resetKeyboard":true,"appPackage":"com.tencent.mm","platformName":"Android","appActivity":".ui.LauncherUI"},"sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86"}
    info: --> POST /wd/hub/session/5821155f-c340-4d3d-ad20-9f5ee64e3b86/timeouts/implicit_wait {"sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86","ms":10000}
    info: [debug] Set Android implicit wait to 10000ms
    info: [debug] Responding to client with success: {"status":0,"value":null,"sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86"}
    info: <-- POST /wd/hub/session/5821155f-c340-4d3d-ad20-9f5ee64e3b86/timeouts/implicit_wait 200 0.794 ms - 76 {"status":0,"value":null,"sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86"}
    info: --> GET /wd/hub/session/5821155f-c340-4d3d-ad20-9f5ee64e3b86/contexts {}
    info: [debug] Getting a list of available webviews
    info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s bbc561b8 shell "cat /proc/net/unix"
    info: [debug] Available contexts:
    info: [debug] []
    info: [debug] Available contexts: NATIVE_APP
    info: [debug] Responding to client with success: {"status":0,"value":["NATIVE_APP"],"sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86"}
    info: <-- GET /wd/hub/session/5821155f-c340-4d3d-ad20-9f5ee64e3b86/contexts 200 46.171 ms - 86 {"status":0,"value":["NATIVE_APP"],"sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86"}
    info: --> GET /wd/hub/session/5821155f-c340-4d3d-ad20-9f5ee64e3b86/context {}
    info: [debug] Responding to client with success: {"status":0,"value":"NATIVE_APP","sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86"}
    info: <-- GET /wd/hub/session/5821155f-c340-4d3d-ad20-9f5ee64e3b86/context 200 0.918 ms - 84 {"status":0,"value":"NATIVE_APP","sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86"}
    info: --> POST /wd/hub/session/5821155f-c340-4d3d-ad20-9f5ee64e3b86/elements {"using":"id","sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86","value":"com.tencent.mm:id/bpx"}
    info: [debug] Waiting up to 10000ms for condition
    info: [debug] Pushing command to appium work queue: ["find",{"strategy":"id","selector":"com.tencent.mm:id/bpx","context":"","multiple":true}]
    info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.tencent.mm:id/bpx","context":"","multiple":true}}
    info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
    info: [debug] [BOOTSTRAP] [debug] Got command action: find
    info: [debug] [BOOTSTRAP] [debug] Finding com.tencent.mm:id/bpx using ID with the contextId: multiple: true
    info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[RESOURCE_ID=com.tencent.mm:id/bpx]
    info: [debug] [BOOTSTRAP] [debug] getElements selector:UiSelector[RESOURCE_ID=com.tencent.mm:id/bpx]
    info: [debug] [BOOTSTRAP] [debug] Element[] is null: (0)
    info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[INSTANCE=0, RESOURCE_ID=com.tencent.mm:id/bpx]
    info: [debug] [BOOTSTRAP] [debug] Failed to locate element. Clearing Accessibility cache and retrying.
    info: [debug] [BOOTSTRAP] [debug] Finding com.tencent.mm:id/bpx using ID with the contextId: multiple: true
    info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[RESOURCE_ID=com.tencent.mm:id/bpx]
    info: [debug] [BOOTSTRAP] [debug] getElements selector:UiSelector[RESOURCE_ID=com.tencent.mm:id/bpx]
    info: [debug] [BOOTSTRAP] [debug] Element[] is null: (0)
    info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[INSTANCE=0, RESOURCE_ID=com.tencent.mm:id/bpx]
    info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":[]}
    info: [debug] Waited for 2139ms so far
    info: [debug] Pushing command to appium work queue: ["find",{"strategy":"id","selector":"com.tencent.mm:id/bpx","context":"","multiple":true}]
    info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.tencent.mm:id/bpx","context":"","multiple":true}}
    info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
    info: [debug] [BOOTSTRAP] [debug] Got command action: find
    info: [debug] [BOOTSTRAP] [debug] Finding com.tencent.mm:id/bpx using ID with the contextId: multiple: true
    info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[RESOURCE_ID=com.tencent.mm:id/bpx]
    info: [debug] [BOOTSTRAP] [debug] getElements selector:UiSelector[RESOURCE_ID=com.tencent.mm:id/bpx]
    info: [debug] [BOOTSTRAP] [debug] Element[] is null: (0)
    info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[INSTANCE=0, RESOURCE_ID=com.tencent.mm:id/bpx]
    info: [debug] [BOOTSTRAP] [debug] Failed to locate element. Clearing Accessibility cache and retrying.
    info: [debug] [BOOTSTRAP] [debug] Finding com.tencent.mm:id/bpx using ID with the contextId: multiple: true
    info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[RESOURCE_ID=com.tencent.mm:id/bpx]
    info: [debug] [BOOTSTRAP] [debug] getElements selector:UiSelector[RESOURCE_ID=com.tencent.mm:id/bpx]
    info: [debug] [BOOTSTRAP] [debug] Element[] is null: (0)
    info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[INSTANCE=0, RESOURCE_ID=com.tencent.mm:id/bpx]
    info: [debug] [BOOTSTRAP] [debug] Element[] is null: (1)
    info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[INSTANCE=1, RESOURCE_ID=com.tencent.mm:id/bpx]
    info: [debug] [BOOTSTRAP] [debug] Element[] is null: (2)
    info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[INSTANCE=2, RESOURCE_ID=com.tencent.mm:id/bpx]
    info: [debug] [BOOTSTRAP] [debug] Element[] is null: (3)
    info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[INSTANCE=3, RESOURCE_ID=com.tencent.mm:id/bpx]
    info: [debug] [BOOTSTRAP] [debug] Element[] is null: (4)
    info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[INSTANCE=4, RESOURCE_ID=com.tencent.mm:id/bpx]
    info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":[{"ELEMENT":"1"},{"ELEMENT":"2"},{"ELEMENT":"3"},{"ELEMENT":"4"}]}
    info: [debug] Responding to client with success: {"status":0,"value":[{"ELEMENT":"1"},{"ELEMENT":"2"},{"ELEMENT":"3"},{"ELEMENT":"4"}],"sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86"}
    info: <-- POST /wd/hub/session/5821155f-c340-4d3d-ad20-9f5ee64e3b86/elements 200 9885.798 ms - 137 {"status":0,"value":[{"ELEMENT":"1"},{"ELEMENT":"2"},{"ELEMENT":"3"},{"ELEMENT":"4"}],"sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86"}
    info: --> POST /wd/hub/session/5821155f-c340-4d3d-ad20-9f5ee64e3b86/element/3/click {"sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86","id":"3"}
    info: [debug] Pushing command to appium work queue: ["element:click",{"elementId":"3"}]
    info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:click","params":{"elementId":"3"}}
    info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
    info: [debug] [BOOTSTRAP] [debug] Got command action: click
    info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":true}
    info: [debug] Responding to client with success: {"status":0,"value":true,"sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86"}
    info: <-- POST /wd/hub/session/5821155f-c340-4d3d-ad20-9f5ee64e3b86/element/3/click 200 2013.265 ms - 76 {"status":0,"value":true,"sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86"}
    info: --> POST /wd/hub/session/5821155f-c340-4d3d-ad20-9f5ee64e3b86/element {"using":"id","sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86","value":"com.tencent.mm:id/i3"}
    info: [debug] Waiting up to 10000ms for condition
    info: [debug] Pushing command to appium work queue: ["find",{"strategy":"id","selector":"com.tencent.mm:id/i3","context":"","multiple":false}]
    info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.tencent.mm:id/i3","context":"","multiple":false}}
    info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
    info: [debug] [BOOTSTRAP] [debug] Got command action: find
    info: [debug] [BOOTSTRAP] [debug] Finding com.tencent.mm:id/i3 using ID with the contextId: multiple: false
    info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.tencent.mm:id/i3]
    info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":{"ELEMENT":"5"}}
    info: [debug] Responding to client with success: {"status":0,"value":{"ELEMENT":"5"},"sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86"}
    info: <-- POST /wd/hub/session/5821155f-c340-4d3d-ad20-9f5ee64e3b86/element 200 36.178 ms - 87 {"status":0,"value":{"ELEMENT":"5"},"sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86"}
    info: --> POST /wd/hub/session/5821155f-c340-4d3d-ad20-9f5ee64e3b86/element/5/click {"sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86","id":"5"}
    info: [debug] Pushing command to appium work queue: ["element:click",{"elementId":"5"}]
    info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:click","params":{"elementId":"5"}}
    info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
    info: [debug] [BOOTSTRAP] [debug] Got command action: click
    info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":true}
    info: [debug] Responding to client with success: {"status":0,"value":true,"sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86"}
    info: <-- POST /wd/hub/session/5821155f-c340-4d3d-ad20-9f5ee64e3b86/element/5/click 200 1597.871 ms - 76 {"status":0,"value":true,"sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86"}
    info: --> POST /wd/hub/session/5821155f-c340-4d3d-ad20-9f5ee64e3b86/element {"using":"id","sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86","value":"com.tencent.mm:id/ll"}
    info: [debug] Waiting up to 10000ms for condition
    info: [debug] Pushing command to appium work queue: ["find",{"strategy":"id","selector":"com.tencent.mm:id/ll","context":"","multiple":false}]
    info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.tencent.mm:id/ll","context":"","multiple":false}}
    info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
    info: [debug] [BOOTSTRAP] [debug] Got command action: find
    info: [debug] [BOOTSTRAP] [debug] Finding com.tencent.mm:id/ll using ID with the contextId: multiple: false
    info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.tencent.mm:id/ll]
    info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":{"ELEMENT":"6"}}
    info: [debug] Responding to client with success: {"status":0,"value":{"ELEMENT":"6"},"sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86"}
    info: <-- POST /wd/hub/session/5821155f-c340-4d3d-ad20-9f5ee64e3b86/element 200 61.881 ms - 87 {"status":0,"value":{"ELEMENT":"6"},"sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86"}
    info: --> POST /wd/hub/session/5821155f-c340-4d3d-ad20-9f5ee64e3b86/element/6/click {"sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86","id":"6"}
    info: [debug] Pushing command to appium work queue: ["element:click",{"elementId":"6"}]
    info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:click","params":{"elementId":"6"}}
    info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
    info: [debug] [BOOTSTRAP] [debug] Got command action: click
    info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":true}
    info: [debug] Responding to client with success: {"status":0,"value":true,"sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86"}
    info: <-- POST /wd/hub/session/5821155f-c340-4d3d-ad20-9f5ee64e3b86/element/6/click 200 2062.956 ms - 76 {"status":0,"value":true,"sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86"}
    info: --> GET /wd/hub/session/5821155f-c340-4d3d-ad20-9f5ee64e3b86/contexts {}
    info: [debug] Getting a list of available webviews
    info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s bbc561b8 shell "cat /proc/net/unix"
    info: [debug] WEBVIEW_14053 mapped to pid 14053
    info: [debug] Getting process name for webview
    info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s bbc561b8 shell "ps"
    info: [debug] Parsed pid: 14053 pkg: com.tencent.mm:tools
    info: [debug] from: u0_a207,14053,317,2370452,234212,ffffffff,00000000,S,com.tencent.mm:tools
    info: [debug] returning process name: com.tencent.mm:tools
    info: [debug] Available contexts: NATIVE_APP
    info: [debug] ["WEBVIEW_com.tencent.mm:tools"]
    info: [debug] Available contexts: NATIVE_APP,WEBVIEW_com.tencent.mm:tools
    info: [debug] Responding to client with success: {"status":0,"value":["NATIVE_APP","WEBVIEW_com.tencent.mm:tools"],"sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86"}
    info: <-- GET /wd/hub/session/5821155f-c340-4d3d-ad20-9f5ee64e3b86/contexts 200 252.586 ms - 117 {"status":0,"value":["NATIVE_APP","WEBVIEW_com.tencent.mm:tools"],"sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86"}
    info: --> POST /wd/hub/session/5821155f-c340-4d3d-ad20-9f5ee64e3b86/context {"sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86","name":"WEBVIEW_com.tencent.mm:tools"}
    info: [debug] Getting a list of available webviews
    info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s bbc561b8 shell "cat /proc/net/unix"
    info: [debug] WEBVIEW_14053 mapped to pid 14053
    info: [debug] Getting process name for webview
    info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s bbc561b8 shell "ps"
    info: [debug] Parsed pid: 14053 pkg: com.tencent.mm:tools
    info: [debug] from: u0_a207,14053,317,2370452,234212,ffffffff,00000000,R,com.tencent.mm:tools
    info: [debug] returning process name: com.tencent.mm:tools
    info: [debug] Available contexts: NATIVE_APP,WEBVIEW_com.tencent.mm:tools
    info: [debug] ["WEBVIEW_com.tencent.mm:tools"]
    info: [debug] Available contexts: NATIVE_APP,WEBVIEW_com.tencent.mm:tools
    info: [debug] Connecting to chrome-backed webview
    info: Chromedriver: Changed state to 'starting'
    info: Chromedriver: Set chromedriver binary as: D:\Appium\node_modules\appium\node_modules\appium-chromedriver\chromedriver\win\chromedriver.exe
    info: Chromedriver: Killing any old chromedrivers, running: FOR /F "usebackq tokens=5" %a in (netstat -nao ^| findstr /R /C:"9515 ") do (FOR /F "usebackq" %b in (TASKLIST /FI "PID eq %a" ^| findstr /I chromedriver.exe) do (IF NOT %b=="" TASKKILL /F /PID %a))
    info: Chromedriver: No old chromedrivers seemed to exist
    info: Chromedriver: Spawning chromedriver with: D:\Appium\node_modules\appium\node_modules\appium-chromedriver\chromedriver\win\chromedriver.exe --url-base=wd/hub --port=9515
    info: Chromedriver: [STDOUT] Starting ChromeDriver 2.18.343845 (73dd713ba7fbfb73cbb514e62641d8c96a94682a) on port 9515
    Only local connections are allowed.
    info: JSONWP Proxy: Proxying [GET /status] to [GET http://127.0.0.1:9515/wd/hub/status] with no body
    info: JSONWP Proxy: Got response with status 200: "{\"sessionId\":\"\",\"status\":0,\"value\":{\"build\":{\"version\":\"alpha\"},\"os\":{\"arch\":\"x86_64\",\"name\":\"Windows NT\",\"version\":\"6.1 SP1\"}}}"
    info: JSONWP Proxy: Proxying [POST /session] to [POST http://127.0.0.1:9515/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.tencent.mm","androidUseRunningApp":true,"androidProcess":"com.tencent.mm:tools","androidDeviceSerial":"bbc561b8"}}}
    info: JSONWP Proxy: Got response with status 200: {"sessionId":"a3198efbfc3ebd3eb5753e3817aec154","status":0,"value":{"acceptSslCerts":true,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"browserName":"chrome","chrome":{},"cssSel...
    info: Chromedriver: Changed state to 'online'
    info: [debug] Responding to client with success: {"status":0,"value":null,"sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86"}
    info: <-- POST /wd/hub/session/5821155f-c340-4d3d-ad20-9f5ee64e3b86/context 200 1258.877 ms - 76 {"status":0,"value":null,"sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86"}
    info: --> GET /wd/hub/session/5821155f-c340-4d3d-ad20-9f5ee64e3b86/context {}
    info: [debug] Responding to client with success: {"status":0,"value":"WEBVIEW_com.tencent.mm:tools","sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86"}
    info: <-- GET /wd/hub/session/5821155f-c340-4d3d-ad20-9f5ee64e3b86/context 200 1.377 ms - 102 {"status":0,"value":"WEBVIEW_com.tencent.mm:tools","sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86"}
    info: --> POST /wd/hub/session/5821155f-c340-4d3d-ad20-9f5ee64e3b86/element {"using":"xpath","sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86","value":"//[@id=\"main\"]/a[4]"}
    info: JSONWP Proxy: Proxying [POST /wd/hub/session/5821155f-c340-4d3d-ad20-9f5ee64e3b86/element] to [POST http://127.0.0.1:9515/wd/hub/session/a3198efbfc3ebd3eb5753e3817aec154/element] with body: {"using":"xpath","sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86","value":"//
    [@id=\"main\"]/a[4]"}
    info: JSONWP Proxy: Got response with status 200: {"sessionId":"a3198efbfc3ebd3eb5753e3817aec154","status":0,"value":{"ELEMENT":"0.5707436547366542-1"}}
    info: JSONWP Proxy: Replacing sessionId a3198efbfc3ebd3eb5753e3817aec154 with 5821155f-c340-4d3d-ad20-9f5ee64e3b86
    info: <-- POST /wd/hub/session/5821155f-c340-4d3d-ad20-9f5ee64e3b86/element 200 156.442 ms - 106
    info: --> POST /wd/hub/session/5821155f-c340-4d3d-ad20-9f5ee64e3b86/element/0.5707436547366542-1/click {"sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86","id":"0.5707436547366542-1"}
    info: JSONWP Proxy: Proxying [POST /wd/hub/session/5821155f-c340-4d3d-ad20-9f5ee64e3b86/element/0.5707436547366542-1/click] to [POST http://127.0.0.1:9515/wd/hub/session/a3198efbfc3ebd3eb5753e3817aec154/element/0.5707436547366542-1/click] with body: {"sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86","id":"0.5707436547366542-1"}
    info: JSONWP Proxy: Got response with status 200: {"sessionId":"a3198efbfc3ebd3eb5753e3817aec154","status":0,"value":null}
    info: JSONWP Proxy: Replacing sessionId a3198efbfc3ebd3eb5753e3817aec154 with 5821155f-c340-4d3d-ad20-9f5ee64e3b86
    info: <-- POST /wd/hub/session/5821155f-c340-4d3d-ad20-9f5ee64e3b86/element/0.5707436547366542-1/click 200 192.190 ms - 76
    info: --> GET /wd/hub/session/5821155f-c340-4d3d-ad20-9f5ee64e3b86/contexts {}
    info: [debug] Getting a list of available webviews
    info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s bbc561b8 shell "cat /proc/net/unix"
    info: [debug] WEBVIEW_14053 mapped to pid 14053
    info: [debug] Getting process name for webview
    info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s bbc561b8 shell "ps"
    info: [debug] Parsed pid: 14053 pkg: com.tencent.mm:tools
    info: [debug] from: u0_a207,14053,317,2446404,308680,ffffffff,00000000,R,com.tencent.mm:tools
    info: [debug] returning process name: com.tencent.mm:tools
    info: [debug] Available contexts: NATIVE_APP,WEBVIEW_com.tencent.mm:tools
    info: [debug] ["WEBVIEW_com.tencent.mm:tools"]
    info: [debug] Available contexts: NATIVE_APP,WEBVIEW_com.tencent.mm:tools
    info: [debug] Responding to client with success: {"status":0,"value":["NATIVE_APP","WEBVIEW_com.tencent.mm:tools"],"sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86"}
    info: <-- GET /wd/hub/session/5821155f-c340-4d3d-ad20-9f5ee64e3b86/contexts 200 205.263 ms - 117 {"status":0,"value":["NATIVE_APP","WEBVIEW_com.tencent.mm:tools"],"sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86"}
    info: --> GET /wd/hub/session/5821155f-c340-4d3d-ad20-9f5ee64e3b86/context {}
    info: [debug] Responding to client with success: {"status":0,"value":"WEBVIEW_com.tencent.mm:tools","sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86"}
    info: <-- GET /wd/hub/session/5821155f-c340-4d3d-ad20-9f5ee64e3b86/context 200 0.602 ms - 102 {"status":0,"value":"WEBVIEW_com.tencent.mm:tools","sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86"}
    info: --> POST /wd/hub/session/5821155f-c340-4d3d-ad20-9f5ee64e3b86/element {"using":"name","sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86","value":"player-id"}
    info: JSONWP Proxy: Proxying [POST /wd/hub/session/5821155f-c340-4d3d-ad20-9f5ee64e3b86/element] to [POST http://127.0.0.1:9515/wd/hub/session/a3198efbfc3ebd3eb5753e3817aec154/element] with body: {"using":"name","sessionId":"5821155f-c340-4d3d-ad20-9f5ee64e3b86","value":"player-id"}
    info: [debug] Didn't get a new command in 60 secs, shutting down...
    info: Shutting down appium session
    info: [debug] Pressing the HOME button
    info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s bbc561b8 shell "input keyevent 3"
    info: [debug] Resetting IME to 'io.appium.android.ime/.UnicodeIME'
    info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s bbc561b8 shell "ime set io.appium.android.ime/.UnicodeIME"
    info: [debug] Stopping logcat capture
    info: [debug] Logcat terminated with code null, signal SIGTERM
    info: [debug] Stopping chromedriver for context WEBVIEW_com.tencent.mm:tools
    info: Chromedriver: Changed state to 'stopping'
    info: JSONWP Proxy: Proxying [DELETE /] to [DELETE http://127.0.0.1:9515/wd/hub/session/a3198efbfc3ebd3eb5753e3817aec154] with no body

  • #3 楼 @chenhengjie123 不是新窗口,链接是在当前页打开的,而且新页面加载完之后,连打印 context 之类的命令都没有 response 了

    —— 来自 TesterHome 官方 安卓客户端

  • #4 楼 @Lihuazhang 我打印过 context 和 window handler 都没增加

    —— 来自 TesterHome 官方 安卓客户端

  • 早参考过这篇文章了的,我的问题不太一样。我是切换成功了 webview 的,说的是我打开一个 H5,然后点击了 H5 里面的链接在当前页加载了另一个 H5 页面,但是这个 H5 页面没法用 appium 的所有方法操作。

  • 我的真机非 chrome 也不行呀,求问怎么解决?

  • 写得很好,实践性比较强

  • pexpect 的 run 和 spawn windows 不支持,有啥看替代的?

  • 膜拜~~