Slow execution on setText

I am trying to set the text in an android.widget.EditText which takes around 19-24 seconds. I wanted to check if anyone is facing this issue? I am using Katalon Studio

Version: 5.7.1

Build: 1

Other details -

{“desiredCapabilities”:{“app”:“C:\\Temp\\eCaf_vn9.7.46.5_Thor_Coip_AUTO_vc185.apk”,“appWaitActivity”:““,“autoGrantPermissions”:true,“deviceId”:“92012887d9277331”,“deviceName”:“samsung SM-J200G (Android 5.1.1)”,“fullReset”:false,“newCommandTimeout”:1800,“noReset”:true,“platform”:“ANDROID”,“platformName”:“Android”,“udid”:“92012887d9277331”},“capabilities”:{“desiredCapabilities”:{“app”:“C:\\Temp\\eCaf_vn9.7.46.5_Thor_Coip_AUTO_vc185.apk”,“appWaitActivity”:””,“autoGrantPermissions”:true,“deviceId”:“92012887d9277331”,“deviceName”:“samsung SM-J200G (Android 5.1.1)”,“fullReset”:false,“newCommandTimeout”:1800,“noReset”:true,“platform”:“ANDROID”,“platformName”:“Android”,“udid”:“92012887d9277331”},“firstMatch”:[{“platformName”:“android”}]}}[39m

[debug] [35m[MJSONWP][39m Calling AppiumDriver.createSession() with args: [{“app”:“C:\\Temp\\eCaf_vn9.7.46.5_Thor_Coip_AUTO_vc185.apk”,“appWaitActivity”:““,“autoGrantPermissions”:true,“deviceId”:“92012887d9277331”,“deviceName”:“samsung SM-J200G (Android 5.1.1)”,“fullReset”:false,“newCommandTimeout”:1800,“noReset”:true,“platform”:“ANDROID”,“platformName”:“Android”,“udid”:“92012887d9277331”},null,{“desiredCapabilities”:{“app”:“C:\\Temp\\eCaf_vn9.7.46.5_Thor_Coip_AUTO_vc185.apk”,“appWaitActivity”:””,“autoGrantPermissions”:true,“deviceId”:“92012887d9277331”,“deviceName”:“samsung SM-J200G (Android 5.1.1)”,“fullReset”:false,“newCommandTimeout”:1800,“noReset”:true,“platform”:“ANDROID”,“platformName”:“Android”,“udid”:“92012887d9277331”},“firstMatch”:[{“platformName”:“android”}]}]

[debug] [35m[BaseDriver][39m Event ‘newSessionRequested’ logged at 1537874604481 (16:53:24 GMT+0530 (India Standard Time))

[35m[Appium][39m Could not parse W3C capabilities: ‘deviceName’ can’t be blank. Falling back to JSONWP protocol.

[35m[Appium][39m The following capabilities were provided in the JSONWP desired capabilities that are missing in W3C capabilities: [“app”,“appWaitActivity”,“autoGrantPermissions”,“deviceId”,“deviceName”,“fullReset”,“newCommandTimeout”,“noReset”,“platform”,“platformName”,“udid”]. Falling back to JSONWP protocol.

[35m[Appium][39m Creating new AndroidDriver (v2.7.0) session

[35m[Appium][39m Capabilities:

[35m[Appium][39m app: C:\Temp\eCaf_vn9.7.46.5_Thor_Coip_AUTO_vc185.apk

[35m[Appium][39m appWaitActivity: *

[35m[Appium][39m autoGrantPermissions: true

[35m[Appium][39m deviceId: 92012887d9277331

[35m[Appium][39m deviceName: samsung SM-J200G (Android 5.1.1)

[35m[Appium][39m fullReset: false

[35m[Appium][39m newCommandTimeout: 1800

[35m[Appium][39m noReset: true

[35m[Appium][39m platform: ANDROID

[35m[Appium][39m platformName: Android

[35m[Appium][39m udid: 92012887d9277331

[debug] [35m[BaseDriver][39m Creating session with MJSONWP desired capabilities: {“app”:"C:\\Temp\\eCaf_vn9…

[35m[BaseDriver][39m The following capabilities were provided, but are not recognized by appium: deviceId, platform.

[35m[BaseDriver][39m Session created with session id: 47656516-bda5-4387-aec8-021683461f7f

[debug] [35m[AndroidDriver][39m Getting Java version

[35m[AndroidDriver][39m Java version is: 1.8.0_102

Hi Ashish,

Alternatively to setText, you can try Katalon’s sendKeys function:

Using Katalon’s sendKeys function:

Add this import to your test file:

import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile 

Then send the keys to the textField Test Object:

Mobile.sendKeys(textField, "My Value"); 

Using Appium’s sendKeys function:

If that doesn’t work, you can try using Appium’s sendKeys function directly:

Add these import statements to the top of your test file:

import io.appium.java_client.android.AndroidDriver
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.mobile.keyword.internal.MobileDriverFactory

Then tap the textField Test Object to open the keyboard and send the keys using Android’s keyboard:

int timeout = 5 // timeout in secondsMobile.tap(textField, timeout)
AndroidDriver<?> driver = (AndroidDriver<?>) MobileDriverFactory.getDriver()
driver.getKeyboard().sendKeys("My Value")

Using a wrapper function from katalon-mobile-util library:

Finally, if that’s a lot to type each time you want to set the text on a field, you can try using this open source library, which has some convenience functions for handling Text Fields:

https://github.com/detroit-labs/katalon-mobile-util#textfield

You can access a built version of the library here:

https://github.com/detroit-labs/katalon-mobile-util#installation

For info on how to add a third party library to you Katalon test project, see the docs:

https://www.katalon.com/resources-center/tutorials/import-java-library/

Hope this helps,

Chris

1 Like

Thanks Chris. Send keys did show improvement. it takes around 5 vs 20-24 seconds.

I wanted to check with you if you have used Katalon to run tests on real devices on cloud - saucelabs as an example. I am able to install the application but the subsequent commands fails (waitforelementPresent) in the below code.

driver = new AndroidDriver<>(new URL(‘https://aforashish:adbe7f65-5e2b-4bcb-b8fc-eb2ca7db5665@ondemand.saucelabs.com:443/wd/hub’), capabilities);

driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

//Mobile.startApplication(‘sauce-storage:https://app.testobject.com/#/aforashish/ZEE5.apk’, false)

Mobile.waitForElementPresent(findTestObject(‘Zee/Home Screen/Login - SKIP’), 10)

Hi Ashish,

I haven’t done anything using cloud devices yet, just local simulators and devices. Does the same failure you’re seeing happen on simulators or real devices connected to your computer? Could you share the error log of what you’re seeing?

- Chris