Skip to content

PageObjects gets elements API instead of element API #549

Closed
@saikrishna321

Description

@saikrishna321

@TikhomirovSergey need help on this

Works fine

@HowToUseLocators(androidAutomation = CHAIN)
    @AndroidFindBySet({
            @AndroidFindBy(xpath = "(.//*[@resource-id='org.wordpress.android:id/note_content_container'])[position()=2]"),
            @AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"org.wordpress.android:id/note_subject\")")
    }) //gets the third text from the note_subject view

Does not work

@HowToUseLocators(androidAutomation = CHAIN)
    @AndroidFindBySet({
            @AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"org.wordpress.android:id/note_content_container\").enabled(true).instance(2)"),
            @AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"org.wordpress.android:id/note_subject\")")
    }) //return the first text from the view 

https://gist.github.com/anonymous/d4440cab5e3213f9084498471201cd84

The above works fine, when we cast AndroidDriver

((AndroidDriver) driver).findElementByAndroidUIAutomator("new UiSelector().resourceId(\"org.wordpress.android:id/note_subject\").enabled(true).instance(2)").getText()

https://gist.github.com/anonymous/3b1fcc5761c370a1025d52c42b60b9fd

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions