feat: allow to add custom command dynamically by SrinivasanTarget · Pull Request #1506 · appium/java-client

Choose a reason for hiding this comment

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

I think it would help to have an example of how an actual client plugin might be used by end users. This PR seems to help plugin builders, without necessarily providing a recommended format. For example, would it be something like this? (pseudo java):

CustomPlugin plugin = new CustomPlugin(driver);
driver.findElement(...); // do stuff with driver
plugin.myCustomCommand(...); // do stuff with plugin

Is there no way in Java to do some metaprogramming? Ideally we'd be able to use multiple plugins, something like this:

CustomPlugin1.installTo(driver);
CustomPlugin2.installTo(driver);
driver.findElement(...); // do stuff with driver
driver.customCommand1(...); // do stuff with plugin 1
driver.customCommand2(...); // do stuff with plugin 2

I don't know Java well enough to know whether this is possible.