Can't run my first test

Hello.
Every time that i try to run my first Mobile test an error happens:

[0-0] 2021-04-22T11:05:11.080Z ERROR webdriver: Request failed with status 404 due to unknown command: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource
[0-0] 2021-04-22T11:05:11.080Z ERROR webdriver: unknown command: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource
at Object.getErrorFromResponseBody (/home/tiago/appium_tests/node_modules/webdriver/build/utils.js:189:12)
at WebDriverRequest._request (/home/tiago/appium_tests/node_modules/webdriver/build/request.js:168:31)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Object.startWebDriverSession (/home/tiago/appium_tests/node_modules/webdriver/build/utils.js:63:20)
at async Function.newSession (/home/tiago/appium_tests/node_modules/webdriver/build/index.js:58:45)
at async Object.remote (/home/tiago/appium_tests/node_modules/webdriverio/build/index.js:67:22)
at async Runner._startSession (/home/tiago/appium_tests/node_modules/@wdio/runner/build/index.js:216:56)
at async Runner._initSession (/home/tiago/appium_tests/node_modules/@wdio/runner/build/index.js:172:25)
at async Runner.run (/home/tiago/appium_tests/node_modules/@wdio/runner/build/index.js:87:19)
[0-0] 2021-04-22T11:05:11.081Z ERROR @wdio/runner: Error: Failed to create session.
The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource
at Object.startWebDriverSession (/home/tiago/appium_tests/node_modules/webdriver/build/utils.js:68:15)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Function.newSession (/home/tiago/appium_tests/node_modules/webdriver/build/index.js:58:45)
at async Object.remote (/home/tiago/appium_tests/node_modules/webdriverio/build/index.js:67:22)
at async Runner._startSession (/home/tiago/appium_tests/node_modules/@wdio/runner/build/index.js:216:56)
at async Runner._initSession (/home/tiago/appium_tests/node_modules/@wdio/runner/build/index.js:172:25)
at async Runner.run (/home/tiago/appium_tests/node_modules/@wdio/runner/build/index.js:87:19)
[0-0] FAILED in Android - /test/specs/sample.test.js

My wdio config is that:
exports.config = {
runner: ‘local’,
port: 4723,

specs: [
‘./test/specs/**/*.js’
],

maxInstances: 10,

capabilities: [{
platformName: ‘Android’,
‘appium:deviceName’: ‘pixel 3’,
‘appium:app’:’/home/StudioProjects/digital-therapist/MobileSword/build/outputs/apk/standard/debug/sword_000000001.apk’
}],
logLevel: ‘info’,
bail: 0,
baseUrl: ‘http://localhost’,
waitforTimeout: 10000,

connectionRetryTimeout: 120000,

connectionRetryCount: 3,

services: ['selenium-standalone'],

framework: ‘mocha’,
reporters: [‘spec’],
mochaOpts: {
ui: ‘bdd’,
timeout: 60000
},

1 Like

Try launching the app already installed. Is this a Physical Device?

no. i m using a device generated by android studio (virtual device).
I ran the test with the app open and the same error happens

add path: ‘/wd/hub/’ to wdio.conf.js

Where to add path can you please explain?

I believe that what he means is that you need to add it to the localhost. I don’t know it in javascript, but in Java the way we enter the URL is (“http://127.0.0.1:4723**/wd/hub**”) where 127.0.0.1 is, as we all know, the localhost, and 4723 is the port appium is using. I can’t find the port in your script either…

I would try BaseUrl: ‘http://localhost:4723’ or BaseUrl: ‘http://localhost:4723/wd/hub’ always making sure you use 4723 as the port in appium (or replace it by whichever port you prefer using)

1 Like

I already tried it but same error occurs

so how did you fix this?

Same error here. I can’t get the first appium getting started example to work.

I do have this in the options:
path: "/wd/hub",

This is the appium log:

❯ appium
[Appium] Welcome to Appium v2.0.0-beta.43 (REV c5731faf8be1ddc1eeae4b162b88bd76318fc279)
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[Appium] No drivers have been installed in /Users/klas.mellbourn/.appium. Use the “appium driver” command to install the one(s) you want to use.
[Appium] No plugins have been installed. Use the “appium plugin” command to install the one(s) you want to use.
[HTTP] → POST /wd/hub/session
[HTTP] {“capabilities”:{“alwaysMatch”:{“automationName”:“XCUITest”,“platformName”:“iOS”,“platformVersion”:“15.5”,“deviceName”:“iPhone 13”,“app”:“/Users/klas.mellbourn/Library/Developer/Xcode/DerivedData/AwesomeTSProject-eflasywsgbbkqdercbrvegpkcpyg/Build/Products/Debug-iphonesimulator/AwesomeTSProject.app”},“firstMatch”:[{}]},“desiredCapabilities”:{“automationName”:“XCUITest”,“platformName”:“iOS”,“platformVersion”:“15.5”,“deviceName”:“iPhone 13”,“app”:“/Users/klas.mellbourn/Library/Developer/Xcode/DerivedData/AwesomeTSProject-eflasywsgbbkqdercbrvegpkcpyg/Build/Products/Debug-iphonesimulator/AwesomeTSProject.app”}}
[debug] [HTTP] No route found for /wd/hub/session
[HTTP] ← POST /wd/hub/session 404 5 ms - 211

Maybe you missed this step:
https://appium.io/docs/en/about-appium/getting-started/#driver-specific-setup

thankyouuu, i’ve been looking for the answer for so long hahaha

Thank You so muck .After i add “wd/hub” after the port error got resolved