Skip to content

Conversation

@mykola-mokhnach
Copy link

No description provided.

@mykola-mokhnach mykola-mokhnach requested a review from KazuCocoa May 26, 2025 07:00
@KazuCocoa
Copy link
Member

KazuCocoa commented May 26, 2025

  • I confirmed the getting hittable attribute returned the expected value in docs: address WDA's hittable and XCTest's isHittable appium-xcuitest-driver#2565 as vanilla XCTest's isHittable for the Hello, world! content.
  • the find elements with xpath like driver.find_elements :xpath, '//*[@hittable="true"]' included false ones since the change didn't go though the XPath case, but once I checked the individual's attribute, it returned expected false value for hidden case as docs: address WDA's hittable and XCTest's isHittable appium-xcuitest-driver#2565
    • In the "big button" view in the xcuitest issue link, it returned 17 elements with driver.find_elements :xpath, '//*[@hittable="true"]'. 7 elements had hittable == false, which was expected, so the XPath request didn't filter out false case. Current PR state should be expected for this behavior I believe

note:

This is currently expected since this hittable is not available in the page source intentionally.
I added like below hittable for testing purpose to get them in /source endpoint, but they didn't go through the fb_snapshotForAttributeName https://github.com/appium/WebDriverAgent/pull/1022/files#diff-41d287734cdc18a824a8d28065351fbc77d04fd1418e5b32ee5a2510449509c0R33-R35, so I haven't checked entire the screen, but the primary test target in appium/appium-xcuitest-driver#2565 (Hello, world! static text with/without accessibilityHidden and with popover) worked expectedly.

--- a/WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m
+++ b/WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m
@@ -48,6 +48,7 @@
 static NSString* const FBExclusionAttributeFocused = @"focused";
 static NSString* const FBExclusionAttributePlaceholderValue = @"placeholderValue";
 static NSString* const FBExclusionAttributeNativeFrame = @"nativeFrame";
+static NSString* const FBExclusionAttributeHittable = @"hittable";

 _Nullable id extractIssueProperty(id issue, NSString *propertyName) {
   SEL selector = NSSelectorFromString(propertyName);
@@ -265,6 +266,9 @@ + (NSDictionary *)dictionaryForElement:(id<FBXCElementSnapshot>)snapshot
   },
     FBExclusionAttributeFocused: ^{
     return [@([wrappedSnapshot isWDFocused]) stringValue];
+  },
+    FBExclusionAttributeHittable: ^{
+    return [@([wrappedSnapshot isWDHittable]) stringValue];
   }
   } mutableCopy];

@KazuCocoa

This comment was marked as resolved.

@KazuCocoa
Copy link
Member

KazuCocoa commented May 26, 2025

Updated my comment

In short, the hittable endpoint worked the same as vanilla isHittable I tested in appium/appium-xcuitest-driver#2565 for a few elements. The page source/XPath one needs to be adjusted, but this PR looks good so far.

I also tested the one below with the Bit Bottom screen. Then, for the "hittableTest" label element (which is the application's top), also returned true for isHittable while #1021 new hittable result for the label showed false. This PR for the same element was true, which was the same as the XCTest's result.

let e = app.firstMatch
XCTAssertEqual(e.label, "hittableTest")
XCTAssertTrue(e.exists)
XCTAssertTrue(e.isHittable)

So, for me, this will be more accurate than #1021 to reflect XCTest's hittable state for each element.

@mykola-mokhnach

@mykola-mokhnach mykola-mokhnach marked this pull request as ready for review May 26, 2025 10:07
@mykola-mokhnach
Copy link
Author

@Dan-Maor Could you please review the PR?

@mykola-mokhnach mykola-mokhnach requested a review from Dan-Maor May 26, 2025 10:07
Copy link
Collaborator

@Dan-Maor Dan-Maor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍

@mykola-mokhnach mykola-mokhnach merged commit 13c9f45 into master May 26, 2025
43 of 45 checks passed
@mykola-mokhnach mykola-mokhnach deleted the hittable branch May 26, 2025 18:23
github-actions bot pushed a commit that referenced this pull request May 26, 2025
## [9.9.0](v9.8.0...v9.9.0) (2025-05-26)

### Features

* Use another snapshotting mechanism for the hittable attribute calculation ([#1022](#1022)) ([13c9f45](13c9f45))
@github-actions
Copy link

🎉 This PR is included in version 9.9.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants