Skip to content

Commit 0ec25d1

Browse files
Merge branch 'master' of https://github.com/appium/java-client into bidi
2 parents 5b285d2 + 7fc702e commit 0ec25d1

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/main/java/io/appium/java_client/AppiumDriver.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import org.openqa.selenium.bidi.BiDiException;
3636
import org.openqa.selenium.bidi.HasBiDi;
3737
import org.openqa.selenium.remote.CapabilityType;
38+
import org.openqa.selenium.remote.CommandInfo;
3839
import org.openqa.selenium.remote.DriverCommand;
3940
import org.openqa.selenium.remote.ErrorHandler;
4041
import org.openqa.selenium.remote.ExecuteMethod;
@@ -205,22 +206,23 @@ public Map<String, Object> getStatus() {
205206
* @param methodName The name of custom appium command.
206207
*/
207208
public void addCommand(HttpMethod httpMethod, String url, String methodName) {
209+
CommandInfo commandInfo;
208210
switch (httpMethod) {
209211
case GET:
210-
MobileCommand.commandRepository.put(methodName, MobileCommand.getC(url));
212+
commandInfo = MobileCommand.getC(url);
211213
break;
212214
case POST:
213-
MobileCommand.commandRepository.put(methodName, MobileCommand.postC(url));
215+
commandInfo = MobileCommand.postC(url);
214216
break;
215217
case DELETE:
216-
MobileCommand.commandRepository.put(methodName, MobileCommand.deleteC(url));
218+
commandInfo = MobileCommand.deleteC(url);
217219
break;
218220
default:
219221
throw new WebDriverException(String.format("Unsupported HTTP Method: %s. Only %s methods are supported",
220222
httpMethod,
221223
Arrays.toString(HttpMethod.values())));
222224
}
223-
((AppiumCommandExecutor) getCommandExecutor()).refreshAdditionalCommands();
225+
((AppiumCommandExecutor) getCommandExecutor()).defineCommand(methodName, commandInfo);
224226
}
225227

226228
@Override

src/main/java/io/appium/java_client/remote/AppiumCommandExecutor.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,11 @@ private Response createSession(Command command) throws IOException {
193193
}
194194

195195
public void refreshAdditionalCommands() {
196-
getAdditionalCommands().forEach(this::defineCommand);
196+
getAdditionalCommands().forEach(super::defineCommand);
197+
}
198+
199+
public void defineCommand(String commandName, CommandInfo info) {
200+
super.defineCommand(commandName, info);
197201
}
198202

199203
@SuppressWarnings("unchecked")

0 commit comments

Comments
 (0)