Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error initializing the driver: Message: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource #970

Closed
jt7777777 opened this issue Mar 5, 2024 · 1 comment

Comments

@jt7777777
Copy link

please help me i am getting error:
Initializing Appium driver with desired capabilities…
Error initializing the driver: Message: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource

HOOK-ERROR in before_all: WebDriverException: Message: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource
HOOK-ERROR in after_all: AttributeError: ‘Context’ object has no attribute ‘driver’

Myversions: Appium-Python-Client==2.10.0, selenium==4.1.0, Python 3.12.2, appium: 2.5.1, uiautomator2@3.0.1

Appium logs:

C:\Users\jakub>appium
[Appium] Welcome to Appium v2.5.1
[Appium] The autodetected Appium home path: C:\Users\jakub.appium
[Appium] Attempting to load driver uiautomator2...
[Appium] Requiring driver at C:\Users\jakub.appium\node_modules\appium-uiautomator2-driver\build\index.js
[Appium] AndroidUiautomator2Driver has been successfully loaded in 0.813s
[Appium] Appium REST http interface listener started on http://0.0.0.0:4723
[Appium] You can provide the following URLs in your client code to connect to this server:
[Appium] http://192.168.0.129:4723/
[Appium] http://127.0.0.1:4723/ (only accessible from the same host)
[Appium] Available drivers:
[Appium] - uiautomator2@3.0.1 (automationName 'UiAutomator2')
[Appium] No plugins have been installed. Use the "appium plugin" command to install the one(s) you want to use.
[HTTP] Request idempotency key: 27aabe7c-2ce6-4ba4-bf90-798ecb9cf24c
[HTTP] --> POST /wd/hub/session
[HTTP] {"capabilities":{"firstMatch":[{}],"alwaysMatch":{"platformName":"Android","appium:deviceName":"emulator-5554","appium:platformVersion":"VanillaIceCream","appium:app":"C:\Users\jakub\Downloads\Appium\AppiumProject\amaze-file-manager-3-10.apk","appium:automationName":"UiAutomator2"}}}
[HTTP] No route found for /wd/hub/session
[HTTP] <-- POST /wd/hub/session 404 12 ms - 211
[HTTP]
[HTTP] --> GET /wd/hub/status
[HTTP] {}
[HTTP] No route found for /wd/hub/status
[HTTP] <-- GET /wd/hub/status 404 11 ms - 211
[HTTP]
[HTTP] <-- GET /favicon.ico 200 1 ms - 1150
[HTTP]
[HTTP] Request idempotency key: a10acadc-3274-4c83-84dc-085b742f49bc
[HTTP] --> POST /wd/hub/session
[HTTP] {"capabilities":{"firstMatch":[{}],"alwaysMatch":{"platformName":"Android","appium:deviceName":"emulator-5554","appium:platformVersion":"VanillaIceCream","appium:app":"C:\Users\jakub\Downloads\Appium\AppiumProject\amaze-file-manager-3-10.apk","appium:automationName":"UiAutomator2"}}}
[HTTP] No route found for /wd/hub/session
[HTTP] <-- POST /wd/hub/session 404 2 ms - 211

Env code:

`from appium import webdriver
from behave import use_fixture

def before_all(context):
try:
desired_caps = {
'platformName': 'Android',
'deviceName': 'emulator-5554',
'platformVersion': 'VanillaIceCream',
'app': 'C:\Users\jakub\Downloads\Appium\AppiumProject\amaze-file-manager-3-10.apk',
'automationName': 'UiAutomator2'
}
print("Initializing Appium driver with desired capabilities...")
context.driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
print("Driver initialized:", context.driver)
except Exception as e:
print(f"Error initializing the driver: {e}")
raise

def after_all(context):
"""
Teardown that runs after all tests.
Here you might close the connection to the Appium server.
"""
context.driver.quit()

def before_feature(context, feature):
"""
This runs before each feature file is exercised.
"""
# Setup specific to a feature can be added here.

def after_feature(context, feature):
"""
This runs after each feature file is exercised.
"""
# Teardown specific to a feature can be added here.

def before_scenario(context, scenario):
"""
This runs before each scenario is run.
"""
# Setup specific to a scenario can be added here.

def after_scenario(context, scenario):
"""
This runs after each scenario is run.
"""
# Teardown specific to a scenario can be added here.
`

@eglitise
Copy link

eglitise commented Mar 5, 2024

Refer to the server log:

[Appium] You can provide the following URLs in your client code to connect to this server:
[Appium] http://192.168.0.129:4723/
[Appium] http://127.0.0.1:4723/ (only accessible from the same host)

You are trying to connect to http://127.0.0.1:4723/wd/hub, which does not match any of the URLs in your log. Change the URL for either your client or server.
Read the Appium 1->2 migration guide for more details.

@eglitise eglitise closed this as completed Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants