-
-
Notifications
You must be signed in to change notification settings - Fork 755
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
feat: allow to add custom command dynamically #1506
Conversation
@jlipps fyi |
@@ -241,6 +241,9 @@ public Response execute(Command command) throws WebDriverException { | |||
} | |||
}); | |||
} | |||
if (getAdditionalCommands().containsKey(command.getName())) { | |||
super.defineCommand(command.getName(), getAdditionalCommands().get(command.getName())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we verify if the defined command does not override an existing one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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.
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
x
in the boxes that applyDetails