weixin_39779537
weixin_39779537
2020-12-08 20:42

运行webview demo报错

log: 测试用例:WebViewTest 所有者:Administrator 优先级:High 超时:5分钟 步骤1: 1、登录Android demo,进入网页视图 RESOURCE: acquire resource (res_type:android, res_group:None, condition:{}) successfully 172.16.0.227:5555(google Nexus 5 armeabi-v7a Android 6.0.1) ENVIRONMENT: 申请 Android 设备成功:google Nexus 5(172.16.0.227:5555) Hello GetControl GetControlVisibility EnableSoftInput SetControlText GetControl GetControlVisibility EnableSoftInput SetControlText GetControl GetControlVisibility GetObjectFieldValue GetControlRect GetControlRect Click INFO: 登录完成 GetControl GetControlVisibility GetObjectFieldValue GetControlRect GetControlRect Click 步骤2: 2、检查网页标题 GetControl EvalScript CRITICAL: run_test执行失败 Traceback (most recent call last): File "D:\Python36\lib\site-packages\qt4a\andrcontrols.py", line 1702, in eval_script return self._driver.eval_script(self.hashcode, frame_xpaths, script) File "D:\Python36\lib\site-packages\qt4a\androiddriver\androiddriver.py", line 824, in eval_script result = self.send_command(EnumCommand.CmdEvalScript, Control=control, Script=script, Frame=frame_xpaths) File "D:\Python36\lib\site-packages\qt4a\androiddriver\androiddriver.py", line 504, in send_command raise AndroidSpyError(result['Error']) qt4a.androiddriver.util.AndroidSpyError: java.lang.RuntimeException: java.lang.RuntimeException: Get Field mAwContents Failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "D:\Python36\lib\site-packages\testbase\testcase.py", line 701, in _thread_run getattr(self._testcase, it)() File "E:/QT4ADemoProj-master/demotest/webview.py", line 35, in run_test demo_webpage = DemoWebPage(demo_webpanel.Controls["webview"]) File "D:\Python36\lib\site-packages\qt4w\webcontrols.py", line 1058, in init if wait_for_ready: self.wait_for_ready() File "D:\Python36\lib\site-packages\qt4w\webcontrols.py", line 1125, in wait_for_ready if self.ready_state == 'complete': return File "D:\Python36\lib\site-packages\qt4w\webcontrols.py", line 1100, in ready_state return self.exec_script('document.readyState') File "D:\Python36\lib\site-packages\qt4w\util.py", line 144, in wrap_func ret = func(args, *kwargs) File "D:\Python36\lib\site-packages\qt4w\webcontrols.py", line 1147, in exec_script return self._webdriver.eval_script(self._locator, script) File "D:\Python36\lib\site-packages\qt4a\androiddriver\webdriver.py", line 2080, in eval_script raise e File "D:\Python36\lib\site-packages\qt4a\androiddriver\webdriver.py", line 2065, in eval_script return super(AndroidWebDriver, self).eval_script(frame_xpaths, script) File "D:\Python36\lib\site-packages\qt4w\webdriver\webdriver.py", line 412, in eval_script raise e File "D:\Python36\lib\site-packages\qt4w\webdriver\webdriver.py", line 395, in eval_script return self._webview.eval_script(frame_xpaths, script) File "D:\Python36\lib\site-packages\qt4a\andrcontrols.py", line 1759, in eval_script return self.webview_impl.eval_script(frame_xpaths, script) File "D:\Python36\lib\site-packages\qt4a\andrcontrols.py", line 1711, in eval_script raise JavaScriptError(frame_xpaths, e.args[0]) qt4w.util.JavaScriptError: []java.lang.RuntimeException: java.lang.RuntimeException: Get Field mAwContents Failed

172.16.0.227:5555的截图:E:\QT4ADemoProj-master\demotest\WebViewTest_172.16.0.227_5555_1551148419.4499266.png CRITICAL: post_test执行失败 Traceback (most recent call last): File "D:\Python36\lib\site-packages\testbase\testcase.py", line 701, in _thread_run getattr(self._testcase, it)() File "E:\QT4ADemoProj-master\demolib\demotestbase.py", line 17, in post_test super(DemoTestBase, self).post_test() File "D:\Python36\lib\site-packages\qt4a\androidtestbase.py", line 83, in post_test self._save_logcat() File "D:\Python36\lib\site-packages\qt4a\androidtestbase.py", line 250, in _save_logcat device.adb.save_log(log_path) File "D:\Python36\lib\site-packages\qt4a\androiddriver\adb.py", line 442, in save_log f.write('\n'.join(log_list)) UnicodeEncodeError: 'gbk' codec can't encode character '\u0402' in position 88914: illegal multibyte sequence

User-Agent: Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5 Build/M4B30X; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/72.0.3626.105 Mobile Safari/537.36

该提问来源于开源项目:Tencent/QT4A

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

4条回答

  • weixin_39843151 weixin_39843151 4月前

    开发者选项=>WebView实现中是不是使用了Chrome,而不是Android System WebView

    点赞 评论 复制链接分享
  • weixin_39779537 weixin_39779537 4月前

    开发者选项=>WebView实现中是不是使用了Chrome,而不是Android System WebView

    查询开发者选项无此配置项

    点赞 评论 复制链接分享
  • weixin_39843151 weixin_39843151 4月前

    问题已解决,请使用v2.2.10以上版本

    1. 更新qt4a
    
    $ pip install -U qt4a
    
    1. 更新测试桩
    
    $ qt4a-manage install-driver
    
    1. 重启应用
    点赞 评论 复制链接分享
  • weixin_39779537 weixin_39779537 4月前

    问题已解决,请使用v2.2.10以上版本

    1. 更新qt4a

    
    $ pip install -U qt4a
    
    1. 更新测试桩

    
    $ qt4a-manage install-driver
    
    1. 重启应用

    非常感谢

    点赞 评论 复制链接分享