'There is a problem with Appium / WebdriverIO that the test does not start from WebdriverIO
There is a problem with Appium / WebdriverIO that the test does not start from WebdriverIO
They run flawlessly
adb.exe
o adb devices o List of devices attached o emulator-5554 device
appium inspector
Vysor
appium server
- [Appium] Welcome to Appium v1.22.3
- [Appium] Non-default server args:
- [Appium] address: 127.0.0.1
android studio
I have tried both emulated and real phones, I can't connect to any of them, it doesn't contact with them Following this page, https://appium.io/docs/en/about-appium/getting-started/ works with both devices. WDIO config (I only took out the important items)
exports.config = {
runner: "local",
port: 4723,
path: "/wd/hub",
specs: [
'./test/specs/**/*.js'
],
capabilities: [{
platformName: "Android",
"appium:platformVersion": "11",
"appium:deviceName": "SM-G715FN",
"appium:app": "C:\\\\Downloads\\ApiDemos-debug.apk",
"appium:appPackage": "com.wdiodemoapp",
"appium:appActivity": ".MainActivity",
"appium:automationName": "UiAutomator2"
}],
baseUrl: 'https://localhost',
framework: 'mocha',
reporters: ['spec'],
mochaOpts: {
ui: 'bdd',
require: ['@babel/register'], //////
timeout: 60000
},
services:
[
['appium',
{args:{
debugLogSpacing: true,
"base-path": "wd/hub"
},
command: 'appium',
},
],
],
package.json
{
"name": "webdriverio-tests",
"version": "0.1.0",
"private": true,
"devDependencies": {
"@babel/cli": "^7.17.10",
"@babel/core": "^7.17.12",
"@babel/preset-env": "^7.17.12",
"@babel/register": "^7.17.7",
"@wdio/appium-service": "^7.13.2",
"@wdio/cli": "^7.19.7",
"@wdio/local-runner": "^7.19.7",
"@wdio/mocha-framework": "^7.19.7",
"@wdio/spec-reporter": "^7.19.7",
"appium-uiautomator2-driver": "^2.1.2",
"appium-xcuitest-driver": "^4.4.2",
"eslint": "^8.15.0",
"eslint-plugin-wdio": "^7.19.4",
"ts-node": "^10.7.0",
"typescript": "^4.6.4"
},
"scripts": {
"wdio": "wdio run wdio.conf.js"
},
"dependencies": {
"@wdio/sync": "^7.19.7",
"appium": "^2.0.0-beta.35",
"wdio-image-comparison-service": "^3.1.1"
},
"description": "Appium tests using WebdriverIO",
"main": "wdio.conf.js",
"keywords": [
"webdriverio",
"appium"
],
"author": "",
"license": "ISC"
}
Test
describe('Sample', () => {
it('Connect', async () => {
const field = await client.$("android.widget.EditText");
await field.setValue("Hi Sir!");
await client.deleteSession();
});
Test failed: Request failed with status 404 due to The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource [POST] http://localhost:4723/session
I checked this "https://stackoverflow.com/questions/44828114/appium-webdriverio-setup",but it didn't help.enter code here
Solution 1:[1]
Try using this line
baseUrl: 'http://localhost',
instead of
baseUrl: 'https://localhost',
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | alkaia |
