Open YhondriPM opened 1 year ago
Having the exact same issue.
It looks like /wd/hub is no longer a thing since Appium 2.0
The solution is to change the references to http://localhost:4723/wd/hub
to simply http://localhost:4723/
It seems like there is a lot in this example that is out of date. For example, the --command-timeout parameter passed into appium is obsolete now and causes an error as well.
Description
Hi :D, the tests fails when running the script ./run-tests_android.sh I've had also tried running Appium adding the path as follow:
appium --use-plugins=altunity --base-path /wd/hub
I'm having the same problem with a new project I've created following the documentation and the examples on this project.
Here is the log.
` /opt/homebrew/lib/python3.11/site-packages/urllib3/connection.py:200:
/opt/homebrew/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection raise err
address = ('localhost', 4723), timeout = None, source_address = None, socket_options = [(6, 1, 1)]
/opt/homebrew/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError
The above exception was the direct cause of the following exception:
self = <urllib3.connectionpool.HTTPConnectionPool object at 0x1036cc1d0>, method = 'POST', url = '/wd/hub/session' body = '{"capabilities": {"firstMatch": [{}], "alwaysMatch": {"platformName": "android", "appium:deviceName": "Local Device",...s_apk/EXAMPLES-Python-Android-with-Appium-AltTrashCat-master/TrashCat.apk", "appium:automationName": "uiautomator2"}}}' headers = HTTPHeaderDict({'Accept': 'application/json', 'Content-Type': 'application/json;charset=UTF-8', 'User-Agent': 'appium/...lenium/4.10.0 (python mac))', 'Connection': 'keep-alive', 'X-Idempotency-Key': '60cf3bb5-d106-478d-96be-c8f5e8b5d05e'}) retries = Retry(total=0, connect=None, read=None, redirect=None, status=None), redirect = False, assert_same_host = False, timeout = <_TYPE_DEFAULT.token: -1> pool_timeout = None, release_conn = True, chunked = False, body_pos = None, preload_content = True, decode_content = True, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/wd/hub/session', query=None, fragment=None), destination_scheme = None, conn = None release_this_conn = True, http_tunnel_required = False, err = None, clean_exit = False
/opt/homebrew/lib/python3.11/site-packages/urllib3/connectionpool.py:790:
/opt/homebrew/lib/python3.11/site-packages/urllib3/connectionpool.py:496: in _make_request conn.request( /opt/homebrew/lib/python3.11/site-packages/urllib3/connection.py:388: in request self.endheaders() /opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py:1281: in endheaders self._send_output(message_body, encode_chunked=encode_chunked) /opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py:1041: in _send_output self.send(msg) /opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py:979: in send self.connect() /opt/homebrew/lib/python3.11/site-packages/urllib3/connection.py:236: in connect self.sock = self._new_conn()
self = <urllib3.connection.HTTPConnection object at 0x1036cead0>
/opt/homebrew/lib/python3.11/site-packages/urllib3/connection.py:215: NewConnectionError
The above exception was the direct cause of the following exception:
cls = <class 'tests.start_page_test.TestStartPage'>
tests/base_test.py:27:
/opt/homebrew/lib/python3.11/site-packages/appium/webdriver/webdriver.py:257: in init super().init( /opt/homebrew/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py:206: in init self.start_session(capabilities) /opt/homebrew/lib/python3.11/site-packages/appium/webdriver/webdriver.py:346: in start_session response = self.execute(RemoteCommand.NEW_SESSION, w3c_caps) /opt/homebrew/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py:344: in execute response = self.command_executor.execute(driver_command, params) /opt/homebrew/lib/python3.11/site-packages/selenium/webdriver/remote/remote_connection.py:290: in execute return self._request(command_info[0], url, body=data) /opt/homebrew/lib/python3.11/site-packages/selenium/webdriver/remote/remote_connection.py:311: in _request response = self._conn.request(method, url, body=body, headers=headers) /opt/homebrew/lib/python3.11/site-packages/urllib3/_request_methods.py:118: in request return self.request_encode_body( /opt/homebrew/lib/python3.11/site-packages/urllib3/_request_methods.py:217: in request_encode_body return self.urlopen(method, url, extra_kw) /opt/homebrew/lib/python3.11/site-packages/urllib3/poolmanager.py:443: in urlopen response = conn.urlopen(method, u.request_uri, kw) /opt/homebrew/lib/python3.11/site-packages/urllib3/connectionpool.py:874: in urlopen return self.urlopen( /opt/homebrew/lib/python3.11/site-packages/urllib3/connectionpool.py:874: in urlopen return self.urlopen( /opt/homebrew/lib/python3.11/site-packages/urllib3/connectionpool.py:874: in urlopen return self.urlopen( /opt/homebrew/lib/python3.11/site-packages/urllib3/connectionpool.py:844: in urlopen retries = retries.increment(
self = Retry(total=0, connect=None, read=None, redirect=None, status=None), method = 'POST', url = '/wd/hub/session', response = None error = NewConnectionError('<urllib3.connection.HTTPConnection object at 0x1036cead0>: Failed to establish a new connection: [Errno 61] Connection refused') _pool = <urllib3.connectionpool.HTTPConnectionPool object at 0x1036cc1d0>, _stacktrace = <traceback object at 0x1036cea80>
/opt/homebrew/lib/python3.11/site-packages/urllib3/util/retry.py:515: MaxRetryError --------------------------------------------------------------------- Captured log setup --------------------------------------------------------------------- WARNING urllib3.connectionpool:connectionpool.py:871 Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x1036cc790>: Failed to establish a new connection: [Errno 61] Connection refused')': /wd/hub/session WARNING urllib3.connectionpool:connectionpool.py:871 Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x1036cd3d0>: Failed to establish a new connection: [Errno 61] Connection refused')': /wd/hub/session WARNING urllib3.connectionpool:connectionpool.py:871 Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x1036cdc50>: Failed to establish a new connection: [Errno 61] Connection refused')': /wd/hub/session __ ERROR at setup of TestStartPage.test_start_page_loaded_correctly __
self = <urllib3.connection.HTTPConnection object at 0x1036cead0>
/opt/homebrew/lib/python3.11/site-packages/urllib3/connection.py:200:
/opt/homebrew/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection raise err
address = ('localhost', 4723), timeout = None, source_address = None, socket_options = [(6, 1, 1)]
/opt/homebrew/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError
The above exception was the direct cause of the following exception:
self = <urllib3.connectionpool.HTTPConnectionPool object at 0x1036cc1d0>, method = 'POST', url = '/wd/hub/session' body = '{"capabilities": {"firstMatch": [{}], "alwaysMatch": {"platformName": "android", "appium:deviceName": "Local Device",...s_apk/EXAMPLES-Python-Android-with-Appium-AltTrashCat-master/TrashCat.apk", "appium:automationName": "uiautomator2"}}}' headers = HTTPHeaderDict({'Accept': 'application/json', 'Content-Type': 'application/json;charset=UTF-8', 'User-Agent': 'appium/...lenium/4.10.0 (python mac))', 'Connection': 'keep-alive', 'X-Idempotency-Key': '60cf3bb5-d106-478d-96be-c8f5e8b5d05e'}) retries = Retry(total=0, connect=None, read=None, redirect=None, status=None), redirect = False, assert_same_host = False, timeout = <_TYPE_DEFAULT.token: -1> pool_timeout = None, release_conn = True, chunked = False, body_pos = None, preload_content = True, decode_content = True, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/wd/hub/session', query=None, fragment=None), destination_scheme = None, conn = None release_this_conn = True, http_tunnel_required = False, err = None, clean_exit = False
/opt/homebrew/lib/python3.11/site-packages/urllib3/connectionpool.py:790:
/opt/homebrew/lib/python3.11/site-packages/urllib3/connectionpool.py:496: in _make_request conn.request( /opt/homebrew/lib/python3.11/site-packages/urllib3/connection.py:388: in request self.endheaders() /opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py:1281: in endheaders self._send_output(message_body, encode_chunked=encode_chunked) /opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py:1041: in _send_output self.send(msg) /opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py:979: in send self.connect() /opt/homebrew/lib/python3.11/site-packages/urllib3/connection.py:236: in connect self.sock = self._new_conn()
self = <urllib3.connection.HTTPConnection object at 0x1036cead0>
/opt/homebrew/lib/python3.11/site-packages/urllib3/connection.py:215: NewConnectionError
The above exception was the direct cause of the following exception:
cls = <class 'tests.start_page_test.TestStartPage'>
tests/base_test.py:27:
/opt/homebrew/lib/python3.11/site-packages/appium/webdriver/webdriver.py:257: in init super().init( /opt/homebrew/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py:206: in init self.start_session(capabilities) /opt/homebrew/lib/python3.11/site-packages/appium/webdriver/webdriver.py:346: in start_session response = self.execute(RemoteCommand.NEW_SESSION, w3c_caps) /opt/homebrew/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py:344: in execute response = self.command_executor.execute(driver_command, params) /opt/homebrew/lib/python3.11/site-packages/selenium/webdriver/remote/remote_connection.py:290: in execute return self._request(command_info[0], url, body=data) /opt/homebrew/lib/python3.11/site-packages/selenium/webdriver/remote/remote_connection.py:311: in _request response = self._conn.request(method, url, body=body, headers=headers) /opt/homebrew/lib/python3.11/site-packages/urllib3/_request_methods.py:118: in request return self.request_encode_body( /opt/homebrew/lib/python3.11/site-packages/urllib3/_request_methods.py:217: in request_encode_body return self.urlopen(method, url, extra_kw) /opt/homebrew/lib/python3.11/site-packages/urllib3/poolmanager.py:443: in urlopen response = conn.urlopen(method, u.request_uri, kw) /opt/homebrew/lib/python3.11/site-packages/urllib3/connectionpool.py:874: in urlopen return self.urlopen( /opt/homebrew/lib/python3.11/site-packages/urllib3/connectionpool.py:874: in urlopen return self.urlopen( /opt/homebrew/lib/python3.11/site-packages/urllib3/connectionpool.py:874: in urlopen return self.urlopen( /opt/homebrew/lib/python3.11/site-packages/urllib3/connectionpool.py:844: in urlopen retries = retries.increment(
self = Retry(total=0, connect=None, read=None, redirect=None, status=None), method = 'POST', url = '/wd/hub/session', response = None error = NewConnectionError('<urllib3.connection.HTTPConnection object at 0x1036cead0>: Failed to establish a new connection: [Errno 61] Connection refused') _pool = <urllib3.connectionpool.HTTPConnectionPool object at 0x1036cc1d0>, _stacktrace = <traceback object at 0x1036cea80>
/opt/homebrew/lib/python3.11/site-packages/urllib3/util/retry.py:515: MaxRetryError ====================================================================== warnings summary ====================================================================== tests/game_play_test.py::TestGamePlay::test_avoiding_obstacles tests/main_page_test.py::TestMainPage::test_main_menu_page_loaded_correctly tests/start_page_test.py::TestStartPage::test_start_button_loads_main_menu /opt/homebrew/lib/python3.11/site-packages/appium/webdriver/webdriver.py:245: DeprecationWarning: desired_capabilities argument is deprecated and will be removed in future versions. Use options instead. warnings.warn(
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ================================================================== short test summary info =================================================================== ERROR tests/game_play_test.py::TestGamePlay::test_avoiding_obstacles - urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=4723): Max retries exceeded with url: /wd/hub/session (Caused by NewConnectio... ERROR tests/game_play_test.py::TestGamePlay::test_game_can_be_paused_and_resumed - urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=4723): Max retries exceeded with url: /wd/hub/session (Caused by NewConnectio... ERROR tests/game_play_test.py::TestGamePlay::test_game_can_be_paused_and_stopped - urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=4723): Max retries exceeded with url: /wd/hub/session (Caused by NewConnectio... ERROR tests/game_play_test.py::TestGamePlay::test_game_play_page_displayed_correctly - urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=4723): Max retries exceeded with url: /wd/hub/session (Caused by NewConnectio... ERROR tests/game_play_test.py::TestGamePlay::test_player_dies_when_obstacles_not_avoided - urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=4723): Max retries exceeded with url: /wd/hub/session (Caused by NewConnectio... ERROR tests/main_page_test.py::TestMainPage::test_main_menu_page_loaded_correctly - urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=4723): Max retries exceeded with url: /wd/hub/session (Caused by NewConnectio... ERROR tests/start_page_test.py::TestStartPage::test_start_button_loads_main_menu - urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=4723): Max retries exceeded with url: /wd/hub/session (Caused by NewConnectio... ERROR tests/start_page_test.py::TestStartPage::test_start_page_loaded_correctly - urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=4723): Max retries exceeded with url: /wd/hub/session (Caused by NewConnectio... =============================================================== 3 warnings, 8 errors in 0.70s ================================================================ Tests done `