FBElement.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 <CoreGraphics/CoreGraphics.h>
  10. #import <Foundation/Foundation.h>
  11. NS_ASSUME_NONNULL_BEGIN
  12. /**
  13. Protocol that should be implemented by class that can return element properties defined in WebDriver Spec
  14. */
  15. @protocol FBElement <NSObject>
  16. /*! Element's frame in normalized (rounded dimensions without Infinity values) CGRect format */
  17. @property (nonatomic, readonly, assign) CGRect wdFrame;
  18. /*! Element's wsFrame in NSDictionary format */
  19. @property (nonatomic, readonly, copy) NSDictionary *wdRect;
  20. /*! Element's name */
  21. @property (nonatomic, readonly, copy, nullable) NSString *wdName;
  22. /*! Element's label */
  23. @property (nonatomic, readonly, copy, nullable) NSString *wdLabel;
  24. /*! Element's selected state */
  25. @property (nonatomic, readonly, getter = isWDSelected) BOOL wdSelected;
  26. /*! Element's type */
  27. @property (nonatomic, readonly, copy) NSString *wdType;
  28. /*! Element's value */
  29. @property (nonatomic, readonly, strong, nullable) NSString *wdValue;
  30. /*! Element's unique identifier */
  31. @property (nonatomic, readonly, copy, nullable) NSString *wdUID;
  32. /*! Whether element is enabled */
  33. @property (nonatomic, readonly, getter = isWDEnabled) BOOL wdEnabled;
  34. /*! Whether element is visible */
  35. @property (nonatomic, readonly, getter = isWDVisible) BOOL wdVisible;
  36. /*! Whether element is accessible */
  37. @property (nonatomic, readonly, getter = isWDAccessible) BOOL wdAccessible;
  38. /*! Whether element is an accessibility container (contains children of any depth that are accessible) */
  39. @property (nonatomic, readonly, getter = isWDAccessibilityContainer) BOOL wdAccessibilityContainer;
  40. /*! Whether element is focused */
  41. @property (nonatomic, readonly, getter = isWDFocused) BOOL wdFocused;
  42. /*! Whether element is hittable */
  43. @property (nonatomic, readonly, getter = isWDHittable) BOOL wdHittable;
  44. /*! Element's index relatively to its parent. Starts from zero */
  45. @property (nonatomic, readonly) NSUInteger wdIndex;
  46. /**
  47. Returns value of given property specified in WebDriver Spec
  48. Check the FBElement protocol to get list of supported attributes.
  49. This method also supports shortcuts, like wdName == name, wdValue == value.
  50. @param name WebDriver Spec property name
  51. @return the corresponding property value
  52. @throws FBUnknownAttributeException if there is no matching attribute defined in FBElement protocol
  53. */
  54. - (nullable id)fb_valueForWDAttributeName:(NSString *__nullable)name;
  55. @end
  56. NS_ASSUME_NONNULL_END