feat: Proxy commands issues via RemoteWebElement by pujagani · Pull Request #2311 · appium/java-client
Fixes #2239
Change list
- Add mechanism to proxy RemoteWebElement methods.
Types of changes
What types of changes are you proposing/introducing to Java client?
Put an x in the boxes that apply
- No changes in production code.
- Bugfix (non-breaking change which fixes an issue)
- New feature (non-breaking change which adds functionality)
- Breaking change (fix or feature that would cause existing functionality to not work as expected)
Details
Commands called on WebElements instances are not proxied when using createProxy. Since all webdriver calls route through RemoteWebDriver's execute method, which is marked protected, that call is not intercepted. Commands like findElement return a WebElement instance, and when commands like click are called on it, there is no way to intercept them.
The changes in this PR address the issue by creating a proxy for the RemoteWebElement and assigning id and parent properties for calls whose result is an instance of RemoteWebElement, thereby intercepting these calls without requiring code changes from the user's end.