51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 726|回复: 1
打印 上一主题 下一主题

在微信切换 webview 时遇到 Original error

[复制链接]
  • TA的每日心情
    擦汗
    昨天 09:07
  • 签到天数: 527 天

    连续签到: 4 天

    [LV.9]测试副司令

    跳转到指定楼层
    1#
    发表于 2020-2-10 13:07:24 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
    1测试积点
    在微信切换 webview 时遇到 Original error: unknown error: Failed to get PID for com.tencent.mm:tools
    ##前置条件:
    1.真机 OPPO R11st
    2.安卓版本 7.1.1
    3.真机webview 66.0.3359.126(chrome浏览器和微信内嵌webview同此版本)
    4.appium 1.15.1
    ###代码
    1. public static void main(String[] args) throws Exception {
    复制代码


         //创建配置对象
      
    1. DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
    2.     desiredCapabilities.setCapability("deviceName","OPPO R11st");
    3.     //测试平台
    4.     desiredCapabilities.setCapability("platformName", "Android");
    5.     //安卓系统版本
    6.     desiredCapabilities.setCapability("paltformVersion", "7.1.1");
    7.     desiredCapabilities.setCapability("appPackage", "com.tencent.mm");
    8.     desiredCapabilities.setCapability("appActivity", ".ui.LauncherUI");
    9.     //不清除数据启动
    10.     desiredCapabilities.setCapability("noReset", "True");
    11.     desiredCapabilities.setCapability("recreateChromeDriverSessions","True");
    12.     //自动化引擎(解决输入框不能输入的问题)
    13.     desiredCapabilities.setCapability("automationName", "uiautomator2");
    14.     // 支持X5内核应用自动化配置
    15.     desiredCapabilities.setCapability("recreateChromeDriverSessions", true);
    16.     ChromeOptions options = new ChromeOptions();
    17.     options.setExperimentalOption("androidProcess", "com.tencent.mm:tools");
    18.     desiredCapabilities.setCapability(ChromeOptions.CAPABILITY, options);
    19.     desiredCapabilities.setCapability("browserName","");
    复制代码

    1. <p>//创建驱动
    2.     androidDriver = new AndroidDriver(new URL("<a href="http://127.0.0.1:4723/wd/hub">http://127.0.0.1:4723/wd/hub</a>"), desiredCapabilities);
    3.     //元素超时等待
    4.     androidDriver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
    5.     weChat();
    6.     //关闭驱动
    7.     androidDriver.quit();</p><p>}</p><p> public static void weChat() throws Exception {
    8.      Thread.sleep(5000);
    9.      androidDriver.findElementById("com.tencent.mm:id/r_").click();
    10.      androidDriver.findElementById("com.tencent.mm:id/m7").sendKeys("接口测试号");
    11.      androidDriver.findElementById("com.tencent.mm:id/s7").click();
    12.      androidDriver.findElementByAndroidUIAutomator("new UiSelector().text(\"贷款\")").click();
    13.      androidDriver.findElementByAndroidUIAutomator("new UiSelector().text(\"卢贝尔TEST\")").click();
    14.      Thread.sleep(15000);
    15.      Set<String> context = androidDriver.getContextHandles();
    16.      for(String contextname : context){
    17.         System.out.println(contextname);//打印
    18.         if(contextname.equals("WEBVIEW_com.tencent.mm:tools"))
    19.             androidDriver.context(contextname);
    20.         }
    21.      System.out.println(androidDriver.findElementsByXPath("//*").toString());
    22.      System.out.println("进来了。。。。。。");
    23.      androidDriver.findElementByXPath("//*[@id=\"app\"]/div/div[2]/div[1]/img").click();
    24.      androidDriver.findElementByXPath("//*[@id=\"app\"]/div/div[1]/div[2]/div[1]/input").sendKeys("13983871447");
    25.      androidDriver.findElementByXPath("//*[@id=\"app\"]/div/div[1]/div[2]/div[2]/div").sendKeys("qwe000111");
    26.      androidDriver.findElementByXPath("//*[@id=\"app\"]/div/div[1]/div[3]/input").click();
    27.      Thread.sleep(25000);
    28. }
    29. ##appium详细信息
    30. ###这里可以看到pid是被找到了的
    31.   [2020-01-20 04:08:12][AndroidDriver] Parsed pid: '21104' pkg: 'com.tencent.mm:tools' from
    32. [2020-01-20 04:08:12][AndroidDriver]     USER      PID   PPID  VSIZE  RSS  FRZ          WCHAN              PC  NAME
    33. [2020-01-20 04:08:12][AndroidDriver]     u0_a297   21104 997   3907284 381152 efg           0 0000000000 S com.tencent.mm:tools
    34. [2020-01-20 04:08:12][AndroidDriver] Returning process name: 'com.tencent.mm:tools'
    35. [2020-01-20 04:08:12][AndroidDriver] Parsed pid: '20267' pkg: 'com.tencent.mm' from
    36. [2020-01-20 04:08:12][AndroidDriver]     USER      PID   PPID  VSIZE  RSS  FRZ          WCHAN              PC  NAME
    37. [2020-01-20 04:08:12][AndroidDriver]     u0_a297   20267 997   3487468 300536 efg           0 0000000000 S com.tencent.mm
    38. [2020-01-20 04:08:12][AndroidDriver] Returning process name: 'com.tencent.mm'
    39. [2020-01-20 04:08:12][AndroidDriver] Parsed pid: '20643' pkg: 'com.tencent.mm:appbrand0' from
    40. [2020-01-20 04:08:12][AndroidDriver]     USER      PID   PPID  VSIZE  RSS  FRZ          WCHAN              PC  NAME
    41. [2020-01-20 04:08:12][AndroidDriver]     u0_a297   20643 997   3474560 255204 unk           0 0000000000 S com.tencent.mm:appbrand0
    42. [2020-01-20 04:08:12][AndroidDriver] Returning process name: 'com.tencent.mm:appbrand0'
    43. [2020-01-20 04:08:12][AndroidDriver] Parsed pid: '21040' pkg: 'com.tencent.mm:toolsmp' from
    44. [2020-01-20 04:08:12][AndroidDriver]     USER      PID   PPID  VSIZE  RSS  FRZ          WCHAN              PC  NAME
    45. [2020-01-20 04:08:12][AndroidDriver]     u0_a297   21040 997   3227048 264568 unk           0 0000000000 S com.tencent.mm:toolsmp
    46. [2020-01-20 04:08:12][AndroidDriver] Returning process name: 'com.tencent.mm:toolsmp'
    47. [2020-01-20 04:08:12][AndroidDriver] Found webviews: ["WEBVIEW_com.tencent.mm:tools","WEBVIEW_com.tencent.mm:appbrand0","WEBVIEW_com.tencent.mm","WEBVIEW_com.tencent.mm:toolsmp"]
    48. [2020-01-20 04:08:12][AndroidDriver] Available contexts:
    49. ##appium报错信息
    50. [2020-01-20 04:08:12][Chromedriver] Starting MJSONWP Chromedriver session with capabilities: {
    51. [2020-01-20 04:08:12][Chromedriver]   "desiredCapabilities": {
    52. [2020-01-20 04:08:12][Chromedriver]     "chromeOptions": {
    53. [2020-01-20 04:08:12][Chromedriver]       "androidPackage": "com.tencent.mm",
    54. [2020-01-20 04:08:12][Chromedriver]       "androidUseRunningApp": true,
    55. [2020-01-20 04:08:12][Chromedriver]       "androidProcess": "com.tencent.mm:tools",
    56. [2020-01-20 04:08:12][Chromedriver]       "args": [],
    57. [2020-01-20 04:08:12][Chromedriver]       "extensions": [],
    58. [2020-01-20 04:08:12][Chromedriver]       "androidDeviceSerial": "8905da57"
    59. [2020-01-20 04:08:12][Chromedriver]     },
    60. [2020-01-20 04:08:12][Chromedriver]     "loggingPrefs": {
    61. [2020-01-20 04:08:12][Chromedriver]       "browser": "ALL"
    62. [2020-01-20 04:08:12][Chromedriver]     }
    63. [2020-01-20 04:08:12][Chromedriver]   }
    64. [2020-01-20 04:08:12][Chromedriver] }
    65. [2020-01-20 04:08:12][WD Proxy] Matched '/session' to command name 'createSession'
    66. [2020-01-20 04:08:12][WD Proxy] Proxying [POST /session] to [POST <a href="http://127.0.0.1:8000/wd/hub/session">http://127.0.0.1:8000/wd/hub/session</a>] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.tencent.mm","androidUseRunningApp":true,"androidProcess":"com.tencent.mm:tools","args":[],"extensions":[],"androidDeviceSerial":"8905da57"},"loggingPrefs":{"browser":"ALL"}}}
    67. [2020-01-20 04:08:14][WD Proxy] Got response with status 200: {"sessionId":"db8120c4243d3b2e3714bb62b5357a5b","status":13,"value":{"message":"unknown error: Failed to get PID for the following process: com.tencent.mm:tools\n  (Driver info: chromedriver=2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab),platform=Windows NT 6.1.7601 SP1 x86_64)"}}
    68. [2020-01-20 04:08:14][WD Proxy] Determined the downstream protocol as 'MJSONWP'
    69. [2020-01-20 04:08:14][WD Proxy] The response has an unknown format
    70. [2020-01-20 04:08:14][MJSONWP] Matched JSONWP error code 13 to UnknownError
    71. [2020-01-20 04:08:14][Chromedriver] Failed to start Chromedriver session: An unknown server-side error occurred while processing the command. Original error: unknown error: Failed to get PID for the following process: com.tencent.mm:tools
    72. [2020-01-20 04:08:14][Chromedriver]   (Driver info: chromedriver=2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab),platform=Windows NT 6.1.7601 SP1 x86_64)
    73. [2020-01-20 04:08:14][WD Proxy] Matched '/session' to command name 'createSession'
    74. [2020-01-20 04:08:14][WD Proxy] Proxying [POST /session] to [POST <a href="http://127.0.0.1:8000/wd/hub/session">http://127.0.0.1:8000/wd/hub/session</a>] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.tencent.mm","androidUseRunningApp":true,"androidProcess":"com.tencent.mm:tools","args":[],"extensions":[],"androidDeviceSerial":"8905da57"},"loggingPrefs":{"browser":"ALL"}}}
    75. [2020-01-20 04:08:15][WD Proxy] Got response with status 200: {"sessionId":"41893d46f51c7c60c153a16cd7cfe42f","status":13,"value":{"message":"unknown error: Failed to get PID for the following process: com.tencent.mm:tools\n  (Driver info: chromedriver=2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab),platform=Windows NT 6.1.7601 SP1 x86_64)"}}
    76. [2020-01-20 04:08:15][WD Proxy] Determined the downstream protocol as 'MJSONWP'
    77. [2020-01-20 04:08:15][WD Proxy] The response has an unknown format
    78. [2020-01-20 04:08:15][MJSONWP] Matched JSONWP error code 13 to UnknownError
    79. [2020-01-20 04:08:15][Chromedriver] Failed to start Chromedriver session: An unknown server-side error occurred while processing the command. Original error: unknown error: Failed to get PID for the following process: com.tencent.mm:tools</p>
    复制代码



    分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
    收藏收藏
    回复

    使用道具 举报

  • TA的每日心情
    奋斗
    昨天 07:28
  • 签到天数: 2812 天

    连续签到: 5 天

    [LV.Master]测试大本营

    2#
    发表于 2020-2-11 10:52:09 | 只看该作者
    不清楚
    回复

    使用道具 举报

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条

    小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

    GMT+8, 2024-11-16 16:35 , Processed in 0.071327 second(s), 21 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

    快速回复 返回顶部 返回列表