• 实现 iosMonkey (python 版) at 2017年04月19日

    MengfeifeideMac-Mini:~ mff$ python /Users/mff/Desktop/iosMonkey/run.py
    Traceback (most recent call last):
    File "/Users/mff/Desktop/iosMonkey/run.py", line 5, in
    from parameters.monkey import monkey
    File "/Users/mff/Desktop/iosMonkey/parameters/monkey.py", line 5, in
    from macaca import WebDriver
    ImportError: No module named macaca
    MengfeifeideMac-Mini:~ mff$

    运行 run.py 时报错,您知道怎么解决么?谢谢~没怎么用过 python,不太理解

  • 实现 iosMonkey (python 版) at 2017年04月19日

    python 的版本是 2.x 还是 3.x?

  • 问题有解决吗?我也遇到同样的问题

  • #2 楼 @xiaoxuxu 问题解决了么?谢谢~

  • [MJSONWP] Encountered internal error running command: Error: Could not proxy. Proxy error: Could not proxy command to remote server. Original error: Error: ESOCKETTIMEDOUT
    at doJwpProxy$ (../../../lib/mjsonwp/mjsonwp.js:343:13)
    at tryCatch (/usr/local/lib/node_modules/appium/node_modules/.5.8.24@babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke as _invoke
    at GeneratorFunctionPrototype.prototype.(anonymous function) as throw
    at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/.5.8.24@babel-runtime/regenerator/runtime.js:136:37)
    [HTTP] <-- GET /wd/hub/session/26554ee3-1ce5-4e52-9773-54db34ebcaea/url 500 240009 ms - 281
    [HTTP] --> DELETE /wd/hub/session/26554ee3-1ce5-4e52-9773-54db34ebcaea {}
    [debug] [MJSONWP] Calling AppiumDriver.deleteSession() with args: ["26554ee3-1ce5-4e52-9773-54db34ebcaea"]
    [debug] [AndroidDriver] Shutting down Android driver
    [debug] [AndroidDriver] Stopping chromedriver for context WEBVIEW_com.tencent.mm:tools
    [debug] [Chromedriver] Changed state to 'stopping'
    [debug] [JSONWP Proxy] Proxying [DELETE /] to [DELETE http://127.0.0.1:8002/wd/hub/session/bb37a650bdf7b09a3af75a32e9d6247d] with no body
    [Chromedriver] [STDERR] [304.967][SEVERE]: Timed out receiving message from renderer: 300.000
    [Chromedriver] [STDERR] [421.311][SEVERE]: Unable to receive message from renderer
    [Logcat] Logcat terminated with code 0, signal null
    [UiAutomator] UiAutomator exited unexpectedly with code 0, signal null
    [debug] [UiAutomator] Moving to state 'stopped'
    [debug] [AndroidDriver] Shutting down Android driver
    [Appium] Closing session, cause was 'UiAUtomator shut down unexpectedly'
    [Appium] Removing session 26554ee3-1ce5-4e52-9773-54db34ebcaea from our master session list
    [debug] [AndroidDriver] Stopping chromedriver for context WEBVIEW_com.tencent.mm:tools
    [debug] [Chromedriver] Changed state to 'stopping'
    [debug] [JSONWP Proxy] Proxying [DELETE /] to [DELETE http://127.0.0.1:8002/wd/hub/session/bb37a650bdf7b09a3af75a32e9d6247d] with no body
    [debug] [JSONWP Proxy] Got response with status 200: "{\"sessionId\":\"bb37a650bdf7b09a3af75a32e9d6247d\",\"status\":0,\"value\":null}"
    [Chromedriver] ProxyRequestError: Could not proxy command to remote server. Original error: Error: connect ECONNREFUSED 127.0.0.1:8002
    at JWProxy.proxy$ (../../../lib/jsonwp-proxy/proxy.js:127:13)
    at tryCatch (/usr/local/lib/node_modules/appium/node_modules/.5.8.24@babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke as _invoke
    at GeneratorFunctionPrototype.prototype.(anonymous function) as throw
    at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/.5.8.24@babel-runtime/regenerator/runtime.js:136:37)
    { ProxyRequestError: Could not proxy command to remote server. Original error: Error: connect ECONNREFUSED 127.0.0.1:8002
    at JWProxy.proxy$ (../../../lib/jsonwp-proxy/proxy.js:127:13)
    at tryCatch (/usr/local/lib/node_modules/appium/node_modules/.5.8.24@babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke as _invoke
    at GeneratorFunctionPrototype.prototype.(anonymous function) as throw
    at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/.5.8.24@babel-runtime/regenerator/runtime.js:136:37)
    jsonwp:
    { Error: connect ECONNREFUSED 127.0.0.1:8002
    at Object.exports._errnoException (util.js:1022:11)
    at exports._exceptionWithHostPort (util.js:1045:20)
    at TCPConnectWrap.afterConnect as oncomplete
    code: 'ECONNREFUSED',
    errno: 'ECONNREFUSED',
    syscall: 'connect',
    address: '127.0.0.1',
    port: 8002 } }
    [debug] [ADB] Getting connected devices...
    [debug] [Chromedriver] Changed state to 'stopped'
    [debug] [ADB] Getting connected devices...
    [debug] [ADB] 0 device(s) connected
    Unhandled rejection Error: No device connected, cannot run adb shell command 'am force-stop com.tencent.mm'
    at ADB.callee$0$0$ (../../../lib/tools/system-calls.js:208:11)
    at tryCatch (/usr/local/lib/node_modules/appium/node_modules/.5.8.24@babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke as _invoke
    at GeneratorFunctionPrototype.prototype.(anonymous function) as next
    at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/.5.8.24@babel-runtime/regenerator/runtime.js:136:37)
    [debug] [ADB] 0 device(s) connected
    [Appium] Had trouble ending session 26554ee3-1ce5-4e52-9773-54db34ebcaea: No device connected, cannot run adb shell command 'am force-stop com.tencent.mm'
    [Appium] Removing session 26554ee3-1ce5-4e52-9773-54db34ebcaea from our master session list
    [MJSONWP] Encountered internal error running command: Error: No device connected, cannot run adb shell command 'am force-stop com.tencent.mm'
    at ADB.callee$0$0$ (../../../lib/tools/system-calls.js:208:11)
    at tryCatch (/usr/local/lib/node_modules/appium/node_modules/.5.8.24@babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke as _invoke
    at GeneratorFunctionPrototype.prototype.(anonymous function) as next
    at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/.5.8.24@babel-runtime/regenerator/runtime.js:136:37)
    at process._tickCallback (internal/process/next_tick.js:103:7)
    [HTTP] <-- DELETE /wd/hub/session/26554ee3-1ce5-4e52-9773-54db34ebcaea 500 176308 ms - 251

  • 您好,我也是 appium 切换 webview 后,进入 url 后再次点击链接,进入第二页面的 url 后没有反应,此时使用代码: System.out.println(driver.getCurrentUrl());一直没有响应,知道最后 timeout 了。貌似加载到第二页的 url 后,chromedriver 不能获取 body 的信息,导致这个页面加载失败。有人解决这个类似的问题么?

    timeout 之前显示错误信息:
    [debug] [ADB] Getting connected devices...
    [debug] [ADB] 1 device(s) connected
    [debug] [ADB] Running '/Users/mff/Desktop/workspace/android-sdk-macosx/platform-tools/adb' with args: ["-P",5037,"-s","57b51c43","shell","ps"]
    [debug] [ADB] 1 device(s) connected
    [debug] [ADB] Running '/Users/mff/Desktop/workspace/android-sdk-macosx/platform-tools/adb' with args: ["-P",5037,"-s","57b51c43","shell","ps"]
    [debug] [ADB] 1 device(s) connected
    [debug] [ADB] Running '/Users/mff/Desktop/workspace/android-sdk-macosx/platform-tools/adb' with args: ["-P",5037,"-s","57b51c43","shell","ps"]
    [debug] [AndroidDriver] Parsed pid: 16121 pkg: com.tencent.mm:tools!
    [debug] [AndroidDriver] from: u0_a124,16121,466,1701652,157084,ffffffff,00000000,S,com.tencent.mm:tools
    [debug] [AndroidDriver] returning process name: com.tencent.mm:tools
    [debug] [AndroidDriver] Parsed pid: 23591 pkg: com.android.browser!
    [debug] [AndroidDriver] from: u0_a2,23591,466,1191136,66424,ffffffff,00000000,S,com.android.browser
    [debug] [AndroidDriver] returning process name: com.android.browser
    [debug] [AndroidDriver] Parsed pid: 20021 pkg: com.android.quicksearchbox!
    [debug] [AndroidDriver] from: u0_a80,20021,465,1992180,93528,ffffffff,00000000,S,com.android.quicksearchbox
    [debug] [AndroidDriver] returning process name: com.android.quicksearchbox
    [debug] [AndroidDriver] Found webviews: ["WEBVIEW_com.android.browser","WEBVIEW_com.tencent.mm:tools","WEBVIEW_com.android.quicksearchbox"]
    [debug] [AndroidDriver] Available contexts: ["NATIVE_APP","WEBVIEW_com.android.browser","WEBVIEW_com.tencent.mm:tools","WEBVIEW_com.android.quicksearchbox"]
    [debug] [AndroidDriver] Connecting to chrome-backed webview context 'WEBVIEW_com.tencent.mm:tools'
    [debug] [AndroidDriver] A port was not given, using random port: 8002
    [debug] [Chromedriver] Changed state to 'starting'
    [Chromedriver] Set chromedriver binary as: /usr/local/lib/node_modules/appium/node_modules/.2.10.0@appium-chromedriver/chromedriver/mac/chromedriver
    [Chromedriver] Killing any old chromedrivers, running: pkill -15 -f "/usr/local/lib/node_modules/appium/node_modules/.2.10.0@appium-chromedriver/chromedriver/mac/chromedriver.*--port=8002"
    [Chromedriver] No old chromedrivers seemed to exist
    [Chromedriver] Spawning chromedriver with: /usr/local/lib/node_modules/appium/node_modules/.2.10.0@appium-chromedriver/chromedriver/mac/chromedriver --url-base=wd/hub --port=8002 --adb-port=5037
    [Chromedriver] [STDOUT] Starting ChromeDriver 2.26.436421 (6c1a3ab469ad86fd49c8d97ede4a6b96a49ca5f6) on port 8002
    Only local connections are allowed.
    [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8002/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.12.3\"}}}"
    [debug] [JSONWP Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8002/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.tencent.mm","androidUseRunningApp":true,"args":[],"extensions":[],"androidProcess":"com.tencent.mm:tools","androidDeviceSerial":"57b51c43"}}}
    [debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"bb37a650bdf7b09a3af75a32e9d6247d","status":0,"value":{"acceptSslCerts":true,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"browserName":"chrome","chrome":{"chromedriverVersion":"2.26.436421 (6c1a3ab469ad86fd49c8d97ede4a6b96a49ca5f6)"},"cssSelectorsEnabled":true,"databaseEnabled":false,"handlesAlerts":true,"hasTouchScreen":true,"javascriptEnabled":true,"locationContextEnabled":true,"mobileEmulationEnabled":false,"nativeEvents":true,"pageLoadStrategy":"normal","platform":"ANDROID","rotatable":false,"takesHeapSnapshot":true,"takesScreenshot":true,"unexpectedAlertBehaviour":"","version":"53.0.2785.49","webStorageEnabled":true}}
    [debug] [Chromedriver] Changed state to 'online'
    [debug] [MJSONWP] Responding to client with driver.setContext() result: null
    [HTTP] <-- POST /wd/hub/session/26554ee3-1ce5-4e52-9773-54db34ebcaea/context 200 609 ms - 76
    [HTTP] --> GET /wd/hub/session/26554ee3-1ce5-4e52-9773-54db34ebcaea/url {}
    [MJSONWP] Driver proxy active, passing request on via HTTP proxy
    [debug] [JSONWP Proxy] Proxying [GET /wd/hub/session/26554ee3-1ce5-4e52-9773-54db34ebcaea/url] to [GET http://127.0.0.1:8002/wd/hub/session/bb37a650bdf7b09a3af75a32e9d6247d/url] with body: {}
    [debug] [JSONWP Proxy] Got response with status 200: "{\"sessionId\":\"bb37a650bdf7b09a3af75a32e9d6247d\",\"status\":0,\"value\":\"https://h5.koudaitong.com/v2/common/error/closed?kdt_id=512479\"}"
    [JSONWP Proxy] Replacing sessionId bb37a650bdf7b09a3af75a32e9d6247d with 26554ee3-1ce5-4e52-9773-54db34ebcaea
    [HTTP] <-- GET /wd/hub/session/26554ee3-1ce5-4e52-9773-54db34ebcaea/url 200 78 ms - 136
    [HTTP] --> GET /wd/hub/session/26554ee3-1ce5-4e52-9773-54db34ebcaea/window_handle {}
    [MJSONWP] Driver proxy active, passing request on via HTTP proxy
    [debug] [JSONWP Proxy] Proxying [GET /wd/hub/session/26554ee3-1ce5-4e52-9773-54db34ebcaea/window_handle] to [GET http://127.0.0.1:8002/wd/hub/session/bb37a650bdf7b09a3af75a32e9d6247d/window_handle] with body: {}
    [debug] [JSONWP Proxy] Got response with status 200: "{\"sessionId\":\"bb37a650bdf7b09a3af75a32e9d6247d\",\"status\":0,\"value\":\"CDwindow-e24c7eee-f6f0-4a6b-9f17-afb56624c460\"}"
    [JSONWP Proxy] Replacing sessionId bb37a650bdf7b09a3af75a32e9d6247d with 26554ee3-1ce5-4e52-9773-54db34ebcaea
    [HTTP] <-- GET /wd/hub/session/26554ee3-1ce5-4e52-9773-54db34ebcaea/window_handle 200 5 ms - 119
    [HTTP] --> POST /wd/hub/session/26554ee3-1ce5-4e52-9773-54db34ebcaea/element {"using":"xpath","value":"/html/body/div/div/a"}
    [MJSONWP] Driver proxy active, passing request on via HTTP proxy
    [debug] [JSONWP Proxy] Proxying [POST /wd/hub/session/26554ee3-1ce5-4e52-9773-54db34ebcaea/element] to [POST http://127.0.0.1:8002/wd/hub/session/bb37a650bdf7b09a3af75a32e9d6247d/element] with body: {"using":"xpath","value":"/html/body/div/div/a"}
    [debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"bb37a650bdf7b09a3af75a32e9d6247d","status":0,"value":{"ELEMENT":"0.8047745299561335-1"}}
    [JSONWP Proxy] Replacing sessionId bb37a650bdf7b09a3af75a32e9d6247d with 26554ee3-1ce5-4e52-9773-54db34ebcaea
    [HTTP] <-- POST /wd/hub/session/26554ee3-1ce5-4e52-9773-54db34ebcaea/element 200 97 ms - 106
    [HTTP] --> GET /wd/hub/session/26554ee3-1ce5-4e52-9773-54db34ebcaea/element/0.8047745299561335-1/text {}
    [MJSONWP] Driver proxy active, passing request on via HTTP proxy
    [debug] [JSONWP Proxy] Proxying [GET /wd/hub/session/26554ee3-1ce5-4e52-9773-54db34ebcaea/element/0.8047745299561335-1/text] to [GET http://127.0.0.1:8002/wd/hub/session/bb37a650bdf7b09a3af75a32e9d6247d/element/0.8047745299561335-1/text] with body: {}
    [debug] [JSONWP Proxy] Got response with status 200: "{\"sessionId\":\"bb37a650bdf7b09a3af75a32e9d6247d\",\"status\":0,\"value\":\"前往会员主页\"}"
    [JSONWP Proxy] Replacing sessionId bb37a650bdf7b09a3af75a32e9d6247d with 26554ee3-1ce5-4e52-9773-54db34ebcaea
    [HTTP] <-- GET /wd/hub/session/26554ee3-1ce5-4e52-9773-54db34ebcaea/element/0.8047745299561335-1/text 200 110 ms - 92
    [HTTP] --> POST /wd/hub/session/26554ee3-1ce5-4e52-9773-54db34ebcaea/element/0.8047745299561335-1/click {"id":"0.8047745299561335-1"}
    [MJSONWP] Driver proxy active, passing request on via HTTP proxy
    [debug] [JSONWP Proxy] Proxying [POST /wd/hub/session/26554ee3-1ce5-4e52-9773-54db34ebcaea/element/0.8047745299561335-1/click] to [POST http://127.0.0.1:8002/wd/hub/session/bb37a650bdf7b09a3af75a32e9d6247d/element/0.8047745299561335-1/click] with body: {"id":"0.8047745299561335-1"}
    [debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"bb37a650bdf7b09a3af75a32e9d6247d","status":0,"value":null}
    [JSONWP Proxy] Replacing sessionId bb37a650bdf7b09a3af75a32e9d6247d with 26554ee3-1ce5-4e52-9773-54db34ebcaea
    [HTTP] <-- POST /wd/hub/session/26554ee3-1ce5-4e52-9773-54db34ebcaea/element/0.8047745299561335-1/click 200 266 ms - 76
    [HTTP] --> GET /wd/hub/session/26554ee3-1ce5-4e52-9773-54db34ebcaea/url {}
    [MJSONWP] Driver proxy active, passing request on via HTTP proxy
    [debug] [JSONWP Proxy] Proxying [GET /wd/hub/session/26554ee3-1ce5-4e52-9773-54db34ebcaea/url] to [GET http://127.0.0.1:8002/wd/hub/session/bb37a650bdf7b09a3af75a32e9d6247d/url] with body: {}

  • 微信 webview 的自动化技术 at 2017年01月24日

    @codeskyblue 谢谢,我的问题解决了,最终用的 chromedriver2.5,解决了问题,配置代码如下:
    DesiredCapabilities caps = new DesiredCapabilities();
    caps.setCapability("platform", "ANDROID");
    caps.setCapability("platformVersion", "5.1.1");
    caps.setCapability("deviceName", "A02AECPB2CLTG");
    caps.setCapability("browserName", "");
    caps.setCapability("app", "");

    caps.setCapability("appPackage", "com.tencent.mm");
    caps.setCapability("appActivity", ".ui.LauncherUI");
    caps.setCapability("fastReset", "false");
    caps.setCapability("fullReset", "false");
    caps.setCapability("noReset", "true");

    ChromeOptions options = new ChromeOptions();
    options.setExperimentalOption("androidProcess", "com.tencent.mm:appbrand1");
    caps.setCapability(ChromeOptions.CAPABILITY, options);
    driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), caps);
    实现代码如下:
    @Test
    public void miniProgramTest() throws Exception {

    // println(driver.getPageSource)
    driver.findElementByXPath("//[@text='发现']").click();
    Thread.sleep(1000);
    driver.findElementByXPath("//
    [@text='小程序']").click();
    Thread.sleep(1000);
    driver.findElementByXPath("//[contains(@text, 'QQ 阅读')]").click();
    Thread.sleep(3000);
    driver.findElementByXPath("//
    [@text='书库']").click();
    Set contextNames = driver.getContextHandles();
    Thread.sleep(1000);
    for (String contextName : contextNames) {
    System.out.println(contextName);
    }
    driver.context("WEBVIEW_com.tencent.mm:tools");
    Thread.sleep(1000);
    System.out.println("已经进入 WEBVIEW 啦");
    //System.out.println(driver.getPageSource());
    String s1 = driver.getWindowHandle();

    driver.findElementByXPath("//*[contains(@url, '古代')]").click();
    driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);
    Set set1 = driver.getWindowHandles();
    //System.out.println(set1);
    for(String windows: set1){
    if (windows.equalsIgnoreCase(s1)){

    }else{
    driver.switchTo().window(windows);
    }
    }
    //driver.manage().timeouts().implicitlyWait(60,TimeUnit.SECONDS);
    Thread.sleep(2000);
    driver.findElementByXPath("//[contains(@url, 'bid=716295')]").click();
    String s2 = driver.findElementByXPath("//
    [contains(@url, 'bid=716295')]").getText();
    System.out.println(s2);
    Assert.assertTrue(s2.contains("美人榻"));
    Thread.sleep(3000);
    driver.context("NATIVE_APP");
    System.out.println("已经回到 NativeAPP 啦");
    driver.findElementById("com.tencent.mm:id/io").click();
    //driver.findElement(By.id("com.tencent.mm:id/io")).click();
    }
    代码运行正常了,有遇到同样的问题,可以尝试一下我的方法。

  • @TheRoadNotTaken 进入 Webview 后不能操作页面元素,知道怎么解决么?定位方法没问题,提示:rg.openqa.selenium.NoSuchSessionException: no such session
    (Driver info: chromedriver=2.22.397929 (fb72fb249a903a0b1041ea71eb4c8b3fa0d9be5a),platform=Mac OS X 10.12.2 x86_64) (WARNING: The server did not provide any stacktrace information)
    Command duration or timeout: 28 milliseconds
    Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:49:13 -0700'
    System info: host: 'localhost', ip: '127.0.0.1', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.2', java.version: '1.8.0_121'
    Driver info: io.appium.java_client.android.AndroidDriver
    Capabilities [{app=, appPackage=com.tencent.mm, networkConnectionEnabled=true, noReset=true, warnings={}, databaseEnabled=false, deviceName=57b51c43, fullReset=false, platform=ANDROID, deviceUDID=57b51c43, appActivity=.ui.LauncherUI, desired={app=, appPackage=com.tencent.mm, noReset=true, deviceName=A02AECPB2CLTG, fullReset=false, platform=ANDROID, appActivity=.ui.LauncherUI, platformVersion=5.1.1, automationName=Appium, browserName=, fastReset=false, chromeOptions={args=[], extensions=[], androidProcess=com.tencent.mm:tools}, platformName=Android}, platformVersion=5.1.1, webStorageEnabled=false, locationContextEnabled=false, automationName=Appium, takesScreenshot=true, browserName=, javascriptEnabled=true, fastReset=false, chromeOptions={args=[], extensions=[], androidProcess=com.tencent.mm:tools}, platformName=Android}]
    Session ID: b5fee2fb-cc51-422d-8b01-eb742b86a603
    *** Element info: {Using=xpath, value=//*[contains(@url, '古代')]}

    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:216)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:168)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:635)
    at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:51)
    at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
    at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:368)
    at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:67)
    at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)
    at io.appium.java_client.android.AndroidDriver.findElement(AndroidDriver.java:1)
    at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:473)
    at io.appium.java_client.DefaultGenericMobileDriver.findElementByXPath(DefaultGenericMobileDriver.java:145)
    at io.appium.java_client.AppiumDriver.findElementByXPath(AppiumDriver.java:1)
    at io.appium.java_client.android.AndroidDriver.findElementByXPath(AndroidDriver.java:1)
    at Weixin.MiniProgramTest.miniProgramTest(MiniProgramTest.java:39)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:100)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:646)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:811)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1137)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
    at org.testng.TestRunner.privateRun(TestRunner.java:753)
    at org.testng.TestRunner.run(TestRunner.java:607)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:368)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:363)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:321)
    at org.testng.SuiteRunner.run(SuiteRunner.java:270)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1284)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1209)
    at org.testng.TestNG.runSuites(TestNG.java:1124)
    at org.testng.TestNG.run(TestNG.java:1096)
    at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:72)
    at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:127)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)

  • #17 楼 @601068603 问题解决了么?谢谢~

  • #19 楼 @luke 请问,切换到 Weview 后不操作 find element 怎么解决呢?谢谢~

  • 微信 webview 的自动化技术 at 2017年01月24日

    #64 楼 @codeskyblue 我觉得我这边现在是切换到了 WebView,但是不能对其元素进行操作,不知道具体问题在哪了,也可能是权限问题,H5 开发的时候,不让对其元素进行操作,这是我的猜测。你那边要是解决了,到时候分享一下哈~

  • 微信 webview 的自动化技术 at 2017年01月24日

    @codeskyblue 你那边的微信小程序,测试是可以通过的么?谢谢~

  • 微信 webview 的自动化技术 at 2017年01月24日

    #61 楼 @codeskyblue chromedriver 我降到了 2.3,2.4,2.5,2.2,2.1,目前提示的错误信息不一样了,代码运行到切换 webview 之后,一直没有响应,最后提示 org.openqa.selenium.NoSuchSessionException: no such session。server 端的提示信息是:我上传一个截图吧。

    微信的 WebView 版本可以通过 Chrome 的 ADB plugins 在 Inspect 页面元素的时候看到。

  • 微信 webview 的自动化技术 at 2017年01月24日

    #59 楼 @codeskyblue 您好,我的微信的 Webview 显示的是 53.0.2785.49,然后我手机上的 Chrome 是 55 的,这个有影响么?chromedriver 具体是根据哪个版本来选择合适的?是根据微信 Webview 的么?

  • #22 楼 @ort886 ChromeDriver 换成什么版本了?

  • 微信 webview 的自动化技术 at 2017年01月23日

    我也遇到一样的问题@codeskyblue,提示:unknown error: Chrome version must be >= 54.0.2840.0\n (Driver info: chromedriver=2.27.440174 。不知道怎么处理。