Unable to identify and typeText on the UIScreen elements using UITextEdit properties
See original GitHub issueHi there,
Below are the steps involved in my test
- Launch the app
- Locate and perform the action on the element in home screen (Native)
- The previous click actions navigates to the webview which is served by a different SDK
- 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:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@pp-gtroshin @VarshaBhatiaPapershift Hi! Can you prepare a simple example to produce this bug? It would help a lot to determine the root cause.
Having the similar issue