java-client
java-client copied to clipboard
multiple locators not work for @AndroidFindAll
@AndroidFindAll(value = [AndroidBy(id = "button_tooltip", priority = 1), AndroidBy(id = "text_view_tooltip_ok", priority = 2)])
i defined element as above annotation, but when the ui displayed the second priority element, the driver not able to found it.
Java code stuff? Please attach the appium server log to see the request.
Actually I had a similar problem, in my case I was using Kotlin. My previous code:
@iOSXCUITFindAll(value = [iOSXCUITBy(accessibility = "accessabilityId")])
@AndroidFindAll(value = [AndroidBy(id = "id")])
lateinit var items: List<MobileElement>
I received error that lateinit var was not initialized. I looked into appium but the findElement request were all 200, and the element was found. I found out that the problem was that List that is used in Kotlin is not being parsed correctly, as it's a part of package kotlin.collections which is immutable 🤦 . I had to use MutableList instead and everything worked fine
@iOSXCUITFindAll(value = [iOSXCUITBy(accessibility = "accessabilityId")])
@AndroidFindAll(value = [AndroidBy(id = "id")])
lateinit var items: MutableList<MobileElement>
@piotrgomola AFAIK you could try using ArrayList on kotlin, that should solve the issue.