XCUIElementAttribute `hasFocus` is only available on tvOS, please make available on other OS's

Originator:hello
Number:rdar://49950847 Date Originated:2019-04-16
Status:Duplicate/Open Resolved:2019-05-16
Product:Xcode Product Version:Xcode 10.2 (10E125)
Classification: Reproducible:Always
 
Duplicate of 22163138

Summary:
The `hasFocus` `XCUIElementAttribute` is only available on tvOS. This would be very handy to have access too on other OS's, particularly on macOS.

Steps to Reproduce:
When running an XCUITest against a macOS app, attempt to access the `hasFocus` property on an XCUIElement. Note that it is not accessible, but other properties such as `isEnabled` are accessible.

Expected Results:
Expected to be able to access the `hasFocus` property on an XCUIElement.

Actual Results:
Unable to access the `hasFocus` property on the XCUIElement.

Version/Build:
Xcode 10.2 (10E125)

Notes:
I was able to deduce that `hasFocus` is only available on tvOS be looking at the `XCUIElementAttributes.h` file, where on line 69 we have:

```objc
#if TARGET_OS_TV
/*! Whether or not the elment has UI focus. */
@property (readonly) BOOL hasFocus;
#endif
```

Another solution to this issue would be to simply update [the documentation](https://developer.apple.com/documentation/xctest/xcuielementattributes/1627636-hasfocus) to mention that this property is only available on tvOS. This is less preferable, but would at least solve part of the problem.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!