question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to identify and typeText on the UIScreen elements using UITextEdit properties

See original GitHub issue

Hi there,

Below are the steps involved in my test

  1. Launch the app
  2. Locate and perform the action on the element in home screen (Native)
  3. The previous click actions navigates to the webview which is served by a different SDK
  4. This is a login screen which has username and password field

I was able to successfully identify the username and password fields using UIAutomator

 if(userNameTest.wait(Until.) && userName.isEnabled){
              uiDevice.wait(Until.findObject(By.res("com.android.chrome", "<ResourceID>")),DEFAULT_TIMEOUT)
               uiDevice.findObject(select.resourceId("IdentityLoginEmail")).setText("test2@test.abc.com")

But where as when I try to use the same identifiers in UIScreen implementation as below I am seeing errors as belo

class LoginScreen : UiScreen<LoginScreen>() {

    override val packageName: String = "com.android.chrome"

    val userName = UiEditText {
        withId("com.android.chrome","IdentityLoginEmail")
    }
}

Test

loginScreen {
                        flakySafely(DEFAULT_TIMEOUT) {
                            userName {
                            typeText("asnmshbdhdgfh")
                            }
                            password{
                                typeText("Password1234$")
                            }
                            loginButton{
                                isDisplayed()
                                isClickable()
                                click()
                            }
                        }
                    }

Error log:

com.kaspersky.components.kautomator.intercept.exception.UnfoundedUiObjectException: The UiObject2 was not found on the screen. The selector=BySelector [PKG='\Qcom.android.chrome\E', RES='\Qcom.android.chrome:id/IdentityLoginEmail\E'], index=0
	at com.kaspersky.components.kautomator.intercept.interaction.UiObjectInteraction.perform(UiObjectInteraction.kt:40)
	at com.kaspersky.kaspresso.interceptors.tolibrary.kautomator.KautomatorObjectInterceptor$interceptPerform$1.invoke(KautomatorObjectInterceptor.kt:49)
	at com.kaspersky.kaspresso.interceptors.tolibrary.kautomator.KautomatorObjectInterceptor$interceptPerform$1.invoke(KautomatorObjectInterceptor.kt:13)
	at com.kaspersky.kaspresso.autoscroll.ObjectAutoScrollProviderImpl.withAutoScroll(ObjectAutoScrollProviderImpl.kt:30)
	at com.kaspersky.kaspresso.interceptors.behaviorkautomator.impl.autoscroll.AutoScrollObjectBehaviorInterceptor.withAutoScroll(Unknown Source:12)
	at com.kaspersky.kaspresso.interceptors.behaviorkautomator.impl.autoscroll.AutoScrollObjectBehaviorInterceptor.interceptPerform(AutoScrollObjectBehaviorInterceptor.kt:44)
	at com.kaspersky.kaspresso.interceptors.behaviorkautomator.impl.autoscroll.AutoScrollObjectBehaviorInterceptor.interceptPerform(AutoScrollObjectBehaviorInterceptor.kt:16)
	at com.kaspersky.kaspresso.interceptors.tolibrary.kautomator.KautomatorObjectInterceptor$interceptPerform$$inlined$fold$lambda$1.invoke(KautomatorObjectInterceptor.kt:53)
	at com.kaspersky.kaspresso.interceptors.tolibrary.kautomator.KautomatorObjectInterceptor$interceptPerform$$inlined$fold$lambda$1.invoke(KautomatorObjectInterceptor.kt:13)
	at com.kaspersky.kaspresso.uiobjectloader.UiObjectLoaderProviderImpl.handleUiObjectAbsence(UiObjectLoaderProviderImpl.kt:32)
	at com.kaspersky.kaspresso.interceptors.behaviorkautomator.impl.loader.UiObjectLoaderBehaviorInterceptor.handleUiObjectAbsence(Unknown Source:12)
	at com.kaspersky.kaspresso.interceptors.behaviorkautomator.impl.loader.UiObjectLoaderBehaviorInterceptor.interceptPerform(UiObjectLoaderBehaviorInterceptor.kt:44)
	at com.kaspersky.kaspresso.interceptors.behaviorkautomator.impl.loader.UiObjectLoaderBehaviorInterceptor.interceptPerform(UiObjectLoaderBehaviorInterceptor.kt:15)
	at com.kaspersky.kaspresso.interceptors.tolibrary.kautomator.KautomatorObjectInterceptor$interceptPerform$$inlined$fold$lambda$1.invoke(KautomatorObjectInterceptor.kt:53)
	at com.kaspersky.kaspresso.interceptors.tolibrary.kautomator.KautomatorObjectInterceptor$interceptPerform$$inlined$fold$lambda$1.invoke(KautomatorObjectInterceptor.kt:13)
	at com.kaspersky.kaspresso.systemsafety.SystemDialogSafetyProviderImpl.passSystemDialogs(SystemDialogSafetyProviderImpl.kt:51)
	at com.kaspersky.kaspresso.interceptors.behaviorkautomator.impl.systemsafety.SystemDialogSafetyObjectBehaviorInterceptor.passSystemDialogs(Unknown Source:7)
	at com.kaspersky.kaspresso.interceptors.behaviorkautomator.impl.systemsafety.SystemDialogSafetyObjectBehaviorInterceptor.interceptPerform(SystemDialogSafetyObjectBehaviorInterceptor.kt:48)
	at com.kaspersky.kaspresso.interceptors.behaviorkautomator.impl.systemsafety.SystemDialogSafetyObjectBehaviorInterceptor.interceptPerform(SystemDialogSafetyObjectBehaviorInterceptor.kt:17)
	at com.kaspersky.kaspresso.interceptors.tolibrary.kautomator.KautomatorObjectInterceptor$interceptPerform$$inlined$fold$lambda$1.invoke(KautomatorObjectInterceptor.kt:53)
	at com.kaspersky.kaspresso.interceptors.tolibrary.kautomator.KautomatorObjectInterceptor$interceptPerform$$inlined$fold$lambda$1.invoke(KautomatorObjectInterceptor.kt:13)
	at com.kaspersky.kaspresso.interceptors.tolibrary.kautomator.KautomatorObjectInterceptor.interceptPerform(KautomatorObjectInterceptor.kt:55)
	at com.kaspersky.kaspresso.interceptors.tolibrary.LibraryInterceptorsInjector$injectKaspressoInKautomator$1$1$2.invoke(LibraryInterceptorsInjector.kt:87)
	at com.kaspersky.kaspresso.interceptors.tolibrary.LibraryInterceptorsInjector$injectKaspressoInKautomator$1$1$2.invoke(LibraryInterceptorsInjector.kt:22)
	at com.kaspersky.components.kautomator.intercept.delegate.UiDelegate$DefaultImpls.interceptOnPerform(UiDelegate.kt:68)
	at com.kaspersky.components.kautomator.intercept.delegate.UiDelegate$DefaultImpls.access$interceptOnPerform(UiDelegate.kt:13)
	at com.kaspersky.components.kautomator.intercept.delegate.UiDelegate$interceptPerform$1.invoke(UiDelegate.kt:44)
	at com.kaspersky.components.kautomator.intercept.delegate.UiDelegate$DefaultImpls.interceptPerform(UiDelegate.kt:49)
	at com.kaspersky.components.kautomator.intercept.delegate.UiObjectInteractionDelegate.interceptPerform(UiObjectInteractionDelegate.kt:22)
	at com.kaspersky.components.kautomator.intercept.delegate.UiObjectInteractionDelegate.interceptPerform(UiObjectInteractionDelegate.kt:22)
	at com.kaspersky.components.kautomator.intercept.delegate.UiObjectInteractionDelegate.perform(UiObjectInteractionDelegate.kt:62)
	at com.kaspersky.components.kautomator.intercept.delegate.UiObjectInteractionDelegate.perform(UiObjectInteractionDelegate.kt:48)
	at com.kaspersky.components.kautomator.component.edit.UiEditableActions$DefaultImpls.typeText(UiEditableActions.kt:18)
	at com.kaspersky.components.kautomator.component.edit.UiEditText.typeText(UiEditText.kt:15)
	at thor.zopsmart.com.thor.kaspresso.tests.UserCheckoutTest$onOrderPlacementOrderIdShouldBeGenerated$3$2$3$1$1.invoke(UserCheckoutTest.kt:84)
	at thor.zopsmart.com.thor.kaspresso.tests.UserCheckoutTest$onOrderPlacementOrderIdShouldBeGenerated$3$2$3$1$1.invoke(UserCheckoutTest.kt:19)
	at com.kaspersky.components.kautomator.component.common.views.UiBaseView.invoke(UiBaseView.kt:54)
	at thor.zopsmart.com.thor.kaspresso.tests.UserCheckoutTest$onOrderPlacementOrderIdShouldBeGenerated$3$2$3$1.invoke(UserCheckoutTest.kt:83)
	at thor.zopsmart.com.thor.kaspresso.tests.UserCheckoutTest$onOrderPlacementOrderIdShouldBeGenerated$3$2$3$1.invoke(UserCheckoutTest.kt:19)
	at com.kaspersky.kaspresso.flakysafety.algorithm.FlakySafetyAlgorithm.invokeFlakySafely(FlakySafetyAlgorithm.kt:32)
	at com.kaspersky.kaspresso.flakysafety.FlakySafetyProviderGlobalImpl.flakySafely(FlakySafetyProviderGlobalImpl.kt:94)
	at com.kaspersky.kaspresso.testcases.core.testcontext.BaseTestContext.flakySafely(Unknown Source:12)
	at com.kaspersky.kaspresso.flakysafety.FlakySafetyProvider$DefaultImpls.flakySafely$default(FlakySafetyProvider.kt:32)
	at thor.zopsmart.com.thor.kaspresso.tests.UserCheckoutTest$onOrderPlacementOrderIdShouldBeGenerated$3$2$3.invoke(UserCheckoutTest.kt:82)
	at thor.zopsmart.com.thor.kaspresso.tests.UserCheckoutTest$onOrderPlacementOrderIdShouldBeGenerated$3$2$3.invoke(UserCheckoutTest.kt:19)
	at com.kaspersky.components.kautomator.screen.UiScreen.invoke(UiScreen.kt:107)
	at thor.zopsmart.com.thor.kaspresso.tests.UserCheckoutTest$onOrderPlacementOrderIdShouldBeGenerated$3$2.invoke(UserCheckoutTest.kt:81)
	at thor.zopsmart.com.thor.kaspresso.tests.UserCheckoutTest$onOrderPlacementOrderIdShouldBeGenerated$3$2.invoke(UserCheckoutTest.kt:19)
	at com.kaspersky.kaspresso.testcases.core.testcontext.TestContext.step(TestContext.kt:38)
	at thor.zopsmart.com.thor.kaspresso.tests.UserCheckoutTest$onOrderPlacementOrderIdShouldBeGenerated$3.invoke(UserCheckoutTest.kt:53)
	at thor.zopsmart.com.thor.kaspresso.tests.UserCheckoutTest$onOrderPlacementOrderIdShouldBeGenerated$3.invoke(UserCheckoutTest.kt:19)
	at com.kaspersky.kaspresso.testcases.core.TestRunner.runMainTestSection(TestRunner.kt:144)
	at com.kaspersky.kaspresso.testcases.core.TestRunner.run(TestRunner.kt:58)
	at com.kaspersky.kaspresso.testcases.core.sections.MainTestSection.run(MainTestSection.kt:29)
	at thor.zopsmart.com.thor.kaspresso.tests.UserCheckoutTest.onOrderPlacementOrderIdShouldBeGenerated(UserCheckoutTest.kt:46)
	at java.lang.reflect.Method.invoke(Native Method)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at androidx.test.rule.ActivityTestRule$ActivityStatement.evaluate(ActivityTestRule.java:531)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runners.Suite.runChild(Suite.java:128)
	at org.junit.runners.Suite.runChild(Suite.java:27)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
	at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:56)
	at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:392)
	at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2189)

Tests ran to completion.

Kindly please help here.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
matzukcommented, Jun 17, 2021

@pp-gtroshin @VarshaBhatiaPapershift Hi! Can you prepare a simple example to produce this bug? It would help a lot to determine the root cause.

0reactions
VarshaBhatiaPapershiftcommented, Jun 16, 2021

Having the similar issue

    @Test
    fun mustOpenRegisterPageFromWelcomePageTest() {
        setupEnvironment().run {
            WelcomeScreen {
                takeScreenshot("Welcome Screen")
                this.welcomeText.containsText(context.getString(R.string.welcome_view_title))
            }
        }
    }
    -----------
    object WelcomeScreen : BaseTerminalScreen<WelcomeScreen>() {
    override val layoutId: Int
        get() = R.layout.fragment_welcome
    override val viewClass: Class<*>
        get() = WelcomeFragment::class.java
    val welcomeText = UiTextView {
        this.withId(this@WelcomeScreen.packageName, "headerTextView")
    }
}```

Error:

com.kaspersky.components.kautomator.intercept.exception.UnfoundedUiObjectException: The UiObject2 was not found on the screen. The selector=BySelector [RES='\Qcom.papershift.terminal.delta:id/headerTextView\E'], index=0

Verion kaspresso = '1.2.1'
Read more comments on GitHub >

github_iconTop Results From Across the Web

Xcode UI test fails to edit multiple UITextFields
I have a UI with multiple UITextField s that I want to test by clearing their contents and typing new values. However, only...
Read more >
A brand new website interface for an even better experience!
Unable to identify and typeText on the UIScreen elements using UITextEdit properties.
Read more >
XCTest unable to find textfield - ios - Stack Overflow
If you want to examine an element, first step is to check whether it is accessible by an identifier or not. The crash...
Read more >
Calabash and Xamarin Forms, what am I missing? - MSDN
I have set the x:Name for both elements so I can find them via ... way for me to isolate specific text boxes...
Read more >
Chapter 2 Getting Started with SwiftUI and Working with Text
If you can't see the design canvas, you can go up to the Xcode menu and choose Editor ... In SwiftUI, you can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found