- import minium提示找不到?
[图片] 终端输入minitest -v有相关信息返回,项目中也pip install minitest了,但是import minium提示无相关文件,怎么处理?
2022-06-10 - 【minium】小程序运行后,如何通过minium获取console中的日志信息?
各位朋友,我想问下如何听过minium获取微信开发者工具中console下的日志?
2021-05-25 - 【minium】真机运行后,如何获取Console中的日志内容?
使用minium使用真机运行后,我想要获取Console中的日志内容做断言,想问下通过什么办法可以获取?
2021-05-21 - 【minium】提示配置文件中找不到project_path?
按照官方文档对config.json做了如下配置: { "project_path": "C:\\Users\\wb.chenchunzhi20\\Desktop\\小程序测试包\\测试环境\\V4.2.1测试", "dev_tool_path": "C:\\Program Files (x86)\\Tencent\\微信web开发者工具\\cli.bat", "platform": "Android", "device_desire": { "serial": "e4ddf97e", "uiautomator_version": "2" }, "debug_mode": "info", "test_port": "9420", "close_ide": "False" } /也用\\做了替换; first_test.py文件中代码如下: #!/usr/bin/env python3 import minium mini = minium.WXMinium() mini.connect_dev_tool() class test(minium.MiniTest): def test_ui_op(self): self.assertTexts(["房间名"], "view") if __name__ == "__main__": test().test_ui_op() 右键运行first_test.py文件后,报如下错误: D:\Python3\python.exe C:/Users/wb.chenchunzhi20/Desktop/UI自动化/小程序自动化/wechatDemo序自动化/wechatDemo/test/first_test.py C:\Users\wb.chenchunzhi20\Desktop\UI自动化\小程序自动化\wechatDemo序自动化\wechatDemo Can not find project_path in config, that means you must open dev tool by automation way first [WinError 10061] 由于目标计算机积极拒绝,无法连接。 minumexception: {'TimeStamp': '2021-05-21 10:59:19', 'Type': 'MiniTimeoutError', 'Args': 'connect to server timeout: ws://localhost:9420, thread:False', 'Trace': '', 'Uin': 0, 'version': '', 'ext': ''} connect to server timeout: ws://localhost:9420, thread:False Traceback (most recent call last): File "D:\Python3\lib\site-packages\minium\miniprogram\wx_minium.py", line 204, in connect_dev_tool connection = Connection( File "D:\Python3\lib\site-packages\minium\miniprogram\base_driver\connection.py", line 59, in __init__ self._connect() File "D:\Python3\lib\site-packages\minium\miniprogram\base_driver\connection.py", line 109, in _connect raise MiniTimeoutError( minium.framework.exception.MiniTimeoutError: connect to server timeout: ws://localhost:9420, thread:False <html> <head><title>404 Not Found</title></head> <body bgcolor="white"> <center><h1>404 Not Found</h1></center> <hr><center>nginx</center> </body> </html> [WinError 10061] 由于目标计算机积极拒绝,无法连接。 python版本3.9.5; minitest版本1.0.6; 微信开发者工具版本为1.05.2105170; 微信开发者工具安全-服务端口已打开; 微信开发者工具基础库为2.16.1;
2021-05-21 - 【minium】提示config中找不到project_path,由于目标计算机积极拒绝,无法连接?
使用Windows电脑,用安卓手机做小程序自动化,config.json文件中配置了以下内容: { "project_path": "C:\\Users\\wb.chenchunzhi20\\Desktop\\小程序测试包\\测试环境\\V4.2.1测试", "dev_tool_path": "C:\\Program Files (x86)\\Tencent\\微信web开发者工具\\cli.bat", "platform": "Android", "device_desire": { "serial": "e4ddf97e", "uiautomator_version": "2" }, "debug_mode": "info", "test_port": "9420", "close_ide": "False" } 配置文件中的/也用\\做了替换; 然后first_test.py中的代码如下: #!/usr/bin/env python3 import minium mini = minium.WXMinium() mini.connect_dev_tool() class test(minium.MiniTest): def test_ui_op(self): self.assertTexts(["房间名"], "view") if __name__ == "__main__": test().test_ui_op() 使用pycharm右键运行first_test.py文件后,控制台输出以下错误: D:\Python3\python.exe C:/Users/wb.chenchunzhi20/Desktop/UI自动化/小程序自动化/wechatDemo序自动化/wechatDemo/test/first_test.py C:\Users\wb.chenchunzhi20\Desktop\UI自动化\小程序自动化\wechatDemo序自动化\wechatDemo Can not find project_path in config, that means you must open dev tool by automation way first [WinError 10061] 由于目标计算机积极拒绝,无法连接。 minumexception: {'TimeStamp': '2021-05-21 10:34:09', 'Type': 'MiniTimeoutError', 'Args': 'connect to server timeout: ws://localhost:9420, thread:False', 'Trace': '', 'Uin': 0, 'version': '', 'ext': ''} <html> <head><title>404 Not Found</title></head> <body bgcolor="white"> <center><h1>404 Not Found</h1></center> <hr><center>nginx</center> </body> </html> connect to server timeout: ws://localhost:9420, thread:False Traceback (most recent call last): File "D:\Python3\lib\site-packages\minium\miniprogram\wx_minium.py", line 204, in connect_dev_tool connection = Connection( File "D:\Python3\lib\site-packages\minium\miniprogram\base_driver\connection.py", line 59, in __init__ self._connect() File "D:\Python3\lib\site-packages\minium\miniprogram\base_driver\connection.py", line 109, in _connect raise MiniTimeoutError( minium.framework.exception.MiniTimeoutError: connect to server timeout: ws://localhost:9420, thread:False [WinError 10061] 由于目标计算机积极拒绝,无法连接。 minumexception: {'TimeStamp': '2021-05-21 10:34:40', 'Type': 'MiniTimeoutError', 'Args': 'connect to server timeout: ws://localhost:9420, thread:False', 'Trace': '', 'Uin': 0, 'version': '', 'ext': ''} connect to server timeout: ws://localhost:9420, thread:False Traceback (most recent call last): File "D:\Python3\lib\site-packages\minium\miniprogram\wx_minium.py", line 204, in connect_dev_tool connection = Connection( File "D:\Python3\lib\site-packages\minium\miniprogram\base_driver\connection.py", line 59, in __init__ self._connect() File "D:\Python3\lib\site-packages\minium\miniprogram\base_driver\connection.py", line 109, in _connect raise MiniTimeoutError( minium.framework.exception.MiniTimeoutError: connect to server timeout: ws://localhost:9420, thread:False <html> <head><title>404 Not Found</title></head> <body bgcolor="white"> <center><h1>404 Not Found</h1></center> <hr><center>nginx</center> </body> </html> [WinError 10061] 由于目标计算机积极拒绝,无法连接。 微信开发者工具版本号为最新版本:1.05.2105170; 微信开发者工具基础库为:2.16.1; 微信开发者工具中的安全-服务端口也已打开; python版本为V3.9.5; minitest版本为1.0.6;
2021-05-21 - 【minium】config.json文件不生效怎么办?
使用Windows电脑进行真机运行,根目录下添加了config.json文件,内容如下: { "project_path": "C:\\Users\\wb.chenchunzhi20\\Desktop\\小程序测试包\\测试环境\\V4.2.1测试", "dev_tool_path": "C:\\Program Files (x86)\\Tencent\\微信web开发者工具\\.cli.bat", "platform": "Android" } first.test.py文件中的代码如下: import minium # mini = minium.Minium({ # # 小程序项目目录地址,这里是Windows系统的目录 # "project_path": "C:\\Users\\wb.chenchunzhi20\\Desktop\\小程序测试包\\测试环境\\V4.2.1测试", # # 开发者工具cli地址,Windows系统就是默认这个路径 # "dev_tool_path": "C:\\Program Files (x86)\\Tencent\\微信web开发者工具\\cli.bat", # "platform": "Android" # # }) import minium class ExceptionTest(minium.MiniTest): def test_get_current_page(self): self.page.get_element('view', inner_text='加入').click() if __name__ == '__main__': ExceptionTest().test_get_current_page() 运行first_test.py无法调用微信开发者工具,报错内容如下: Traceback (most recent call last): File "<input>", line 1, in <module> File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.1.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile pydev_imports.execfile(filename, global_vars, local_vars) # execute the script File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.1.1\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "C:/Users/wb.chenchunzhi20/Desktop/UI自动化/小程序自动化/wechatDemo序自动化/wechatDemo/test/first_test.py", line 22, in <module> ExceptionTest().test_get_current_page() File "C:/Users/wb.chenchunzhi20/Desktop/UI自动化/小程序自动化/wechatDemo序自动化/wechatDemo/test/first_test.py", line 18, in test_get_current_page self.page.get_element('view', inner_text='加入').click() File "D:\Python3\lib\site-packages\minium-1.0.6-py3.9.egg\minium\framework\assertbase.py", line 346, in __getattribute__ attr = super().__getattribute__(item) File "D:\Python3\lib\site-packages\minium-1.0.6-py3.9.egg\minium\framework\minitest.py", line 656, in page return self.mini.app.get_current_page() AttributeError: 'NoneType' object has no attribute 'app' 将first.test.py上边注释掉的内容打开后,可以正常真机运行,但是依旧会报以下错误: received async msg: 9dfd40ee-6d1c-4ecf-b234-e7634084aada Traceback (most recent call last): File "<input>", line 1, in <module> File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.1.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile pydev_imports.execfile(filename, global_vars, local_vars) # execute the script File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.1.1\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "C:/Users/wb.chenchunzhi20/Desktop/UI自动化/小程序自动化/wechatDemo序自动化/wechatDemo/test/first_test.py", line 22, in <module> ExceptionTest().test_get_current_page() File "C:/Users/wb.chenchunzhi20/Desktop/UI自动化/小程序自动化/wechatDemo序自动化/wechatDemo/test/first_test.py", line 18, in test_get_current_page self.page.get_element('view', inner_text='加入').click() File "D:\Python3\lib\site-packages\minium-1.0.6-py3.9.egg\minium\framework\assertbase.py", line 346, in __getattribute__ attr = super().__getattribute__(item) File "D:\Python3\lib\site-packages\minium-1.0.6-py3.9.egg\minium\framework\minitest.py", line 656, in page return self.mini.app.get_current_page() AttributeError: 'NoneType' object has no attribute 'app' 这种情况下我想问以下问题: 1.config.json文件如何生效? 2.'NoneType' object has no attribute 'app'这个问题怎么解决?
2021-05-19