O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

Appium: Prime Cuts

1.405 visualizações

Publicada em

For the Appium aficionados amongst us, Dan Cuellar, creator of Appium and Principal Development Manager at FOODIt, will cover some of the more esoteric pieces of Appium along with tips and tricks he’s assembled from around the world to help you broaden your knowledge of Appium.

Publicada em: Tecnologia
  • Seja o primeiro a comentar

Appium: Prime Cuts

  1. 1. 1 PRIME CUTS
  2. 2. ABOUT THE SPEAKER Dan Cuellar @thedancuellar • Creator of Appium • Principal Development Manager at FOODit • Previously at Shazam, Zoosk, and Microsoft • BS in Computer Science from Carnegie Mellon 2
  3. 3. AGENDA • Desktop Apps • New Appium GUI • Advanced Appium 3
  4. 4. 4
  5. 5. 5
  6. 6. https://github.com/Microsoft/WinAppDriver 6
  7. 7. • Modern UWP (Universal Windows Platform) apps • Win32 applications (including pre 2000) • WPF apps • Windows Forms apps • Webviews* (sometimes) • Office Plugins 7
  8. 8. • Pen & Touch support • Mobile Phone support • Xbox support 8
  9. 9. 9
  10. 10. https://github.com/appium/appium-for-mac10
  11. 11. • Currently run separately from Appium • Supports OS X 10.7 and higher • Supports details mouse actions • Supports Native DOM • Does not currently support WebViews, but it is possible to add this11
  12. 12. • platform: must be set to Mac for Appium for Mac • implicitTimeout: milliseconds to try before giving up on finding an element • loopDelay: delay in milliseconds between polling in polling loops (e.g. find element) • mouseMoveSpeed: 0-100 (50 is normal) • diagnosticsDirectoryLocation: directory for diagnostics output • screenShotOnError: 1 to enable, 0 to disable 12
  13. 13. • driver.get("Calculator”) – launch the calculator app • driver.find_element_by_xpath(“//AXApplication[…]/…”) – find element • element.click() – click an element • element.text – get text for an element 13
  14. 14. 14
  15. 15. 15
  16. 16. 16
  17. 17. 17
  18. 18. 18
  19. 19. • accessibilityIdentifier – an identifier that will be used for the purposes of UI automation • accessibilityLabel – a label which assistive devices will use to describe a UI elements • accessibilityHint – adds context to the accessibility label when more explanation is necessary 19
  20. 20. Method 1 XIB file or Storyboard define in the accessibility inspector 20
  21. 21. Method 2 Programatically Objective-C [myElement setAccessibilyIdentifier:@”AwesomeValue”] myElement.accessibilityIdentifier = “AwesomeValue”; Swift myElement.accessibilityIdentifer = “AwesomeValue” 21
  22. 22. Method 3 User Defined Runtime Attributes define with the key “accessibilityIdentifier” and the type “String” 22
  23. 23. Method 1 id property set in Android Studio 23
  24. 24. Method 2 id property set the property android:id or android:name in the XML 24
  25. 25. If you aren’t seeing your IDs check yourself and your parent elements • isAccessibilityElement – when set to false the element is not in the accessibility DOM • accessibilityElementsHidden – hide the children of this element from the accessibility DOM Also, you may need to make sure that the UIElement implements the UIAccessibility protocol 25
  26. 26. 26
  27. 27. CONTEXTS 27 Native Context Web Context
  28. 28. • Xcode 7 and iOS 9 do not support installing the speedup tool automatically that previous versions of Appium used • No worries, you can install it manually • https://github.com/appium/appium/blob/master/docs/en/advanced- concepts/iwd_xcode7.md • Now your iOS tests will be fast again • iOS 10 and up, the simulator takes a while to boot • The best workaround is to warm them up in advance 28
  29. 29. • iOS and Android • autoWebView – start in the webview context (really useful for Cordova apps) • Android • ignoreUnimportantViews – can speed up your Android tests • nativeWebScreenshot – takes the screenshot from UIAutomator instead of chromedriver 29
  30. 30. • iOS • locationServicesAuthorized – pre-authorizes location services (prevents an alert) • Auto[Accept|Dismiss]Alerts – useful to prevent alerts • nativeWebTap – uses non-javascript taps on web content • safariIgnoreFraudWarning – allows https without proper certs • interKeyDelay - time between keystrokes • sendKeyStrategy – (oneByOne, grouped, or setValue) 30
  31. 31. driver.setNetworkConnection(value) [Android only] Value (Alias) Data Wifi Airplane Mode 0 (None) 0 0 0 1 (Airplane Mode) 0 0 1 2 (Wifi only) 0 1 0 4 (Data only) 1 0 0 6 (All Network on) 1 1 0 31
  32. 32. • XPath is slow • Avoid using it where possible • If you do use it, do it as a sub-search on a more quickly found element • Implicit timeout saves code but can slow down tests • Negative checks (e.g. element does not exist) always take the timeout • Replace negative checks with findElements() calls and then check the count 32
  33. 33. • Because of the way it’s implemented • Rather than reimplement XPath searching for native elements, we took a less complicated and brittle approach We generate an XML representation of the document (EXPENSIVE) then search • Pros • XPath is always correct and accurate as we use a standard implementation • Much easier to maintain • Cons • It’s slow because we must generate a model of the entire DOM 33
  34. 34. MORE INFO • Website: http://www.appium.io • Slack: appium.slack.com • Forum: discuss.appium.io • GitHub: http://www.github.com/appium/appium 35
  35. 35. 36

×