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

Appium is slow #169

Closed
bootstraponline opened this issue Feb 12, 2013 · 7 comments
Closed

Appium is slow #169

bootstraponline opened this issue Feb 12, 2013 · 7 comments
Assignees

Comments

@bootstraponline
Copy link
Member

I have a simple seven line test that logs in and then out of an app. It takes 53 seconds to run. One step iterates through almost 36 elements to find the appropriate value.

Is the best practice to discover elements via text and then save index numbers so subsequent runs are not slow?

@jlipps
Copy link
Member

jlipps commented Feb 12, 2013

Your snippet was a little opaque to me; would you mind pasting your whole test including helper functions?

For Appium tests, we "remember" indexes and treat them as part of the page source (i.e., they don't change), but if there's a faster way to do what you want (which sounds like it's "find an element by its text") we certainly want to add it instead of relying on brittle indexes.

@bootstraponline
Copy link
Member Author

This is the whole test. The strings have been altered slightly. The need to manually invoke wait every time will go away once I work on it a bit more. I just got the test passing today.

  start = Time.now
  wait { button('Sign In') }.click
  wait { textfield('Email') }.send_keys 'my@email'
  wait { secure_textfield('Password') }.send_keys 'password'
  wait { button('Sign In', 2) }.click
  wait { button('details') }.click
  wait { text_include('my account') }.click
  wait { button('Sign Out') }.click
  alert_accept
  puts "Finished in #{Time.now - start} seconds"

The helper functions are defined in appium/ruby_console.

@bootstraponline
Copy link
Member Author

I think the problem is text_include('my account'). There are about 30 static text elements and the one I have to click on is dynamically generated. The label text changes so I can only do a partial match. Enumerating the name attribute of each static text is slow.

> text_include('my account')
session/f128e37b-ef35-4802-86f1-0a6addcfa9e1/elements
{"using":"tag name","value":"text"}
get
session/f128e37b-ef35-4802-86f1-0a6addcfa9e1/element/88/attribute/name
null
get
session/f128e37b-ef35-4802-86f1-0a6addcfa9e1/element/89/attribute/name
null
get
session/f128e37b-ef35-4802-86f1-0a6addcfa9e1/element/90/attribute/name
null
get
session/f128e37b-ef35-4802-86f1-0a6addcfa9e1/element/91/attribute/name
null
get
session/f128e37b-ef35-4802-86f1-0a6addcfa9e1/element/92/attribute/name
null
get
session/f128e37b-ef35-4802-86f1-0a6addcfa9e1/element/93/attribute/name
null
get
session/f128e37b-ef35-4802-86f1-0a6addcfa9e1/element/94/attribute/name
null
get
session/f128e37b-ef35-4802-86f1-0a6addcfa9e1/element/95/attribute/name
null
get
session/f128e37b-ef35-4802-86f1-0a6addcfa9e1/element/96/attribute/name
null
get
session/f128e37b-ef35-4802-86f1-0a6addcfa9e1/element/97/attribute/name
null
get
session/f128e37b-ef35-4802-86f1-0a6addcfa9e1/element/98/attribute/name
null
get
session/f128e37b-ef35-4802-86f1-0a6addcfa9e1/element/99/attribute/name
null
get
session/f128e37b-ef35-4802-86f1-0a6addcfa9e1/element/100/attribute/name
null
get
session/f128e37b-ef35-4802-86f1-0a6addcfa9e1/element/101/attribute/name
null
get
session/f128e37b-ef35-4802-86f1-0a6addcfa9e1/element/102/attribute/name
null
get
session/f128e37b-ef35-4802-86f1-0a6addcfa9e1/element/103/attribute/name
null
get
session/f128e37b-ef35-4802-86f1-0a6addcfa9e1/element/104/attribute/name
null
get
session/f128e37b-ef35-4802-86f1-0a6addcfa9e1/element/105/attribute/name
null
get
session/f128e37b-ef35-4802-86f1-0a6addcfa9e1/element/106/attribute/name
null
get
session/f128e37b-ef35-4802-86f1-0a6addcfa9e1/element/107/attribute/name
null
get
session/f128e37b-ef35-4802-86f1-0a6addcfa9e1/element/108/attribute/name
null
get
session/f128e37b-ef35-4802-86f1-0a6addcfa9e1/element/109/attribute/name
null
get
session/f128e37b-ef35-4802-86f1-0a6addcfa9e1/element/110/attribute/name
null
get
session/f128e37b-ef35-4802-86f1-0a6addcfa9e1/element/111/attribute/name
null
get
session/f128e37b-ef35-4802-86f1-0a6addcfa9e1/element/112/attribute/name
null
get
session/f128e37b-ef35-4802-86f1-0a6addcfa9e1/element/113/attribute/name
null
get
session/f128e37b-ef35-4802-86f1-0a6addcfa9e1/element/114/attribute/name
null
get
session/f128e37b-ef35-4802-86f1-0a6addcfa9e1/element/115/attribute/name
null

@bootstraponline
Copy link
Member Author

I got this working using UIAutomation directly. This example taps the first button that has a name containing 'Sign'. UIAutomation is instant compared to 28 seconds for this feature using WebDriver.

@driver.execute_script %( UIATarget.localTarget().frontMostApp().mainWindow().buttons().firstWithPredicate("name contains[c] 'Sign'").tap() )

@jlipps
Copy link
Member

jlipps commented Feb 21, 2013

Closing this for now, but keep your eyes peeled for future enhancements that allow for greater speed while sticking within the WebDriver paradigm.

@jlipps jlipps closed this as completed Feb 21, 2013
@bootstraponline
Copy link
Member Author

The xpath feature fixed the slowness. It's almost instant now.

dpgraham pushed a commit to dpgraham/appium that referenced this issue Oct 1, 2018
dpgraham pushed a commit to dpgraham/appium that referenced this issue Nov 7, 2018
@lock
Copy link

lock bot commented May 4, 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 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants