Urllib.error.URLError: <urlopen error [WinError 10061] No connection could be made because the target machine actively refused it>

Hi guys,

Scope:
I am trying to write some tests for a mobile web app: tests should run on Android Emulator Firefox browser

Preconditions:
I successfully completed all steps found here http://appium.io/slate/en/master/?python#running-appium-on-windows
I have launched Android Emulator and installed Firefox apk
Cloned https://github.com/appium/python-client

Problem:
When trying to run the touch_action_tests.py i continuously get this error:

ERROR: test_tap (main.TouchActionTests)

Traceback (most recent call last):
File “C:\Python34\lib\urllib\request.py”, line 1174, in do_open
h.request(req.get_method(), req.selector, req.data, headers)
File “C:\Python34\lib\http\client.py”, line 1090, in request
self._send_request(method, url, body, headers)
File “C:\Python34\lib\http\client.py”, line 1128, in _send_request
self.endheaders(body)
File “C:\Python34\lib\http\client.py”, line 1086, in endheaders
self._send_output(message_body)
File “C:\Python34\lib\http\client.py”, line 924, in _send_output
self.send(msg)
File “C:\Python34\lib\http\client.py”, line 859, in send
self.connect()
File “C:\Python34\lib\http\client.py”, line 836, in connect
self.timeout, self.source_address)
File “C:\Python34\lib\socket.py”, line 509, in create_connection
raise err
File “C:\Python34\lib\socket.py”, line 500, in create_connection
sock.connect(sa)
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “Z:\python-client\test\functional\android\touch_action_tests.py”, line 31, in setUp
driver = webdriver.Remote(‘http://localhost:4723/wd/hub’, capabilities)
File “C:\Python34\lib\site-packages\appium\webdriver\webdriver.py”, line 35, in init
super(WebDriver, self).init(command_executor, desired_capabilities, browser_profile, proxy, keep_alive)
File “C:\Python34\lib\site-packages\selenium\webdriver\remote\webdriver.py”, line 73, in init
self.start_session(desired_capabilities, browser_profile)
File “C:\Python34\lib\site-packages\selenium\webdriver\remote\webdriver.py”, line 121, in start_session
‘desiredCapabilities’: desired_capabilities,
File “C:\Python34\lib\site-packages\selenium\webdriver\remote\webdriver.py”, line 171, in execute
response = self.command_executor.execute(driver_command, params)
File “C:\Python34\lib\site-packages\selenium\webdriver\remote\remote_connection.py”, line 349, in execute
return self._request(command_info[0], url, body=data)
File “C:\Python34\lib\site-packages\selenium\webdriver\remote\remote_connection.py”, line 417, in _request
resp = opener.open(request)
File “C:\Python34\lib\urllib\request.py”, line 455, in open
response = self._open(req, data)
File “C:\Python34\lib\urllib\request.py”, line 473, in _open
‘_open’, req)
File “C:\Python34\lib\urllib\request.py”, line 433, in _call_chain
result = func(*args)
File “C:\Python34\lib\urllib\request.py”, line 1202, in http_open
return self.do_open(http.client.HTTPConnection, req)
File “C:\Python34\lib\urllib\request.py”, line 1176, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [WinError 10061] No connection could be made because the target machine actively refused it>

What i’ve tried so far:

I am looking forward for you answer!

Thanks

it means cann’t connect to the remote peer, maybe your network problem, just like proxy setting.
Hope it work.

I’m facing the exact error, any progress…?