From c1fea0eb71894b0993c06050d074b94912424ba2 Mon Sep 17 00:00:00 2001 From: Valery Yatsynovich Date: Wed, 10 Aug 2022 14:02:46 +0300 Subject: [PATCH] fix: Bump minimum required Selenium version to `4.4.0` --- gradle.properties | 2 +- .../remote/AppiumW3CHttpCommandCodec.java | 27 ------------------- 2 files changed, 1 insertion(+), 28 deletions(-) diff --git a/gradle.properties b/gradle.properties index 62048789f..b11361057 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,4 +7,4 @@ signing.secretKeyRingFile=PathToYourKeyRingFile ossrhUsername=your-jira-id ossrhPassword=your-jira-password -selenium.version=4.2.1 +selenium.version=4.4.0 diff --git a/src/main/java/io/appium/java_client/remote/AppiumW3CHttpCommandCodec.java b/src/main/java/io/appium/java_client/remote/AppiumW3CHttpCommandCodec.java index e6b293921..cd2d6991c 100644 --- a/src/main/java/io/appium/java_client/remote/AppiumW3CHttpCommandCodec.java +++ b/src/main/java/io/appium/java_client/remote/AppiumW3CHttpCommandCodec.java @@ -22,22 +22,13 @@ import static org.openqa.selenium.remote.DriverCommand.GET_ELEMENT_SIZE; import static org.openqa.selenium.remote.DriverCommand.GET_PAGE_SOURCE; import static org.openqa.selenium.remote.DriverCommand.IS_ELEMENT_DISPLAYED; -import static org.openqa.selenium.remote.DriverCommand.SEND_KEYS_TO_ACTIVE_ELEMENT; import static org.openqa.selenium.remote.DriverCommand.SEND_KEYS_TO_ELEMENT; import static org.openqa.selenium.remote.DriverCommand.SET_TIMEOUT; import static org.openqa.selenium.remote.DriverCommand.SUBMIT_ELEMENT; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; - -import org.openqa.selenium.interactions.KeyInput; -import org.openqa.selenium.interactions.Sequence; import org.openqa.selenium.remote.codec.w3c.W3CHttpCommandCodec; -import java.util.Collection; import java.util.Map; -import java.util.stream.Collectors; -import java.util.stream.Stream; public class AppiumW3CHttpCommandCodec extends W3CHttpCommandCodec { /** @@ -51,7 +42,6 @@ public AppiumW3CHttpCommandCodec() { defineCommand(GET_ELEMENT_ATTRIBUTE, get("/session/:sessionId/element/:id/attribute/:name")); defineCommand(IS_ELEMENT_DISPLAYED, get("/session/:sessionId/element/:id/displayed")); defineCommand(GET_PAGE_SOURCE, get("/session/:sessionId/source")); - defineCommand(SEND_KEYS_TO_ACTIVE_ELEMENT, post("/session/:sessionId/actions")); } @Override @@ -76,23 +66,6 @@ public void alias(String commandName, String isAnAliasFor) { protected Map amendParameters(String name, Map parameters) { // This blocks parent constructor from undesirable parameters amending switch (name) { - case SEND_KEYS_TO_ACTIVE_ELEMENT: - Object rawValue = parameters.get("value"); - //noinspection unchecked - Stream source = (rawValue instanceof Collection) - ? ((Collection) rawValue).stream() - : Stream.of((CharSequence[]) rawValue); - String text = source.collect(Collectors.joining()); - - final KeyInput keyboard = new KeyInput("keyboard"); - Sequence sequence = new Sequence(keyboard, 0); - for (int i = 0; i < text.length(); ++i) { - sequence.addAction(keyboard.createKeyDown(text.charAt(i))) - .addAction(keyboard.createKeyUp(text.charAt(i))); - } - return ImmutableMap.builder() - .put("actions", ImmutableList.of(sequence.toJson())) - .build(); case SEND_KEYS_TO_ELEMENT: case SET_TIMEOUT: return super.amendParameters(name, parameters);