【minium】提示config中找不到project_path,由于目标计算机积极拒绝,无法连接?
发布于 5 年前 作者 jinfang 7332 次浏览 来自 官方Issues

使用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;

回到顶部