美文网首页Appium学习
Appium:运行测试用例报错“ConnectionRefuse

Appium:运行测试用例报错“ConnectionRefuse

作者: R_zb | 来源:发表于2019-10-01 20:22 被阅读0次

PyCharm运行测试用例报错

Testing started at 17:46 ...
C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\python.exe "D:\PyCharm 2018.3.2\helpers\pycharm\_jb_unittest_runner.py" --path C:/Users/Administrator/Desktop/appiumTest.py
Launching unittests with arguments python -m unittest C:/Users/Administrator/Desktop/appiumTest.py in C:\Users\Administrator\Desktop

Error
Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3-1.24.1-py3.7.egg\urllib3\connection.py", line 159, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3-1.24.1-py3.7.egg\urllib3\util\connection.py", line 80, in create_connection
    raise err
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3-1.24.1-py3.7.egg\urllib3\util\connection.py", line 70, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [WinError 10061] 由于目标计算机积极拒绝,无法连接。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3-1.24.1-py3.7.egg\urllib3\connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3-1.24.1-py3.7.egg\urllib3\connectionpool.py", line 354, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\http\client.py", line 1229, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\http\client.py", line 1275, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\http\client.py", line 1224, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\http\client.py", line 1016, in _send_output
    self.send(msg)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\http\client.py", line 956, in send
    self.connect()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3-1.24.1-py3.7.egg\urllib3\connection.py", line 181, in connect
    conn = self._new_conn()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3-1.24.1-py3.7.egg\urllib3\connection.py", line 168, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x02CFACD0>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\unittest\case.py", line 59, in testPartExecutor
    yield
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\unittest\case.py", line 611, in run
    self.setUp()
  File "C:\Users\Administrator\Desktop\appiumTest.py", line 20, in setUp
    self.driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\appium\webdriver\webdriver.py", line 144, in __init__
    proxy
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium-3.141.0-py3.7.egg\selenium\webdriver\remote\webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\appium\webdriver\webdriver.py", line 219, in start_session
    response = self.execute(RemoteCommand.NEW_SESSION, parameters)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium-3.141.0-py3.7.egg\selenium\webdriver\remote\webdriver.py", line 319, in execute
    response = self.command_executor.execute(driver_command, params)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium-3.141.0-py3.7.egg\selenium\webdriver\remote\remote_connection.py", line 374, in execute
    return self._request(command_info[0], url, body=data)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium-3.141.0-py3.7.egg\selenium\webdriver\remote\remote_connection.py", line 397, in _request
    resp = self._conn.request(method, url, body=body, headers=headers)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3-1.24.1-py3.7.egg\urllib3\request.py", line 72, in request
    **urlopen_kw)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3-1.24.1-py3.7.egg\urllib3\request.py", line 150, in request_encode_body
    return self.urlopen(method, url, **extra_kw)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3-1.24.1-py3.7.egg\urllib3\poolmanager.py", line 323, in urlopen
    response = conn.urlopen(method, u.request_uri, **kw)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3-1.24.1-py3.7.egg\urllib3\connectionpool.py", line 667, in urlopen
    **response_kw)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3-1.24.1-py3.7.egg\urllib3\connectionpool.py", line 667, in urlopen
    **response_kw)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3-1.24.1-py3.7.egg\urllib3\connectionpool.py", line 667, in urlopen
    **response_kw)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3-1.24.1-py3.7.egg\urllib3\connectionpool.py", line 638, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3-1.24.1-py3.7.egg\urllib3\util\retry.py", line 398, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=4723): Max retries exceeded with url: /wd/hub/session (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x02CFACD0>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。'))



Ran 1 test in 5.024s

FAILED (errors=1)

进程已结束,退出代码 1

解决方法

原因 :  本地未运行Appium服务器
解决方法:启动Appium 服务器即可
Appium

Blog:

相关文章

网友评论

    本文标题:Appium:运行测试用例报错“ConnectionRefuse

    本文链接:https://www.haomeiwen.com/subject/aymkuctx.html