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

UiScrollable support in android uiautomator #2264

Closed
bootstraponline opened this issue Apr 4, 2014 · 19 comments
Closed

UiScrollable support in android uiautomator #2264

bootstraponline opened this issue Apr 4, 2014 · 19 comments
Assignees
Labels
Android related to Android-native driver(s) Enhancement feature
Milestone

Comments

@bootstraponline
Copy link
Member

As discussed on #2228 and #2226. There's no way to scroll using the new android uiautomator locator. Mobile find could be deleted entirely if android uiautomator supported scrolling via UiScrollable.

@bootstraponline
Copy link
Member Author

@jlipps If the intent is to have the tutorial/documentation demo the proper way to scroll on Android, then this should be fixed as part of 1.0. Currently mobile find is the only endpoint capable of scrolling to a UiSelector.

@jlipps jlipps added this to the Appium 1.0 Release milestone Apr 8, 2014
@jlipps
Copy link
Member

jlipps commented Apr 8, 2014

ok, added to 1.0 milestone

@bootstraponline
Copy link
Member Author

Is this still planned for 1.0? If so, I don't think we want to ship the old mobile find in the appium bindings. Currently the only reason it's worth keeping is scrolling.

@jlipps
Copy link
Member

jlipps commented Apr 16, 2014

I think it'd be nice to get rid of the old complex find. @Jonahss any ideas about how long this would take?

@jlipps
Copy link
Member

jlipps commented Apr 23, 2014

We're still supporting complex_find in 1.0, so I'm moving this to 1.1

@jlipps jlipps modified the milestones: Appium 1.1, Appium 1.0 Release Apr 23, 2014
@bootstraponline
Copy link
Member Author

👍

@bootstraponline
Copy link
Member Author

Another feature that complex_find supports is matching on multiple selectors.

self.driver.find_elements_by_android_uiautomator('new UiSelector().enabled(true); new UiSelector().clickable(true)')

It'll match on enabled or clickable. I think by_android-uiautomator should support this before complex_find is removed.

@Jonahss
Copy link
Member

Jonahss commented May 27, 2014

Why couldn't one just run two finds, then concatenate the lists of returned elements?

List<MobileElement> enabled = self.driver.find_elements_by_android_uiautomator('new UiSelector().enabled(true)')
List<MobileElement> clickable = self.driver.find_elements_by_android_uiautomator('new UiSelector().clickable(true)')
List<MobileElement> myElements = enabled + clickable

@bootstraponline
Copy link
Member Author

@Jonahss

  def find val
    # s.className('android.widget.EditText').descriptionContains(value);
    args = [ [4, 'android.widget.EditText'], [7, val] ],
    # s.className('android.widget.EditText').textContains(value);
           [ [4, 'android.widget.EditText'], [3, val] ],

           # s.className('android.widget.Button').descriptionContains(value);
           [ [4, 'android.widget.Button'], [7, val] ],
           # s.className('android.widget.Button').textContains(value);
           [ [4, 'android.widget.Button'], [3, val] ],

           # s.className('android.widget.ImageButton').descriptionContains(value);
           [ [4, 'android.widget.ImageButton'], [7, val] ],
           # s.className('android.widget.ImageButton').textContains(value);
           [ [4, 'android.widget.ImageButton'], [3, val] ],

           # s.descriptionContains(value);
           [ [7, val] ],
           # s.textContains(value);
           [ [3, val] ]
    mobile :find, args
  end

@Jonahss
Copy link
Member

Jonahss commented May 27, 2014

So you're requesting the union of a bunch of selectors, all with a single http request?

Is the overhead of requesting each of those selectors separately significant? I'm usually in favor of feature-lean APIs.

@bootstraponline
Copy link
Member Author

So you're requesting the union of a bunch of selectors, all with a single http request?

This is already implemented in complex_find. I'm saying if we remove complex_find, then find_elements_by_android_uiautomator should support this.

Is the overhead of requesting each of those selectors separately significant?

Yes. When this code is wrapped in a wait that will be 8 find requests issued every 0.5 seconds. As is the case with XPath, it's much more desirable to include support for boolean OR.

@Jonahss
Copy link
Member

Jonahss commented May 27, 2014

Okay

@bootstraponline
Copy link
Member Author

Another reason to add this server side instead of having the clients concatenate the elements is duplicate detection. I'm working on adding this to complex find.

@Jonahss
Copy link
Member

Jonahss commented May 30, 2014

Would we have to remove duplicates in uiautomator selectors too? so self.driver.find_elements_by_android_uiautomator('new UiSelector().enabled(true); new UiSelector().clickable(true)')

will automatically detect duplicates and dedupe?

@bootstraponline
Copy link
Member Author

Yes, only if more than one selector is used to return results. For example, this is fine (no dedupe required):

self.driver.find_elements_by_android_uiautomator('new UiSelector().enabled(true).clickable(true)')

@Jonahss
Copy link
Member

Jonahss commented May 30, 2014

Right, yup.

@Jonahss Jonahss self-assigned this Jun 2, 2014
@Jonahss
Copy link
Member

Jonahss commented Jun 5, 2014

@bootstraponline Do you think I should also include UiCollection? While I'm messing about in here.

@bootstraponline
Copy link
Member Author

@bootstraponline Do you think I should also include UiCollection? While I'm messing about in here.

Sure. It seems useful.

@lock
Copy link

lock bot commented May 3, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators May 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android related to Android-native driver(s) Enhancement feature
Projects
None yet
Development

No branches or pull requests

3 participants