XCUIElement+FBResolve.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /**
  2. * Copyright (c) 2015-present, Facebook, Inc.
  3. * All rights reserved.
  4. *
  5. * This source code is licensed under the BSD-style license found in the
  6. * LICENSE file in the root directory of this source tree. An additional grant
  7. * of patent rights can be found in the PATENTS file in the same directory.
  8. */
  9. #import <XCTest/XCTest.h>
  10. NS_ASSUME_NONNULL_BEGIN
  11. @interface XCUIElement (FBResolve)
  12. /*! This property is always true unless the element gets resolved by its internal UUID (e.g. results of an xpath query) */
  13. @property (nullable, nonatomic) NSNumber *fb_isResolvedNatively;
  14. /**
  15. Returns element instance based on query by element's UUID rather than any other attributes, which
  16. might be a subject of change during the application life cycle. The UUID is calculated based on the PID
  17. of the application to which this particular element belongs and the identifier of the underlying AXElement
  18. instance. That usually guarantees the same element is always going to be matched in scope of the parent
  19. application independently of its current attribute values.
  20. Example: We have an element X with value Y. Our locator looks like 'value == Y'. Normally, if the element's
  21. value is changed to Z and we try to reuse this cached instance of it then a StaleElement error is thrown.
  22. Although, if the cached element instance is the one returned by this API call then the same element
  23. is going to be matched and no staleness exception will be thrown.
  24. @return Either the same element instance if `fb_isResolvedNatively` was set to NO (usually the cache for elements
  25. matched by xpath locators) or the stable instance of the self element based on the query by element's UUID.
  26. */
  27. - (XCUIElement *)fb_stableInstance;
  28. @end
  29. NS_ASSUME_NONNULL_END