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

Add methods to JsUtility to wrap returned element references #16

Open
sbabcoc opened this issue Dec 20, 2017 · 1 comment
Open

Add methods to JsUtility to wrap returned element references #16

sbabcoc opened this issue Dec 20, 2017 · 1 comment

Comments

@sbabcoc
Copy link
Owner

sbabcoc commented Dec 20, 2017

Element references returned by JavaScript functions are native WebElement objects, which means that we have no automatic recovery if references go stale. We should provide methods to enable implementers to wrap returned references in RobustWebElement objects.

This is especially useful for JavaScript functions that return lists of references. For this scenario, clients would supply the list of element references and an Xpath locator as a regular expression pattern that includes a placeholder for an index. An example of a scenario for this sort of method can be found in the OPCT project, in SearchResults.getSearchResultRows()

@sbabcoc
Copy link
Owner Author

sbabcoc commented Apr 26, 2022

The new implementation of JavaScript-based element search in RobustElementWrapper, and the implementation on FirefoxShadowRoot.findElements(), provide patterns for how this might work. However, the freeform nature of JavaScript functions precludes the provision of a bulletproof generic reference recovery mechanism.
However, it may be possible to create a JavaScript refresh context that retains the relationship between element references and the scripts that acquired them.

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

No branches or pull requests

1 participant