I followed all the documentation to set up appium, JDK and Android Studio.
I’m using Windows 10.
I’m using VSCode to write my tests:
const {remote} = require('webdriverio');
const capabilities = {
platformName: 'Android',
'appium:automationName': 'UiAutomator2',
'appium:deviceName': 'Android',
'appium:appPackage': 'com.android.settings',
'appium:appActivity': '.Settings',
};
const wdOpts = {
hostname: process.env.APPIUM_HOST || 'localhost',
port: parseInt(process.env.APPIUM_PORT, 10) || 4723,
logLevel: 'info',
capabilities,
};
async function runTest() {
const driver = await remote(wdOpts);
try {
const batteryItem = await driver.$('//*[@text="Battery"]');
await batteryItem.click();
} finally {
await driver.pause(1000);
await driver.deleteSession();
}
}
runTest();
I execute the command appium
in the cmd to start the server (running as admin).
The messages keep appearing repeatedly.
Then, I execute node test.js
in another cmd window from within the folder, and it just shows the test sourcecode. When I stop the server, I get this error:
Can someone help me solve this?