feat: allow to add custom command dynamically#1506
Conversation
|
@jlipps fyi |
| }); | ||
| } | ||
| if (getAdditionalCommands().containsKey(command.getName())) { | ||
| super.defineCommand(command.getName(), getAdditionalCommands().get(command.getName())); |
There was a problem hiding this comment.
should we verify if the defined command does not override an existing one?
There was a problem hiding this comment.
At server side of plugin, we allow to override the behaviour of an Appium command though the path of command remain same. Keep the client side in line with server, I would like to allow client plugins also to override the existing command in same path with a different behaviour.
There was a problem hiding this comment.
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 pluginIs 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 2I don't know Java well enough to know whether this is possible.
Change list
Appium 2.0 will allow custom plugins to add their own endpoint. This feature helps add custom commands dynamically.
Types of changes
What types of changes are you proposing/introducing to Java client?
Put an
xin the boxes that applyDetails