Skip to content

Feature: To support mix of search strategy #565

Closed

Description

@amedvedjev

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.

Activity

  1. TikhomirovSergey commented on Feb 2, 2017

    @TikhomirovSergey
    Contributor

    @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.

  2. amedvedjev commented on Feb 2, 2017

    @amedvedjev
    Author

    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")
        }
    
  3. TikhomirovSergey commented on Feb 2, 2017

    @TikhomirovSergey
    Contributor

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

  4. added this to the 5.0.0 milestone on Feb 2, 2017
  5. amedvedjev commented on Feb 2, 2017

    @amedvedjev
    Author

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

  6. added a commit that references this issue on May 30, 2017
  7. TikhomirovSergey commented on May 30, 2017

    @TikhomirovSergey
    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

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions