Reputation: 1075
I'm trying to get started with appium and successfully connected myself with my device using Appium Server and Appium Inspector (I had to change remote path to /wd/hub). Now, I'm trying to do the same using WebdriverIO using https://github.com/webdriverio/appium-boilerplate
At first I start the appium server:
Now I cloned Appium Boilerplate from https://github.com/webdriverio/appium-boilerplate and ran npm install
. Then I changed the path in config/wdio.android.app.conf.ts
to '/wd/hub':
import { join } from 'path';
import config from './wdio.shared.local.appium.conf';
// ============
// Specs
// ============
config.specs = [
'./tests/specs/**/app*.spec.ts',
];
// ============
// Capabilities
// ============
// For all capabilities please check
// http://appium.io/docs/en/writing-running-appium/caps/#general-capabilities
config.capabilities = [
{
// The defaults you need to have in your config
platformName: 'Android',
maxInstances: 1,
// For W3C the appium capabilities need to have an extension prefix
// http://appium.io/docs/en/writing-running-appium/caps/
// This is `appium:` for all Appium Capabilities which can be found here
'appium:deviceName': 'Pixel_3_10.0',
'appium:platformVersion': '10.0',
'appium:orientation': 'PORTRAIT',
'appium:automationName': 'UiAutomator2',
// The path to the app
'appium:app': join(process.cwd(), './apps/Android-NativeDemoApp-0.4.0.apk'),
// @ts-ignore
'appium:appWaitActivity': 'com.wdiodemoapp.MainActivity',
// Read the reset strategies very well, they differ per platform, see
// http://appium.io/docs/en/writing-running-appium/other/reset-strategies/
'appium:noReset': true,
'appium:newCommandTimeout': 240,
},
];
config.path = '/wd/hub';
console.log(config);
exports.config = config;
Now I call npm run android.app
, and the console.log command shows me:
{
runner: 'local',
specs: [ './tests/specs/**/app*.spec.ts' ],
capabilities: [
{
platformName: 'Android',
maxInstances: 1,
'appium:deviceName': 'Pixel_3_10.0',
'appium:platformVersion': '10.0',
'appium:orientation': 'PORTRAIT',
'appium:automationName': 'UiAutomator2',
'appium:app': '<<removed initially ;-)>>',
'appium:appWaitActivity': 'com.wdiodemoapp.MainActivity',
'appium:noReset': true,
'appium:newCommandTimeout': 240
}
],
logLevel: 'silent',
bail: 0,
baseUrl: 'http://the-internet.herokuapp.com',
waitforTimeout: 45000,
connectionRetryTimeout: 120000,
connectionRetryCount: 3,
services: [ [ 'appium', [Object] ] ],
framework: 'mocha',
reporters: [ 'spec' ],
mochaOpts: { ui: 'bdd', timeout: 180000 },
port: 4723,
path: '/wd/hub'
}
... which seems ok for me, but the Appium server shows:
[HTTP] Waiting until the server is closed
[HTTP] Received server close event
[Appium] Welcome to Appium v1.22.0
[Appium] Non-default server args:
[Appium] address: 127.0.0.1
[Appium] sessionOverride: true
[Appium] relaxedSecurityEnabled: true
[Appium] allowInsecure: {
[Appium] }
[Appium] denyInsecure: {
[Appium] }
[Appium] Appium REST http interface listener started on 127.0.0.1:4723
[HTTP] --> POST /session
[HTTP] {"capabilities":{"alwaysMatch":{"platformName":"Android","appium:deviceName":"Pixel_3_10.0","appium:platformVersion":"10.0","appium:orientation":"PORTRAIT","appium:automationName":"UiAutomator2","appium:app":"<<removed ;-)>>","appium:appWaitActivity":"com.wdiodemoapp.MainActivity","appium:noReset":true,"appium:newCommandTimeout":240},"firstMatch":[{}]},"desiredCapabilities":{"platformName":"Android","appium:deviceName":"Pixel_3_10.0","appium:platformVersion":"10.0","appium:orientation":"PORTRAIT","appium:automationName":"UiAutomator2","appium:app":"<<removed ;-)>>","appium:appWaitActivity":"com.wdiodemoapp.MainActivity","appium:noReset":true,"appium:newCommandTimeout":240}}
[HTTP] No route found for /session
[HTTP] <-- POST /session 404 8 ms - 211
[HTTP]
[HTTP] --> POST /session
[HTTP] {"capabilities":{"alwaysMatch":{"platformName":"Android","appium:deviceName":"Pixel_3_10.0","appium:platformVersion":"10.0","appium:orientation":"PORTRAIT","appium:automationName":"UiAutomator2","appium:app":"<<removed ;-)>>","appium:appWaitActivity":"com.wdiodemoapp.MainActivity","appium:noReset":true,"appium:newCommandTimeout":240},"firstMatch":[{}]},"desiredCapabilities":{"platformName":"Android","appium:deviceName":"Pixel_3_10.0","appium:platformVersion":"10.0","appium:orientation":"PORTRAIT","appium:automationName":"UiAutomator2","appium:app":"<<removed ;-)>>","appium:appWaitActivity":"com.wdiodemoapp.MainActivity","appium:noReset":true,"appium:newCommandTimeout":240}}
It looks like WebdriverIO doesn't recognize the config.path-setting. I was already checking out Testing Mobile App with Appium & WebdriverIO: "No route found for /session" but the solution was changing the config.path value (which I did) but I've no idea why it's no recognized... Is anyone having any idea?
Upvotes: 2
Views: 2062
Reputation: 396
i just stepped over the same issue and it looks like it works when you set it under the capabilites:
capabilities: [{
"path": "/wd/hub",
...
Upvotes: 4