Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store element's found method #149

Closed
wants to merge 2 commits into from
Closed

Conversation

vinocher-bc
Copy link

@vinocher-bc vinocher-bc commented May 1, 2024

Store element's found method values, so it can be used to check if the element still exists. This allows a method like element.waitForNonExistence() to be implemented, to handle cases where the id may be reused by the Accessibility provider after an element is deleted.

@vinocher-bc vinocher-bc self-assigned this May 1, 2024
Copy link
Contributor

@tristanlabelle tristanlabelle left a comment

Choose a reason for hiding this comment

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

I think this functionality needs to be implemented at a higher layer:

  • There could be any number of ways to look up elements that don't fit within the foundUsing/foundUsingValue model, for example asking for the currently focused element, or asking for descendants of an element.
  • This makes a child item (Element) know how to lookup itself, which is an inversion of layering as normally something else like a session or an ancestor element will provide a way to lookup the element.
  • This adds extra state that is not represented in the webdriver protocol, and this project should remain as much as possible a direct mapping of that protocol.

I believe the intent is to replicate XCUITest functionality, but webdriver is a lower-level protocol and it may be that we need an intermediate layer to achieve this if we can't currently do it with our Arc UI testing abstractions.

@@ -175,7 +175,7 @@ public class Session {
return PollResult(value: elementId, success: elementId != nil)
}.value

return elementId.map { Element(session: self, id: $0) }
return elementId.map { Element(session: self, id: $0, foundUsing: using, foundUsingValue: value) }
Copy link
Contributor

Choose a reason for hiding this comment

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

The original query might also have had a startingAt value, so immediately rerunning the query using foundUsing and foundUsingValue would not return the same result.

@jeffdav
Copy link
Contributor

jeffdav commented May 2, 2024

I agree this feels like the wrong solution. We've discussed implementing XCUITest as a layer on top of this, which is probably the right solution.

@vinocher-bc
Copy link
Author

  • There could be any number of ways to look up elements that don't fit within the foundUsing/foundUsingValue model, for example asking for the currently focused element, or asking for descendants of an element.

Yes, this approach has holes, and will be abandoned.

@vinocher-bc vinocher-bc closed this May 2, 2024
@vinocher-bc vinocher-bc deleted the vinoo/storeElementFound branch May 2, 2024 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants