Appium appium1.6.3,python 2.7,android7.0 真机想要获取登录时用微信登陆时唤起的登录页面元素

坏耳朵兔兔 · 2017年05月05日 · 613 次阅读

场景就是:登陆时用第三方的微信登陆,在授权登陆的页面,也就是微信的页面,无法获取到元素
我看了很多帖子之类,说是用 chromedriver 来切换到 webview,但是我通过 contextx 打印出来的还是自己的 app 的 webview
拿不到腾讯的页面,所以报错

[debug] [AndroidDriver] Getting process name for webview
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/Users/wangyu/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","KWG7N16727001846","shell","ps"]
[debug] [AndroidDriver] Parsed pid: 17919 pkg: com.taptap!
[debug] [AndroidDriver] from: u0_a219,17919,577,2849548,174588,0,0000000000,S,com.taptap
[debug] [AndroidDriver] returning process name: com.taptap
[debug] [AndroidDriver] Found webviews: ["WEBVIEW_com.taptap"]
[debug] [AndroidDriver] Available contexts: ["NATIVE_APP","WEBVIEW_com.taptap"]
[debug] [AndroidDriver] Connecting to chrome-backed webview context 'WEBVIEW_com.taptap'
[debug] [AndroidDriver] A port was not given, using random port: 8000
[debug] [Chromedriver] Changed state to 'starting'
[Chromedriver] Set chromedriver binary as: /usr/local/lib/node_modules/appium/node_modules/appium-chromedriver/chromedriver/mac/chromedriver
[Chromedriver] Killing any old chromedrivers, running: pkill -15 -f "/usr/local/lib/node_modules/appium/node_modules/appium-chromedriver/chromedriver/mac/chromedriver.*--port=8000"
[Chromedriver] No old chromedrivers seemed to exist
[Chromedriver] Spawning chromedriver with: /usr/local/lib/node_modules/appium/node_modules/appium-chromedriver/chromedriver/mac/chromedriver --url-base=wd/hub --port=8000 --adb-port=5037
[Chromedriver] [STDOUT] Starting ChromeDriver 2.25.426935 (820a95b0b81d33e42712f9198c215f703412e1a1) on port 8000
Only local connections are allowed.
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8000/wd/hub/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8000/wd/hub/status] with no body
[debug] [JSONWP Proxy] Got response with status 200: "{\"sessionId\":\"\",\"status\":0,\"value\":{\"build\":{\"version\":\"alpha\"},\"os\":{\"arch\":\"x86_64\",\"name\":\"Mac OS X\",\"version\":\"10.11.6\"}}}"
[debug] [JSONWP Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8000/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.taptap","androidUseRunningApp":true,"androidDeviceSerial":"KWG7N16727001846"}}}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"cda0607fdc41f5ef382de2e1dec5227c","status":13,"value":{"message":"unknown error: unable to discover open pages\n (Driver info: chromedriver=2.25.426935 (820a95b0b81d33e42712f9198c215f703412e1a1),platform=Mac OS X 10.11.6 x86_64)"}}
[debug] [JSONWP Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8000/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.taptap","androidUseRunningApp":true,"androidDeviceSerial":"KWG7N16727001846"}}}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"475273496b067c33e26b6dba1550d7ee","status":13,"value":{"message":"unknown error: unable to discover open pages\n (Driver info: chromedriver=2.25.426935 (820a95b0b81d33e42712f9198c215f703412e1a1),platform=Mac OS X 10.11.6 x86_64)"}}
[debug] [JSONWP Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8000/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.taptap","androidUseRunningApp":true,"androidDeviceSerial":"KWG7N16727001846"}}}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"6a89c472893cd84808e642c1ff018c57","status":13,"value":{"message":"unknown error: unable to discover open pages\n (Driver info: chromedriver=2.25.426935 (820a95b0b81d33e42712f9198c215f703412e1a1),platform=Mac OS X 10.11.6 x86_64)"}}
[debug] [JSONWP Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8000/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.taptap","androidUseRunningApp":true,"androidDeviceSerial":"KWG7N16727001846"}}}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"f6c226914f879129d5a9181a11ab6124","status":13,"value":{"message":"unknown error: unable to discover open pages\n (Driver info: chromedriver=2.25.426935 (820a95b0b81d33e42712f9198c215f703412e1a1),platform=Mac OS X 10.11.6 x86_64)"}}
[Chromedriver] Chromedriver exited unexpectedly with code null, signal SIGTERM
[debug] [Chromedriver] Changed state to 'stopped'
[Chromedriver] Error: unknown error: unable to discover open pages

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