• 请问下:

    我重新build之后还是未能解决 请问有人知道原因吗

  • 大家好,我也遇到了不能微信不能切换webview的问题,切换时一直卡主,我是用的python,已经看了上面的的一些解决方法。也加了desired_caps['chromeOptions']={'androidProcess': 'com.tencent.mm:tools'},以及尝试了各个driver版本。手机是安卓6.0.
    请问哪位同胞能给点相关的意见。
    如下是代码,
    from selenium.webdriver.support.wait import WebDriverWait
    from appium import webdriver
    from appium.webdriver.mobilecommand import MobileCommand
    import time
    desired_caps = {}
    desired_caps['automationName']='Appium'
    desired_caps['platformName'] = 'Android'
    desired_caps['platformVersion'] = '6.0'
    desired_caps['deviceName'] = 'R3E0216C10002466'
    desired_caps['noReset'] = True
    desired_caps['appPackage'] = 'com.tencent.mm'
    desired_caps['appActivity'] = 'com.tencent.mm.ui.LauncherUI'
    desired_caps['chromeOptions']={'androidProcess': 'com.tencent.mm:tools'}
    driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
    print driver
    time.sleep(10)
    d1 = driver.find_element_by_xpath('//*[@text="我"]')
    print d1
    time.sleep(10)
    a=driver.contexts

    print a
    print driver.current_context
    driver.switch_to.context('WEBVIEW_com.tencent.mm:appbrand0')
    print driver.current_context

    ---------------------如下是日志-------------------
    [debug] [AndroidDriver] Returning process name: 'com.tencent.mm:support'
    [debug] [AndroidDriver] Found webviews: ["WEBVIEW_com.tencent.mm:tools","WEBVIEW_com.tencent.mm:appbrand0","WEBVIEW_com.tencent.mm:support"]
    [debug] [AndroidDriver] Available contexts: ["NATIVE_APP","WEBVIEW_com.tencent.mm:tools","WEBVIEW_com.tencent.mm:appbrand0","WEBVIEW_com.tencent.mm:support"]
    [debug] [AndroidDriver] Connecting to chrome-backed webview context 'WEBVIEW_com.tencent.mm:appbrand0'
    [debug] [AndroidDriver] A port was not given, using random port: 8000
    [debug] [Chromedriver] Changed state to 'starting'
    [Chromedriver] Set chromedriver binary as: C:\Users\woxia\AppData\Roaming\npm\node_modules\appium\node_modules_appium-chromedriver@3.4.0@appium-chromedriver\chromedriver\win\chromedriver.exe
    [debug] [Chromedriver] Killing any old chromedrivers, running: FOR /F "usebackq tokens=5" %a in (netstat -nao ^| findstr /R /C:"8000 ") do (FOR /F "usebackq" %b in (TASKLIST /FI "PID eq %a" ^| findstr /I chromedriver.exe) do (IF NOT %b=="" TASKKILL /F /PID %a))
    [Chromedriver] No old chromedrivers seemed to exist
    [debug] [Chromedriver] Cleaning any old adb forwarded port socket connections
    [debug] [ADB] List forwarding ports
    [debug] [ADB] Running 'C:\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","R3E0216C10002466","forward","--list"]
    [Chromedriver] Spawning chromedriver with: C:\Users\woxia\AppData\Roaming\npm\node_modules\appium\node_modules_appium-chromedriver@3.4.0@appium-chromedriver\chromedriver\win\chromedriver.exe --url-base=wd/hub --port=8000 --adb-port=5037 --verbose
    [debug] [Chromedriver] Chromedriver version: '2.28.455520'
    [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\":\"Windows NT\",\"version\":\"10.0.16299\"}}}"
    [debug] [JSONWP Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8000/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.tencent.mm","androidUseRunningApp":true,"androidProcess":"com.tencent.mm:tools","androidDeviceSerial":"R3E0216C10002466"}}}
    [debug] [Chromedriver] Webview version: 'Chrome/57.0.2987.132'
    [debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"45f1e1a238181e7412a59ee7ef6ebc90","status":13,"value":{"message":"unknown error: unable to discover open pages\n (Driver info: chromedriver=2.28.455520 (cc17746adff54984afff480136733114c6b3704b),platform=Windows NT 10.0.16299 x86_64)"}}
    [Chromedriver] Error: Failed to start Chromedriver session: An unknown server-side error occurred while processing the command. (Original error: unknown error: unable to discover open pages
    Chromedriver)
    [Chromedriver] at Object.wrappedLogger.errorAndThrow (../../lib/logging.js:78:13)
    [Chromedriver] at Chromedriver.callee$2$0$ (../../lib/chromedriver.js:217:13)
    [Chromedriver] at tryCatch (C:\Users\woxia\AppData\Roaming\npm\node_modules\appium\node_modules_babel-runtime@5.8.24@babel-runtime\regenerator\runtime.js:67:40)
    [Chromedriver] at GeneratorFunctionPrototype.invoke as _invoke
    [Chromedriver] at GeneratorFunctionPrototype.prototype.(anonymous function) as throw
    [Chromedriver] at GeneratorFunctionPrototype.invoke (C:\Users\woxia\AppData\Roaming\npm\node_modules\appium\node_modules_babel-runtime@5.8.24@babel-runtime\regenerator\runtime.js:136:37)
    [Chromedriver] at
    [debug] [JSONWP Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8000/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.tencent.mm","androidUseRunningApp":true,"androidProcess":"com.tencent.mm:tools","androidDeviceSerial":"R3E0216C10002466"}}}
    [debug] [Chromedriver] Webview version: 'Chrome/57.0.2987.132'

  • 按照你说的步骤看了下,的确是42.0.2311.138这个版本号。也就是要下42对应的chromedriver么?

  • 你这个是linux的命令,我是windows的。

  • 现在一般都用1.6.3以后的版本了,毕竟加入了uiautomator2,主要是对toast的支持。你都报了些啥错啊

  • 2.27也试过,提示>54 和前面的错误一样 只有26是上面给你截图这个错误


  • 用了26之后,报的又是这个错了。不能发现打开的页面。

  • 我用chromedriver=2.29时,提示chorme version>56 用2.28就提示上面的要>55,我手机和电脑chrome都是装的58呢。

  • 上面日志打印了chromedriver的版本,你说的这个目录我也查看过,现在chromedriver最新的是2.29,现在是2.28同样都支持55以上的版本的。所以不知道咋回事了


  • 有这样的错误日志。 有webview,在执行switch_to_context的时候就这样了,楼主知道怎么解决吗