EditText UI component cannot set with given Text on Android Application

Hi,

The application which is develop to test with Appium has XML file like given below.

<?xml version="1.0" encoding="utf-8"?>

<android.support.constraint.ConstraintLayout
xmlns:android=“http://schemas.android.com/apk/res/android
xmlns:app=“http://schemas.android.com/apk/res-auto
xmlns:tools=“http://schemas.android.com/tools
android:layout_width=“match_parent”
android:layout_height=“match_parent”
tools:context=“.MainActivity”>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/username_EditText_LoginActivity"
        android:contentDescription="USERNAME"
        android:hint="username"/>

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/password_EditText_LoginActivity"
        android:hint="password"/>

    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Login"
        android:id="@+id/loginButton_LoginActivity"
        android:contentDescription="LOGIN" />


</LinearLayout>

</android.support.constraint.ConstraintLayout>

I want to set a input value into USERNAME EditText, however when I run the test script that is given below, the edittext could not be set with test input value.

// javascript
const wdio = require(“webdriverio”);
// javascript
const opts = {
port: 4723,
desiredCapabilities: {
platformName: “Android”,
platformVersion: “5.0.2”,
deviceName: “LENOVO Lenovo K920”,
app: “/Users/bar/SampleLogin/app/build/outputs/apk/debug/app-debug.apk”,
//appPackage : “”,
//browserName: “Chrome”,
automationName: “UiAutomator2”
}
};

const client = wdio.remote(opts);
// javascript
//client.init();

client.
init().
setValue(“~USERNAME”,“FOO AND BAR”).
click(“~LOGIN”);

If I remove setValue(“~USERNAME”,“FOO AND BAR”) code, then application is open and LOGIN button is clicked perfectly. The question is that how can I set any value into EditText via test script?

Best Regards,

When I did search about my question, I found some informations which fit the question.
According to them, I did create a repository and tried to explain them with a toy example.

I hope it help to someone who is beginner for Appium like me.

repo : https://github.com/sercanparker/AppiumSampleLogin