XPath does not locate element which does not fit in the screen on iPhone #7670

Closed
michalakm opened this Issue Jan 10, 2017 · 3 comments

Projects

None yet

4 participants

@michalakm
michalakm commented Jan 10, 2017 edited

The problem

If element is not presented on the screen because it does not fit (for example it is 15th element in a table but on the screen you can fit only 14 elements at once) it is not found by XPath locator.

Environment

  • Appium version (or git revision) that exhibits the issue: 1.6.3
  • Desktop OS/version used to run Appium: OS X El Capitan
  • Node.js version (unless using Appium.app|exe): v6.6.0
  • Mobile platform/version under test: iOS
  • Real device or emulator/simulator: real device - iPhone 5c with iOS 10.1.1
  • Appium CLI or Appium.app|exe: cli

Details

I try to locate and click on an element in native context of the app using XPath on iPhone.
In the app window there are many elements and the one I want to locate and click does not fit in the window so if you try to click on it manually you have to scroll down (so that element appears in the window) and then click. In previous version of Appium (1.5.3) if I searched for this element it was found and Appium scrolled down to the element by itself. In version 1.6.3 if element is not visible on the screen (I did not scroll down so that element became visible on the screen) element is not found. If I scroll to the bottom of the screen (where the element is presented) the the element is found and clicked.

Link to Appium logs

Shorter version
appium log
Full log
full log

@triager triager added the NeedsTriage label Jan 10, 2017
@kcinman11358

I'd recommend not using xpath

@jlipps
Member
jlipps commented Jan 19, 2017

@michalakm the new version of iOS (10+) has a different automation mechanism. it no longer auto-scrolls to an element you want to interact with. you do indeed need to direct your app to scroll to the element manually. if you think about it, it actually more closely mimics what your users have to do, too!

see https://github.com/appium/appium/blob/master/docs/en/advanced-concepts/migrating-to-xcuitest.md for more info.

@jlipps jlipps closed this Jan 19, 2017
@michalakm

Thanks for explanation.

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