|
35 | 35 | import org.openqa.selenium.bidi.BiDiException;
|
36 | 36 | import org.openqa.selenium.bidi.HasBiDi;
|
37 | 37 | import org.openqa.selenium.remote.CapabilityType;
|
| 38 | +import org.openqa.selenium.remote.CommandInfo; |
38 | 39 | import org.openqa.selenium.remote.DriverCommand;
|
39 | 40 | import org.openqa.selenium.remote.ErrorHandler;
|
40 | 41 | import org.openqa.selenium.remote.ExecuteMethod;
|
@@ -205,22 +206,23 @@ public Map<String, Object> getStatus() {
|
205 | 206 | * @param methodName The name of custom appium command.
|
206 | 207 | */
|
207 | 208 | public void addCommand(HttpMethod httpMethod, String url, String methodName) {
|
| 209 | + CommandInfo commandInfo; |
208 | 210 | switch (httpMethod) {
|
209 | 211 | case GET:
|
210 |
| - MobileCommand.commandRepository.put(methodName, MobileCommand.getC(url)); |
| 212 | + commandInfo = MobileCommand.getC(url); |
211 | 213 | break;
|
212 | 214 | case POST:
|
213 |
| - MobileCommand.commandRepository.put(methodName, MobileCommand.postC(url)); |
| 215 | + commandInfo = MobileCommand.postC(url); |
214 | 216 | break;
|
215 | 217 | case DELETE:
|
216 |
| - MobileCommand.commandRepository.put(methodName, MobileCommand.deleteC(url)); |
| 218 | + commandInfo = MobileCommand.deleteC(url); |
217 | 219 | break;
|
218 | 220 | default:
|
219 | 221 | throw new WebDriverException(String.format("Unsupported HTTP Method: %s. Only %s methods are supported",
|
220 | 222 | httpMethod,
|
221 | 223 | Arrays.toString(HttpMethod.values())));
|
222 | 224 | }
|
223 |
| - ((AppiumCommandExecutor) getCommandExecutor()).refreshAdditionalCommands(); |
| 225 | + ((AppiumCommandExecutor) getCommandExecutor()).defineCommand(methodName, commandInfo); |
224 | 226 | }
|
225 | 227 |
|
226 | 228 | @Override
|
|
0 commit comments