简体   繁体   中英

Clear text before edit in Kotlin

I want to clear a field text before tap a text inside. I'm trying to do an Android Test using Kotlin.

The code:

suspend fun navegarMenu(){
        clickSafe(R.id.nav_menu)
        waitElementAndClick(R.id.tvProfile)
        delay(4000)

// I WANT TO CLEAR THE TEXT INSIDE "et.NickName" FIELD BEFORE EDIT THE TEXT
        fillEditText(R.id.etNickName, "digdindigdin")

        delay(2000)
        clickSafe(R.id.btnAlterNickName)
        delay(10000)
    }

Im this case, I need to clear the field before put "digdindigdin" inside the field. I'm using Espresso JUnit on Android Studio.

onView(withIdR.id.etNickName()).perform(clearText());

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM