I'm trying to connect my virtual Android Device via Appium to my Webdriverio script to automate some testing.
I have the capabilities set as this:
capabilities: [{
// The defaults you need to have in your config
platformName: 'Android',
browserName: 'chrome',
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:automationName': 'uiautomator2',
'appium:platformVersion': '12.0',
'appium:deviceName': 'emulator-5554',
'appium:noReset': 'true'
}],
And I have the chromedriver and Appium services running:
services: ['appium', 'chromedriver']
But when I try to run my script I keep getting this error:
ERROR webdriver: Request failed with status 500 due to session not created: session not created: No matching capabilities found
I've tried to change up the capabilities. Changing the device name to match another running device. I've also tried to remove the appium prefix and just write the capability name, however that leads to even further errors.
Any help would be appreciated.
CodePudding user response:
Hi I think you are missing on one of the capabilities, below is the capability that is used from appium desktop and it did work for me, that was 'chromedriverExecutableDir' that takes the absolute path for the chrome driver executable folder. also make sure you check the chrome version in the simulator and use it accordingly.
"platformName": "Android",
"platformVersion": "11",
"automationName": "UiAutomator2",
"deviceName": "Pixel5",
"browserName": "chrome",
"chromedriverExecutableDir": "C:\\absolute\\path\\to\\chromedriver"
Appium document screenshot and reference link for the same is as below This is how to check the chrome driver version in the simulator
Refer to the below screen for testing your capabilities from the appium desktop application.
CodePudding user response:
If you are using a app installed in the mobile device for testing, use appium:appPackage and appium:appActivity property also. Below is a example for opening the wdio.demo app.
capabilities: [{
"platformName": "Android",
"appium:udid": "emulator-5554",
"appium:automationName": "UiAutomator2",
"appium:appPackage": "io.appium.android.apis",
"appium:appActivity": ".ApiDemos",
"appium:platformVersion": "11"
}]
Also, you might need the following details in wdio.conf.js file,
services: [
['appium', {
args: {
address: 'localhost',
port: 4723
},
logPath:'./',
}]
],