Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: To support mix of search strategy #565

Closed
amedvedjev opened this issue Feb 2, 2017 · 5 comments
Closed

Feature: To support mix of search strategy #565

amedvedjev opened this issue Feb 2, 2017 · 5 comments
Assignees
Milestone

Comments

@amedvedjev
Copy link

Description

@AndroidFindBy(id = "action_bar")
@HowToUseLocators(androidAutomation = ALL_POSSIBLE)
@AndroidFindBy(className = "android.widget.ImageButton")
@AndroidFindBy(className = "android.widget.ImageView")

it does work now for "ImageView" correctly but for "ImageButton" not! For "ImageButton" it get "action_bar" instead.

@TikhomirovSergey
Copy link
Contributor

TikhomirovSergey commented Feb 2, 2017

@amedvedjev It seems it is not the problem of java_client by itself. But it is possible that it is related to
ByAll.

What will happen if you change annotation sequence like

    @HowToUseLocators(androidAutomation = ALL_POSSIBLE)
    @AndroidFindBy(className = "android.widget.ImageView")
    @AndroidFindBy(className = "android.widget.ImageButton")
    @AndroidFindBy(id = "action_bar")

It seems that ByAll returns the element tha was found first. By annotation sequence you can regulate the priority of the searching at ALL_POSSIBLE case. I'm not sure that it is needed to define the priority by annotations. However C# clint (Selenium and Appium too) page object attributes (annotations) can regulate it clearly. We could think about this feature further.

@amedvedjev
Copy link
Author

amedvedjev commented Feb 2, 2017

what i need is:

  1. first search by some element -> @AndroidFindBy(id = "action_bar")
  2. then inside search by any element ->
    @AndroidFindBy(className = "android.widget.ImageView")
    @AndroidFindBy(className = "android.widget.ImageButton")

e.g.

    @AndroidFindBy(id = "action_bar")
    @HowToUseLocators(androidAutomation = ALL_POSSIBLE) {
        @AndroidFindBy(className = "android.widget.ImageButton")
        @AndroidFindBy(className = "android.widget.ImageView")
    }

another possibilities are also welcome:

  1. search by any -> then inside by any again
    e.g.
    @HowToUseLocators(androidAutomation = ALL_POSSIBLE) {
       @AndroidFindBy(id = "action_bar_1")
       @AndroidFindBy(id = "action_bar_2")
    }
    @HowToUseLocators(androidAutomation = ALL_POSSIBLE) {
        @AndroidFindBy(className = "android.widget.ImageButton")
        @AndroidFindBy(className = "android.widget.ImageView")
    }

@TikhomirovSergey
Copy link
Contributor

Ok. I will think about the design. It would be the interesting feature

@TikhomirovSergey TikhomirovSergey self-assigned this Feb 2, 2017
@TikhomirovSergey TikhomirovSergey added this to the 5.0.0 milestone Feb 2, 2017
@amedvedjev
Copy link
Author

Thanks Sergey! also don't forget about CHAIN possibility.

@TikhomirovSergey
Copy link
Contributor

The fix was merged at #646. It is going to be available soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants