The problem
The problem i'm facing here is im getting the following error [**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 0x7fd691cf0af0>: Failed to establish a new connection: [Errno 111] Connection refused'))**] while connecting appium python code to android emulater device
Briefly describe the issue you are experiencing (or the feature you want to see added to Appium). Tell us what you were trying to do and what happened instead. Remember, this is not a place to ask questions. For that, go to http://discuss.appium.io!
Environment
- windows 11 OS
- Pycharm Professional IDE
- Emulator version Android 11
- Appium latest app from offical site
Link to Appium Logs
Connected to pydev debugger (build 223.8617.48)
Traceback (most recent call last):
File "/home/mohanraj/.cache/pypoetry/virtualenvs/mis-automation-L9yvBObc-py3.9/lib/python3.9/site-packages/urllib3/connection.py", line 174, in _new_conn
conn = connection.create_connection(
File "/home/mohanraj/.cache/pypoetry/virtualenvs/mis-automation-L9yvBObc-py3.9/lib/python3.9/site-packages/urllib3/util/connection.py", line 95, in create_connection
raise err
File "/home/mohanraj/.cache/pypoetry/virtualenvs/mis-automation-L9yvBObc-py3.9/lib/python3.9/site-packages/urllib3/util/connection.py", line 85, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/mohanraj/.cache/pypoetry/virtualenvs/mis-automation-L9yvBObc-py3.9/lib/python3.9/site-packages/urllib3/connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "/home/mohanraj/.cache/pypoetry/virtualenvs/mis-automation-L9yvBObc-py3.9/lib/python3.9/site-packages/urllib3/connectionpool.py", line 398, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/home/mohanraj/.cache/pypoetry/virtualenvs/mis-automation-L9yvBObc-py3.9/lib/python3.9/site-packages/urllib3/connection.py", line 239, in request
super(HTTPConnection, self).request(method, url, body=body, headers=headers)
File "/home/mohanraj/.pyenv/versions/3.9.16/lib/python3.9/http/client.py", line 1285, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/home/mohanraj/.pyenv/versions/3.9.16/lib/python3.9/http/client.py", line 1331, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/home/mohanraj/.pyenv/versions/3.9.16/lib/python3.9/http/client.py", line 1280, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/home/mohanraj/.pyenv/versions/3.9.16/lib/python3.9/http/client.py", line 1040, in _send_output
self.send(msg)
File "/home/mohanraj/.pyenv/versions/3.9.16/lib/python3.9/http/client.py", line 980, in send
self.connect()
File "/home/mohanraj/.cache/pypoetry/virtualenvs/mis-automation-L9yvBObc-py3.9/lib/python3.9/site-packages/urllib3/connection.py", line 205, in connect
conn = self._new_conn()
File "/home/mohanraj/.cache/pypoetry/virtualenvs/mis-automation-L9yvBObc-py3.9/lib/python3.9/site-packages/urllib3/connection.py", line 186, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7fd691cf0af0>: Failed to establish a new connection: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/mohanraj/.cache/pypoetry/virtualenvs/mis-automation-L9yvBObc-py3.9/lib/python3.9/site-packages/urllib3/connectionpool.py", line 787, in urlopen
retries = retries.increment(
File "/home/mohanraj/.cache/pypoetry/virtualenvs/mis-automation-L9yvBObc-py3.9/lib/python3.9/site-packages/urllib3/util/retry.py", line 592, 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 0x7fd691cf0af0>: Failed to establish a new connection: [Errno 111] Connection refused'))
python-BaseException
Process finished with exit code 1
Code To reproduce issue
`from time import sleep
from appium import webdriver
from appium.webdriver.common.appiumby import AppiumBy
desired_caps = {
"deviceName": "Pixel 4a API 30",
"platformName": "Android",
"udid": "emulator-5554",
"version": 11,
"app": "C:\Users\lenovo\Downloads\com.indigo.new.apk"
}
driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)`
The problem
The problem i'm facing here is im getting the following error [
**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 0x7fd691cf0af0>: Failed to establish a new connection: [Errno 111] Connection refused'))**] while connecting appium python code to android emulater deviceBriefly describe the issue you are experiencing (or the feature you want to see added to Appium). Tell us what you were trying to do and what happened instead. Remember, this is not a place to ask questions. For that, go to http://discuss.appium.io!
Environment
Link to Appium Logs
Code To reproduce issue
`from time import sleep
from appium import webdriver
from appium.webdriver.common.appiumby import AppiumBy
desired_caps = {
"deviceName": "Pixel 4a API 30",
"platformName": "Android",
"udid": "emulator-5554",
"version": 11,
"app": "C:\Users\lenovo\Downloads\com.indigo.new.apk"
}
driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)`